summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-03-05 13:04:55 -0800
committerGitHub <noreply@github.com>2018-03-05 13:04:55 -0800
commit1997b28e98604a8e8a26fde44cec1ae9782e67bb (patch)
tree0016f53ceabbabd2559480ea116877928f79f4ba
parentac93e8bebf97aec9407e094f56c3fd523399f59e (diff)
downloadbinaryen-1997b28e98604a8e8a26fde44cec1ae9782e67bb.tar.gz
binaryen-1997b28e98604a8e8a26fde44cec1ae9782e67bb.tar.bz2
binaryen-1997b28e98604a8e8a26fde44cec1ae9782e67bb.zip
Allow small names in test/passes (#1450)
* allow tests in test/passes/ to have a numeric name, in which case there is a name.passes file with the names instead of the name containing the passes (which might be long, see #1020)
-rwxr-xr-xauto_update_tests.py2
-rwxr-xr-xcheck.py7
-rw-r--r--test/passes/1.passes1
-rw-r--r--test/passes/1.txt (renamed from test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.txt)0
-rw-r--r--test/passes/1.wast (renamed from test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.wast)0
5 files changed, 8 insertions, 2 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index 6f87234f9..ab85c2efb 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -110,6 +110,8 @@ for t in sorted(os.listdir(os.path.join('test', 'passes'))):
print '..', t
binary = '.wasm' in t
passname = os.path.basename(t).replace('.wast', '').replace('.wasm', '')
+ if passname.isdigit():
+ passname = open(os.path.join('test', 'passes', passname + '.passes')).read().strip()
opts = [('--' + p if not p.startswith('O') else '-' + p) for p in passname.split('_')]
t = os.path.join('test', 'passes', t)
actual = ''
diff --git a/check.py b/check.py
index bc3300693..2fbcfd598 100755
--- a/check.py
+++ b/check.py
@@ -82,7 +82,10 @@ def run_wasm_opt_tests():
if t.endswith(('.wast', '.wasm')):
print '..', t
binary = '.wasm' in t
- passname = os.path.basename(t).replace('.wast', '').replace('.wasm', '')
+ base = os.path.basename(t).replace('.wast', '').replace('.wasm', '')
+ passname = base
+ if passname.isdigit():
+ passname = open(os.path.join(options.binaryen_test, 'passes', passname + '.passes')).read().strip()
opts = [('--' + p if not p.startswith('O') else '-' + p) for p in passname.split('_')]
t = os.path.join(options.binaryen_test, 'passes', t)
actual = ''
@@ -108,7 +111,7 @@ def run_wasm_opt_tests():
if 'BINARYEN_PASS_DEBUG' in os.environ:
del os.environ['BINARYEN_PASS_DEBUG']
- fail_if_not_identical(actual, open(os.path.join(options.binaryen_test, 'passes', passname + ('.bin' if binary else '') + '.txt'), 'rb').read())
+ fail_if_not_identical(actual, open(os.path.join(options.binaryen_test, 'passes', base + ('.bin' if binary else '') + '.txt'), 'rb').read())
if 'emit-js-wrapper' in t:
with open('a.js') as actual:
diff --git a/test/passes/1.passes b/test/passes/1.passes
new file mode 100644
index 000000000..275436f40
--- /dev/null
+++ b/test/passes/1.passes
@@ -0,0 +1 @@
+rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum
diff --git a/test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.txt b/test/passes/1.txt
index f46805f2e..f46805f2e 100644
--- a/test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.txt
+++ b/test/passes/1.txt
diff --git a/test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.wast b/test/passes/1.wast
index 38c74ff56..38c74ff56 100644
--- a/test/passes/rereloop_dce_remove-unused-brs_remove-unused-names_coalesce-locals_simplify-locals_reorder-locals_remove-unused-brs_merge-blocks_vacuum.wast
+++ b/test/passes/1.wast