forked from rust-lang/miri
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Still early here, but might be nice to add testing at some point.
One option is to check output .wast files for identity.
Another is to also execute them, for example, testing that fibonacci(5) has the right output. This is actually not that hard, we need to
- Add imports for testing prints,
(import $print_i32 "spectest" "print" (param i32))for printing ani32, for example. Thespectestmodule is a special module that is supported in wasm test runners (it won't be supported on the web, but could be polyfilled). - Call the import using
call_importto print values. - Add a
startmethod (BinaryenSetStart), avoid(void)function that is called when the module is loaded. - Execute that webassembly using the binaryen shell, which should already be present since we build binaryen. Something like
binaryen-shell test.wastwill load the module and run the start method. - Verify the output is as expected.
Metadata
Metadata
Assignees
Labels
No labels