diff options
author | Ben Smith <binji@chromium.org> | 2016-10-24 14:02:18 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-11-03 13:05:36 -0700 |
commit | 5a1be55f5a50c1df5cdce6412a589bafa5fab1df (patch) | |
tree | ec4f75ff60d7363331dc45e615eb07d199e0f2da /src/wasm-binary-writer-spec.h | |
parent | fe4f7d4f0d85826f8babbda76607654380cfc050 (diff) | |
download | wabt-5a1be55f5a50c1df5cdce6412a589bafa5fab1df.tar.gz wabt-5a1be55f5a50c1df5cdce6412a589bafa5fab1df.tar.bz2 wabt-5a1be55f5a50c1df5cdce6412a589bafa5fab1df.zip |
Use a new format for the spec JSON writer/parser
The previous spec JSON format was defined around modules. This is
because the previous spec tests would only run assertions on the most
recently read module. In addition, the previous spec writer would write
the assertions as new exported functions in the module, and run those.
The primary reason for doing this was to allow for passing/returning i64
values, which was necessary to test in a JavaScript host.
Now that the primary host for running the spec tests is wasm-interp, we
no longer need do bundle assertions into the module. Also, some of the
new spec tests allow running exported functions on a module that is not
the most-recently-read module.
The new spec test format is now defined around commands. The commands
map directly to the spec format commands, e.g. `module`,
`assert_invalid`, `assert_trap`, etc.
Diffstat (limited to 'src/wasm-binary-writer-spec.h')
-rw-r--r-- | src/wasm-binary-writer-spec.h | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/wasm-binary-writer-spec.h b/src/wasm-binary-writer-spec.h index 7991a019..1c2629ce 100644 --- a/src/wasm-binary-writer-spec.h +++ b/src/wasm-binary-writer-spec.h @@ -18,39 +18,24 @@ #define WASM_BINARY_WRITER_SPEC_H_ #include "wasm-ast.h" +#include "wasm-binary-writer.h" #include "wasm-common.h" struct WasmAllocator; -struct WasmWriteBinaryOptions; struct WasmWriter; #define WASM_WRITE_BINARY_SPEC_OPTIONS_DEFAULT \ - { NULL, NULL, NULL, NULL, NULL, NULL, NULL } + { NULL, WASM_WRITE_BINARY_OPTIONS_DEFAULT } typedef struct WasmWriteBinarySpecOptions { - /* callbacks for writing multiple modules */ - void (*on_script_begin)(void* user_data); - void (*on_module_begin)(uint32_t index, - void* user_data); - void (*on_command)(uint32_t index, - WasmCommandType type, - const WasmStringSlice* name, - const WasmLocation* loc, - void* user_data); - void (*on_module_before_write)(uint32_t index, - struct WasmWriter** out_writer, - void* user_data); - void (*on_module_end)(uint32_t index, WasmResult result, void* user_data); - void (*on_script_end)(void* user_data); - - void* user_data; + const char* json_filename; + WasmWriteBinaryOptions write_binary_options; } WasmWriteBinarySpecOptions; WASM_EXTERN_C_BEGIN -/* this function modifies the AST */ WasmResult wasm_write_binary_spec_script(struct WasmAllocator*, struct WasmScript*, - const struct WasmWriteBinaryOptions*, + const char* source_filename, const WasmWriteBinarySpecOptions*); WASM_EXTERN_C_END |