Clone the Wasmi repository and build using cargo:
git clone https://github.com/wasmi-labs/wasmi.git --recursive
cd wasmi
cargo buildWasmi has two major test suites that are accessed via the wasmi and wasmi_wast crates respectively.
cargo test -p wasmi: unit tests and tons of detailed translation unit testscargo test -p wasmi_wast: integration tests including the official Wasm spec testsuite
As usual both testsuites can be run at the same time via cargo test.
In order to benchmark Wasmi use the following command:
cargo bench --bench benches -p wasmiBenchmarks in Wasmi are structured in the following way:
translate: test cases that primarily benchmark the translation performancechecked: validate + translate eagerlyunchecked: eagerly translate but not validatefueled: same ascheckedbut with fuel metering enabledlazy: validate + translate lazilylazy-translation: validate eagerly but translate lazily
instantiate: test cases that primarily benchmark the Wasm module instantiation performanceexecute: test cases that primarily benchmark Wasmi's execution performancecall: call based testcasestiny_keccak,regex_redux,reverse_complement: compiled from optimized Rust sourcesfibonacci: variety of fibonacci tests (recursion, tail-recursion and iteration)memory: test cases benchmarking memory accesses (load, store, bulk-ops)- many more ..
overhead: test cases that benchmark Wasmi call performance overhead
Example: to benchmark all fibonacci test cases use the following command:
`cargo bench --bench benches -p wasmi execute/fibonacci`.
Wasmi has some built-in fuzzers that are even used in Google's OSSFuzz.
translate: optimized to find crashes and bugs during Wasmi translationexecute: optimized to find crashes and bugs during Wasmi executiondifferential: finds mismatches between different Wasm runtimes- Wasm runtimes compared against trunc Wasmi are Wasmtime and an old Wasmi v0.31
- Requires the
differentialcrate feature.
Example usage:
cargo +nightly fuzz run differential --features differential
Publishing new Wasmi versions requires to publish new versions for all crates in the Wasmi workspace.
In order to successfully publish one needs to publish the following Wasmi crates in the following order:
wasmi_corewasmi_collectionswasmi_irwasmiwasmi_wastwasmi_wasiwasmi_c_api_macroswasmi_c_api_implwasmi_cli(*)
(*) Before publishing wasmi_cli one needs to comment-out the profile.release information
in its Cargo.toml. This is required due to a bug in Cargo: rust-lang/cargo#8264
This step can and should be dropped once this Cargo bug has been fixed.