From 6de14693110b4f898344ff1cb383caf0d74eb42e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 1 Sep 2017 12:34:03 -0700 Subject: wasm-reduce tool (#1139) Reduce an interesting wasm to a smaller still interesting wasm. This takes an arbitrary command to run, and reduces the wasm as much as it can while keeping the behavior of that command fixed. This can be used to reduce compiler bugs in an arbitrary VM, etc. --- scripts/test/shared.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts/test/shared.py') diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 4f72b4c0e..2ff0be355 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -163,6 +163,7 @@ WASM_CTOR_EVAL = [os.path.join(options.binaryen_bin, 'wasm-ctor-eval')] WASM_SHELL = [os.path.join(options.binaryen_bin, 'wasm-shell')] WASM_MERGE = [os.path.join(options.binaryen_bin, 'wasm-merge')] S2WASM = [os.path.join(options.binaryen_bin, 's2wasm')] +WASM_REDUCE = [os.path.join(options.binaryen_bin, 'wasm-reduce')] S2WASM_EXE = S2WASM[0] WASM_SHELL_EXE = WASM_SHELL[0] @@ -188,12 +189,20 @@ if options.valgrind: os.environ['BINARYEN'] = os.getcwd() +def get_platform(): + return {'linux2': 'linux', + 'darwin': 'mac', + 'win32': 'windows', + 'cygwin': 'windows'}[sys.platform] + + +def has_shell_timeout(): + return get_platform() != 'windows' and os.system('timeout 1s pwd') == 0 + + def fetch_waterfall(): rev = open(os.path.join(options.binaryen_test, 'revision')).read().strip() - buildername = {'linux2': 'linux', - 'darwin': 'mac', - 'win32': 'windows', - 'cygwin': 'windows'}[sys.platform] + buildername = get_platform() local_rev_path = os.path.join(WATERFALL_BUILD_DIR, 'local-revision') if os.path.exists(local_rev_path): with open(local_rev_path) as f: -- cgit v1.2.3