Skip to content

[test] Port tests in test/ to test/lit/basic/ #6160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion check.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def run_wasm_reduce_tests():
if 'fsanitize=thread' not in str(os.environ):
print('\n[ checking wasm-reduce fuzz testcase ]\n')
# TODO: re-enable multivalue once it is better optimized
support.run_command(shared.WASM_OPT + [os.path.join(shared.options.binaryen_test, 'signext.wast'), '-ttf', '-Os', '-o', 'a.wasm', '--detect-features', '--disable-multivalue'])
support.run_command(shared.WASM_OPT + [os.path.join(shared.options.binaryen_test, 'lit/basic/signext.wast'), '-ttf', '-Os', '-o', 'a.wasm', '--detect-features', '--disable-multivalue'])
before = os.stat('a.wasm').st_size
support.run_command(shared.WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec --detect-features' % shared.WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm'])
after = os.stat('c.wasm').st_size
Expand Down
10 changes: 5 additions & 5 deletions scripts/test/wasm2js.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
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]
Expand All @@ -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'))
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
61 changes: 3 additions & 58 deletions scripts/test/wasm_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,35 +104,15 @@ def check():
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')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should've been removed in #6162



def update_wasm_opt_tests():
print('\n[ checking wasm-opt -o notation... ]\n')
print('\n[ updating wasm-opt -o notation... ]\n')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix: checking->updating in update_wasm_opt_tests messages

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', '')
Expand All @@ -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:
Expand Down Expand Up @@ -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)
10 changes: 0 additions & 10 deletions test/atomics-unshared.wast

This file was deleted.

13 changes: 0 additions & 13 deletions test/atomics-unshared.wast.from-wast

This file was deleted.

14 changes: 0 additions & 14 deletions test/atomics-unshared.wast.fromBinary

This file was deleted.

14 changes: 0 additions & 14 deletions test/atomics-unshared.wast.fromBinary.noDebugInfo

This file was deleted.

184 changes: 0 additions & 184 deletions test/atomics.wast

This file was deleted.

Loading