#test-suite #shim #mirror #mvp #spec #webasembly

greenwasm-spectest

A library shim around a mirror of the official Webasembly MVP testsuite

5 releases

Uses old Rust 2015

0.3.3 Sep 4, 2018
0.3.2 Sep 3, 2018
0.3.1 Sep 3, 2018
0.3.0 Sep 2, 2018
0.2.0 Sep 1, 2018

#37 in #test-suite

28 downloads per month
Used in greenwasm

MIT/Apache

3MB
47K SLoC

WebAssembly 47K SLoC // 0.0% comments Rust 346 SLoC // 0.3% comments Shell 118 SLoC // 0.1% comments Python 70 SLoC // 0.1% comments

greenwasm-spectest

A library shim around a mirror of the official Webasembly MVP testsuite.

It can be used as a independent testsuite launcher for other Webassembly implementations.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

A library shim around a mirror of the official webassembly MVP testsuite.

It can be used as a independent testsuite launcher for other webassembly implementations by implementing ScriptHandler.

Example:

use greenwasm_spectest::*;

struct DummyHandler;
impl ScriptHandler for DummyHandler {
fn reset(&mut self) {}
fn action_invoke(&mut self,
module: Option<String>,
field: String,
args: Vec<Value>) -> InvokationResult
{
unimplemented!()
}
fn action_get(&mut self,
module: Option<String>,
field: String) -> Value
{
unimplemented!()
}
fn module(&mut self, bytes: Vec<u8>, name: Option<String>) {
unimplemented!()
}
fn assert_malformed(&mut self, bytes: Vec<u8>) {
unimplemented!()
}
fn assert_invalid(&mut self, bytes: Vec<u8>) {
unimplemented!()
}
fn assert_uninstantiable(&mut self, bytes: Vec<u8>) {
unimplemented!()
}
fn assert_exhaustion(&mut self, action: Action) {
unimplemented!()
}
fn register(&mut self, name: Option<String>, as_name: String) {
unimplemented!()
}
}

run_mvp_spectest(&mut DummyHandler).present();

This would result in a output like this:

Executing address.wast ...
Executing align.wast ...
Executing binary.wast ...
Executing block.wast ...
Executing br.wast ...
[...]

wast failures:
address.wast:3, not yet implemented
address.wast:104, <not attempted>
address.wast:105, <not attempted>
...
wast total: 0 passed; 17955 failed

Dependencies

~17MB
~289K SLoC