diff options
author | Abbas Mashayekh <martianboy2005@gmail.com> | 2021-02-08 21:30:31 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 10:00:31 -0800 |
commit | 3be78fdd2f8e673457d93f3c7bfb341f8074d298 (patch) | |
tree | 0bced15b8e84f7d6fe0a361ddf59383c61099b61 | |
parent | 51c8f2469f8fd05197b7694c65041b1567f2c6b5 (diff) | |
download | binaryen-3be78fdd2f8e673457d93f3c7bfb341f8074d298.tar.gz binaryen-3be78fdd2f8e673457d93f3c7bfb341f8074d298.tar.bz2 binaryen-3be78fdd2f8e673457d93f3c7bfb341f8074d298.zip |
Add feature options to wasm-dis (#3548)
This will allow .fromBinary tests be executed with the desired featurs
so there will be no difference between those tests and .from-wast tests.
Fixes #3545
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | scripts/test/shared.py | 2 | ||||
-rw-r--r-- | scripts/test/wasm_opt.py | 2 | ||||
-rw-r--r-- | src/tools/wasm-dis.cpp | 11 |
4 files changed, 11 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b35ff9b9f..50d018937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ full changeset diff at the end of each section. Current Trunk ------------- +- `wasm-dis` now supports options to enable or disable Wasm features. + v99 --- diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 670d41d30..b46a21175 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -466,7 +466,7 @@ def binary_format_check(wast, verify_final_result=True, wasm_as_args=['-g'], subprocess.check_call(cmd, stdout=subprocess.PIPE) assert os.path.exists('a.wasm') - cmd = WASM_DIS + ['a.wasm', '-o', 'ab.wast'] + cmd = WASM_DIS + ['a.wasm', '-o', 'ab.wast', '-all'] print(' ', ' '.join(cmd)) if os.path.exists('ab.wast'): os.unlink('ab.wast') diff --git a/scripts/test/wasm_opt.py b/scripts/test/wasm_opt.py index 588c79ab9..189a9978c 100644 --- a/scripts/test/wasm_opt.py +++ b/scripts/test/wasm_opt.py @@ -226,7 +226,7 @@ def update_wasm_opt_tests(): subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) assert os.path.exists('a.wasm') - cmd = shared.WASM_DIS + ['a.wasm', '-o', 'a.wast'] + cmd = shared.WASM_DIS + ['a.wasm', '-o', 'a.wast', '-all'] print(' '.join(cmd)) if os.path.exists('a.wast'): os.unlink('a.wast') diff --git a/src/tools/wasm-dis.cpp b/src/tools/wasm-dis.cpp index 8220e96cd..6c8edffaf 100644 --- a/src/tools/wasm-dis.cpp +++ b/src/tools/wasm-dis.cpp @@ -19,18 +19,19 @@ // #include "support/colors.h" -#include "support/command-line.h" #include "support/file.h" #include "wasm-io.h" +#include "tool-options.h" + using namespace cashew; using namespace wasm; int main(int argc, const char* argv[]) { std::string sourceMapFilename; - Options options("wasm-dis", - "Un-assemble a .wasm (WebAssembly binary format) into a " - ".wat (WebAssembly text format)"); + ToolOptions options("wasm-dis", + "Un-assemble a .wasm (WebAssembly binary format) into a " + ".wat (WebAssembly text format)"); options .add("--output", "-o", @@ -71,6 +72,8 @@ int main(int argc, const char* argv[]) { Fatal() << "error in parsing wasm source mapping"; } + options.applyFeatures(wasm); + if (options.debug) { std::cerr << "Printing..." << std::endl; } |