summaryrefslogtreecommitdiff
path: root/scripts/test
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test')
-rw-r--r--scripts/test/wasm2js.py10
-rw-r--r--scripts/test/wasm_opt.py61
2 files changed, 8 insertions, 63 deletions
diff --git a/scripts/test/wasm2js.py b/scripts/test/wasm2js.py
index cbae2216a..ec2c98124 100644
--- a/scripts/test/wasm2js.py
+++ b/scripts/test/wasm2js.py
@@ -18,9 +18,9 @@ import subprocess
from . import shared
from . import support
-tests = shared.get_tests(shared.options.binaryen_test)
+basic_tests = shared.get_tests(os.path.join(shared.options.binaryen_test, 'lit', 'basic'))
# memory64 is not supported in wasm2js yet (but may be with BigInt eventually).
-tests = [t for t in tests if '64.wast' not in t]
+basic_tests = [t for t in basic_tests if '64.wast' not in t]
spec_tests = shared.options.spec_tests
spec_tests = [t for t in spec_tests if '.fail' not in t]
spec_tests = [t for t in spec_tests if '64.wast' not in t]
@@ -36,7 +36,7 @@ def check_for_stale_files():
# TODO(sbc): Generalize and apply other test suites
all_tests = []
- for t in tests + spec_tests + wasm2js_tests:
+ for t in basic_tests + spec_tests + wasm2js_tests:
all_tests.append(os.path.basename(os.path.splitext(t)[0]))
all_files = os.listdir(shared.get_test_dir('wasm2js'))
@@ -50,7 +50,7 @@ def check_for_stale_files():
def test_wasm2js_output():
for opt in (0, 1):
- for t in tests + spec_tests + wasm2js_tests:
+ for t in basic_tests + spec_tests + wasm2js_tests:
basename = os.path.basename(t)
if basename in wasm2js_blacklist:
continue
@@ -154,7 +154,7 @@ def update_wasm2js_tests():
print('\n[ checking wasm2js ]\n')
for opt in (0, 1):
- for wasm in tests + spec_tests + wasm2js_tests:
+ for wasm in basic_tests + spec_tests + wasm2js_tests:
if not wasm.endswith('.wast'):
continue
diff --git a/scripts/test/wasm_opt.py b/scripts/test/wasm_opt.py
index 9695eadca..ee95029d6 100644
--- a/scripts/test/wasm_opt.py
+++ b/scripts/test/wasm_opt.py
@@ -104,35 +104,15 @@ def test_wasm_opt():
actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
shared.fail_if_not_identical(actual.strip(), open(os.path.join(shared.get_test_dir('print'), wasm + '.minified.txt')).read().strip())
- print('\n[ checking wasm-opt testcases... ]\n')
-
- for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
- print('..', os.path.basename(t))
- f = t + '.from-wast'
- cmd = shared.WASM_OPT + [t, '--print', '-all']
- actual = support.run_command(cmd)
- actual = actual.replace('printing before:\n', '')
-
- shared.fail_if_not_identical_to_file(actual, f)
-
- # FIXME Remove this condition after nullref is implemented in V8
- if 'reference-types.wast' not in t:
- shared.binary_format_check(t, wasm_as_args=['-g']) # test with debuginfo
- shared.binary_format_check(t, wasm_as_args=[], binary_suffix='.fromBinary.noDebugInfo') # test without debuginfo
-
- shared.minify_check(t)
-
- print('\n[ checking wasm-opt debugInfo read-write... ]\n')
-
def update_wasm_opt_tests():
- print('\n[ checking wasm-opt -o notation... ]\n')
+ print('\n[ updating wasm-opt -o notation... ]\n')
wast = os.path.join(shared.options.binaryen_test, 'hello_world.wat')
cmd = shared.WASM_OPT + [wast, '-o', 'a.wast', '-S']
support.run_command(cmd)
open(wast, 'w').write(open('a.wast').read())
- print('\n[ checking wasm-opt parsing & printing... ]\n')
+ print('\n[ updating wasm-opt parsing & printing... ]\n')
for t in shared.get_tests(shared.get_test_dir('print'), ['.wast']):
print('..', os.path.basename(t))
wasm = t.replace('.wast', '')
@@ -148,7 +128,7 @@ def update_wasm_opt_tests():
with open(wasm + '.minified.txt', 'wb') as o:
o.write(actual)
- print('\n[ checking wasm-opt passes... ]\n')
+ print('\n[ updating wasm-opt passes... ]\n')
for t in shared.get_tests(shared.get_test_dir('passes'), ['.wast', '.wasm']):
print('..', os.path.basename(t))
# windows has some failures that need to be investigated:
@@ -183,38 +163,3 @@ def update_wasm_opt_tests():
with open('a.wat') as i:
with open(t + '.wat', 'w') as o:
o.write(i.read())
-
- print('\n[ checking wasm-opt testcases... ]\n')
- for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
- print('..', os.path.basename(t))
- f = t + '.from-wast'
- cmd = shared.WASM_OPT + [t, '--print', '-all']
- actual = support.run_command(cmd)
- actual = actual.replace('printing before:\n', '')
- open(f, 'w').write(actual)
-
- print('\n[ checking binary format testcases... ]\n')
- for wast in shared.get_tests(shared.options.binaryen_test, ['.wast']):
- for debug_info in [0, 1]:
- cmd = shared.WASM_AS + [wast, '-o', 'a.wasm', '-all']
- if debug_info:
- cmd += ['-g']
- print(' '.join(cmd))
- if os.path.exists('a.wasm'):
- os.unlink('a.wasm')
- 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', '-all']
- print(' '.join(cmd))
- if os.path.exists('a.wast'):
- os.unlink('a.wast')
- subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- assert os.path.exists('a.wast')
- actual = open('a.wast').read()
- binary_file = wast + '.fromBinary'
- if not debug_info:
- binary_file += '.noDebugInfo'
- with open(binary_file, 'w') as o:
- print('writey', binary_file)
- o.write(actual)