wasmer/spectests
2018-11-27 23:38:35 -08:00
..
address.wast Fixed heap reference to memory. Added address spectest 2018-10-27 13:33:08 +02:00
align.wast Make align partially pass 2018-10-26 14:53:33 +02:00
binary.wast Added binary spectests 2018-10-30 00:32:53 +01:00
block.wast Update spectests 2018-11-07 11:56:37 +01:00
br_if.wast Test 'tee_local' and 'set_global' in more operators 2018-10-29 09:53:48 +01:00
br_table.wast Test 'tee_local' and 'set_global' in more operators 2018-10-29 09:53:48 +01:00
br.wast Test 'tee_local' and 'set_global' in more operators 2018-10-29 09:53:48 +01:00
break_drop.wast Added break_drop spectest 2018-10-24 00:22:07 +02:00
call_indirect.wast Fix table and memory import and improve memory storage 2018-11-16 16:55:49 +01:00
call.wast Update spectests 2018-11-07 11:56:37 +01:00
comments.wast Added comments spectests 2018-10-30 00:34:46 +01:00
const_.wast Added const spectest 2018-10-24 00:17:36 +02:00
conversions.wast Fixed support for non-deterministic NaNs 2018-10-30 13:28:00 +01:00
custom.wast Added custom spectests 2018-10-30 12:05:00 +01:00
data.wast Automatically start modules first. Documented SKIP_MUTABLE_GLOBALS case 2018-10-29 23:40:20 +01:00
elem.wast Added support for global value offsets 2018-11-18 20:22:18 -08:00
endianness.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
exports.wast Added exports spectest 2018-10-24 00:41:32 +02:00
f32_.wast Added f32 spectest 2018-10-24 01:15:20 +02:00
f32_bitwise.wast Added f32_bitwise spectest. Improved f32, f64 NaN assertions 2018-10-24 01:51:52 +02:00
f32_cmp.wast Added f32_cmp spectest 2018-10-24 01:55:08 +02:00
f64_.wast Added f64 spectest 2018-10-24 01:22:16 +02:00
f64_bitwise.wast Added f64_bitwise spectest 2018-10-24 01:57:37 +02:00
f64_cmp.wast Added f64_cmp spectest 2018-10-24 02:00:59 +02:00
fac.wast Added fac spectests 2018-10-30 11:59:51 +01:00
float_exprs.wast Added float_exprs spectests 2018-10-30 12:02:50 +01:00
float_literals.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
float_memory.wast Added float_memory spectests 2018-10-30 12:07:00 +01:00
float_misc.wast Added float_misc spectests 2018-10-30 12:09:07 +01:00
forward.wast Added forward spectests 2018-10-30 12:10:48 +01:00
func_ptrs.wast Added func_ptrs spectests 2018-10-23 13:13:03 +02:00
func.wast Added func spectests 2018-10-30 00:39:26 +01:00
get_local.wast Added get_local spectests 2018-10-29 13:23:56 +01:00
globals.wast Added support for global references 2018-11-19 10:27:55 -08:00
i32_.wast Added i32 tests 2018-10-19 01:44:48 +02:00
i64_.wast Added i64 spectest 2018-10-24 00:04:30 +02:00
if_.wast Update spectests 2018-11-07 11:56:37 +01:00
int_exprs.wast Added int_exprs spectests 2018-10-30 12:13:15 +01:00
int_literals.wast Added int_literals spectests 2018-10-30 12:15:47 +01:00
labels.wast Added labels spectest 2018-10-24 00:25:11 +02:00
left_to_right.wast Added left_to_right spectests 2018-10-29 15:18:57 +01:00
loop_.wast Update spectests 2018-11-07 11:56:37 +01:00
memory_grow.wast Added memory_grow spectest 2018-11-18 11:13:20 -08:00
memory_redundancy.wast Added memory_redundancy spectests 2018-10-29 14:33:36 +01:00
memory_trap.wast Added memory_trap spectests 💪 2018-11-27 23:35:53 -08:00
memory.wast Added automatic test generator from wasm spec 2018-10-19 01:29:12 +02:00
nop.wast Update spectests 2018-11-07 11:56:37 +01:00
README.md Added unwind spectests 2018-11-27 23:38:35 -08:00
return_.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
select.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
set_local.wast Added set_local tests 2018-10-19 12:44:19 +02:00
stack.wast Added stack spectest 2018-10-28 14:05:52 +01:00
start.wast Added start spectests 2018-10-29 23:44:43 +01:00
store_retval.wast Added store_retval spectests 2018-10-30 12:23:37 +01:00
switch.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
tee_local.wast Add more wasm spectests 2018-10-29 14:36:26 +01:00
token.wast Added token spectests 2018-11-17 00:06:15 -08:00
traps.wast Added traps spectests 2018-11-17 00:06:05 -08:00
typecheck.wast Added typecheck spectests 2018-10-30 12:25:31 +01:00
types.wast Added automatic test generator from wasm spec 2018-10-19 01:29:12 +02:00
unwind.wast Added unwind spectests 2018-11-27 23:38:35 -08:00

This directory contains tests for the core WebAssembly semantics, as described in Semantics.md and specified by the spec interpreter.

This files should be a direct copy of the original WebAssembly spec tests.

Tests are written in the S-Expression script format defined by the interpreter.

Autogenerated Rust test cases

This files will serve as base for autogenerating Rust testcases when WASM_GENERATE_SPECTESTS=1 cargo build is executed (src/build_spectests.rs).

The result autogenerated spectests live in the src/spectests directory.

Testcases

Currently supported command assertions:

  • Module mostly implemented (it should support named modules (module $Xx)).
  • AssertReturn mostly implemented (it should support calls to named modules (invoke $Xx "call")).
  • AssertReturnCanonicalNan fully implemented
  • AssertReturnArithmeticNan fully implemented
  • AssertTrap fully implemented
  • AssertInvalid Fully implemented (it should not require to do validation separate from compilation)
  • AssertMalformed Fully implemented
  • AssertUninstantiable not implemented yet
  • AssertExhaustion not implemented yet
  • Register not implemented yet
  • PerformAction partially implemented, only function invokations for now

Covered spectests

This spectests are currently covered:

  • address.wast
  • align.wast
  • binary.wast
  • block.wast
  • br.wast
  • br_if.wast
  • br_table.wast
  • break-drop.wast
  • call.wast
  • call_indirect.wast
  • comments.wast
  • const.wast
  • conversions.wast
  • custom.wast
  • data.wast
  • elem.wast
  • endianness.wast
  • exports.wast
  • f32.wast
  • f32_bitwise.wast
  • f32_cmp.wast
  • f64.wast
  • f64_bitwise.wast
  • f64_cmp.wast
  • fac.wast
  • float_exprs.wast
  • float_literals.wast
  • float_memory.wast
  • float_misc.wast
  • forward.wast
  • func.wast
  • func_ptrs.wast
  • get_local.wast
  • globals.wast
  • i32.wast
  • i64.wast
  • if.wast
  • imports.wast
  • inline-module.wast
  • int_exprs.wast
  • int_literals.wast
  • labels.wast
  • left-to-right.wast
  • linking.wast
  • loop.wast
  • memory.wast
  • memory_grow.wast
  • memory_redundancy.wast
  • memory_trap.wast
  • names.wast
  • nop.wast
  • return.wast
  • select.wast
  • set_local.wast
  • skip-stack-guard-page.wast
  • stack.wast
  • start.wast
  • store_retval.wast
  • switch.wast
  • tee_local.wast
  • token.wast
  • traps.wast
  • type.wast
  • typecheck.wast
  • unreachable.wast
  • unreached-invalid.wast
  • unwind.wast
  • utf8-custom-section-id.wast
  • utf8-import-field.wast
  • utf8-import-module.wast
  • utf8-invalid-encoding.wast

Specific non-supported cases

There are some cases that we decided to skip for now to fasten the time to release:

  • SKIP_MUTABLE_GLOBALS: Right now the WASM parser can't validate a module with imported/exported mut globals. We decided to skip the tests until Cranelift and wasmparser can handle this (original spec proposal: https://github.com/WebAssembly/mutable-global). Spectests affected:

    • globals.wast
  • SKIP_CALL_INDIRECT_TYPE_MISMATCH: we implemented traps in a fast way. We haven't covered yet the type mismatch on call_indirect. Specs affected:

    • call_indirect.wast
  • SKIP_CALL_UNDEFINED_ELEMENT Tables are imported into every spec module, even for modules that don't expect it. We need to figure out a way to prevent import of objects that are not explicitly imported into the module.

Currently cranelift_wasm::ModuleEnvironment does not provide declare_table_import, etc. so there is no meaningful way of fixing this yet.

  • call_indirect.wast

  • SKIP_SHARED_TABLE [elem.wast] Currently sharing tables between instances/modules does not work. Below are some of the reasons it is hard to achieve.

    • Rust naturally prevents such because of the possibility of race conditions

    • ImportObject is just a wrapper, what we really care about is references to its content.

    • Instance::new contains a mutation points, the part where after getting the object (memory or table) we push values to it table[table_element_index] = func_addr

    • Instance has its own created memories and tables and references to them must outlive Instance::new()

    • Possible strategy

      // ImportObject should be passed by ref
      Instance::new<'a>(..., &ImportObject);
      
      // Add OwnedData to Instance struct
      struct OwnedData;
      
      // For parts where mutatation is really needed
      fn get_mut(&import) -> &mut ImportObject {
          unsafe { transmute::<&ImportObject, &mut ImportObject>(import) }
      }
      
    • elem.wast