summaryrefslogtreecommitdiff
path: root/scripts/test/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-09-01 12:34:03 -0700
committerGitHub <noreply@github.com>2017-09-01 12:34:03 -0700
commit6de14693110b4f898344ff1cb383caf0d74eb42e (patch)
tree6fbcb75fd3c2285191939a086989e14656908282 /scripts/test/shared.py
parentb013f744e3d70effd9be348cbde7fb93f0a16c6a (diff)
downloadbinaryen-6de14693110b4f898344ff1cb383caf0d74eb42e.tar.gz
binaryen-6de14693110b4f898344ff1cb383caf0d74eb42e.tar.bz2
binaryen-6de14693110b4f898344ff1cb383caf0d74eb42e.zip
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.
Diffstat (limited to 'scripts/test/shared.py')
-rw-r--r--scripts/test/shared.py17
1 files changed, 13 insertions, 4 deletions
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: