wasmer/tests/spectests
2020-04-15 16:31:05 -07:00
..
address.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
align.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
atomic.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
binary-leb128.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
binary.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
block.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
br_if.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
br_table.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
br.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
break-drop.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
call_indirect.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
call.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
comments.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
const.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
conversions.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
custom.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
data.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
elem.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
endianness.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
exports.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f32_bitwise.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f32_cmp.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f32.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f64_bitwise.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f64_cmp.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
f64.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
float_exprs.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
float_literals.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
float_memory.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
float_misc.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
forward.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
func_ptrs.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
func.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
globals.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
i32.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
i64.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
if.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
imports.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
inline-module.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
int_exprs.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
int_literals.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
labels.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
left-to-right.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
LICENSE Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
linking.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
load.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
local_get.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
local_set.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
local_tee.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
loop.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
memory_grow.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
memory_redundancy.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
memory_size.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
memory_trap.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
memory.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
names.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
nop.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
README.md Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
return.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
select.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
simd_binaryen.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
simd.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
skip-stack-guard-page.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
stack.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
start.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
store.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
switch.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
token.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
traps.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
type.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
unreachable.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
unreached-invalid.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
unwind.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
utf8-custom-section-id.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
utf8-import-field.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
utf8-import-module.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
utf8-invalid-encoding.wast Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00

Wasmer logo

Build Status License Join the Wasmer Community Number of downloads from crates.io Read our API documentation

Wasmer Spectests

Wasmer is a standalone JIT WebAssembly runtime, aiming to be fully compatible with Emscripten, Rust and Go. Learn more.

This crate allows to test the Wasmer runtime against the official specification test suite.

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

SIMD wast specs are also added here.

These 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.

Version

The spectests were last updated at WebAssembly/spec commit a221f2574d7106e92cf8abaf05d5bb1131b19d76.

Testcases

Currently supported command assertions:

  • module fully implemented
  • assert_return fully implemented
  • assert_return_canonical_nan fully implemented
  • assert_return_arithmetic_nan fully implemented
  • assert_trap fully implemented
  • assert_invalid fully implemented (it should not require validation to be performed separate from compilation)
  • assert_malformed fully implemented
  • assert_uninstantiable not implemented, no usages found
  • assert_exhaustion fully implemented
  • register fully implemented
  • perform_action fully implemented

Covered spec tests

See tests/excludes.txt for current coverage.

Specific non-supported cases

There are some cases that we decided to skip for now to accelerate the release schedule:

  • SKIP_CALL_INDIRECT_TYPE_MISMATCH: we implemented traps in a fast way. We haven't yet covered 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 importing 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

  • SKIP_UNARY_OPERATION [memory_grow.wast] In some versions of MacOS this is failing (perhaps because of the chip). More info here:

Executing function c82_l299_action_invoke
thread 'test_memory_grow::test_module_5' panicked at 'assertion failed: `(left == right)`
 left: `Ok([I32(0)])`,
right: `Ok([I32(31)])`', /Users/distiller/project/target/release/build/wasmer-spectests-98805f54de053dd1/out/spectests.rs:32304:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.


failures:
   test_memory_grow::test_module_5

https://circleci.com/gh/wasmerio/wasmer/9556

Development

To test locally, try the following commands:

RUST_BACKTRACE=1 cargo test --features clif -- --nocapture
RUST_BACKTRACE=1 cargo test --features llvm -- --nocapture
RUST_BACKTRACE=1 cargo +nightly test --features singlepass -- --nocapture