Skip to content

Commit 0024c8b

Browse files
authored
[test] Port tests in test/ to test/lit/basic/ (#6160)
This ports all tests from `test/` to `test/lit/basic/`. The set of commands and `CHECK` lines used are the same as the ones in #6159. Now we use `lit` to test these, this also deletes all `.wast`, `.wast.from-wast`, `.wast.fromBinary`, and `.wast.fromBinary.noDebugInfo` files from `test/` and all related test routines from the python scripts. All `CHECK` lines are generated by `update_lit_checks.py --all-items`. This also deletes these three multi-memory tests in `test/lit/`, because they seem to contain the same code with the ones in `test/`, which have been ported to `test/lit/basic/` along with other tests. - `test/lit/multi-memories-atomics64.wast` - `test/lit/multi-memories-basics.wast` - `test/lit/multi-memories-simd.wast` This also adds newlines between `(func`s in case there are none to make `CHECK` lines easy to view, and removes some extra existing newlines here and there.
1 parent 9e63685 commit 0024c8b

File tree

219 files changed

+23387
-24231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+23387
-24231
lines changed

check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def run_wasm_reduce_tests():
166166
if 'fsanitize=thread' not in str(os.environ):
167167
print('\n[ checking wasm-reduce fuzz testcase ]\n')
168168
# TODO: re-enable multivalue once it is better optimized
169-
support.run_command(shared.WASM_OPT + [os.path.join(shared.options.binaryen_test, 'signext.wast'), '-ttf', '-Os', '-o', 'a.wasm', '--detect-features', '--disable-multivalue'])
169+
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'])
170170
before = os.stat('a.wasm').st_size
171171
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'])
172172
after = os.stat('c.wasm').st_size

scripts/test/wasm2js.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from . import shared
1919
from . import support
2020

21-
tests = shared.get_tests(shared.options.binaryen_test)
21+
basic_tests = shared.get_tests(os.path.join(shared.options.binaryen_test, 'lit', 'basic'))
2222
# memory64 is not supported in wasm2js yet (but may be with BigInt eventually).
23-
tests = [t for t in tests if '64.wast' not in t]
23+
basic_tests = [t for t in basic_tests if '64.wast' not in t]
2424
spec_tests = shared.options.spec_tests
2525
spec_tests = [t for t in spec_tests if '.fail' not in t]
2626
spec_tests = [t for t in spec_tests if '64.wast' not in t]
@@ -36,7 +36,7 @@ def check_for_stale_files():
3636

3737
# TODO(sbc): Generalize and apply other test suites
3838
all_tests = []
39-
for t in tests + spec_tests + wasm2js_tests:
39+
for t in basic_tests + spec_tests + wasm2js_tests:
4040
all_tests.append(os.path.basename(os.path.splitext(t)[0]))
4141

4242
all_files = os.listdir(shared.get_test_dir('wasm2js'))
@@ -50,7 +50,7 @@ def check_for_stale_files():
5050

5151
def test_wasm2js_output():
5252
for opt in (0, 1):
53-
for t in tests + spec_tests + wasm2js_tests:
53+
for t in basic_tests + spec_tests + wasm2js_tests:
5454
basename = os.path.basename(t)
5555
if basename in wasm2js_blacklist:
5656
continue
@@ -154,7 +154,7 @@ def update_wasm2js_tests():
154154
print('\n[ checking wasm2js ]\n')
155155

156156
for opt in (0, 1):
157-
for wasm in tests + spec_tests + wasm2js_tests:
157+
for wasm in basic_tests + spec_tests + wasm2js_tests:
158158
if not wasm.endswith('.wast'):
159159
continue
160160

scripts/test/wasm_opt.py

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -104,35 +104,15 @@ def check():
104104
actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
105105
shared.fail_if_not_identical(actual.strip(), open(os.path.join(shared.get_test_dir('print'), wasm + '.minified.txt')).read().strip())
106106

107-
print('\n[ checking wasm-opt testcases... ]\n')
108-
109-
for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
110-
print('..', os.path.basename(t))
111-
f = t + '.from-wast'
112-
cmd = shared.WASM_OPT + [t, '--print', '-all']
113-
actual = support.run_command(cmd)
114-
actual = actual.replace('printing before:\n', '')
115-
116-
shared.fail_if_not_identical_to_file(actual, f)
117-
118-
# FIXME Remove this condition after nullref is implemented in V8
119-
if 'reference-types.wast' not in t:
120-
shared.binary_format_check(t, wasm_as_args=['-g']) # test with debuginfo
121-
shared.binary_format_check(t, wasm_as_args=[], binary_suffix='.fromBinary.noDebugInfo') # test without debuginfo
122-
123-
shared.minify_check(t)
124-
125-
print('\n[ checking wasm-opt debugInfo read-write... ]\n')
126-
127107

128108
def update_wasm_opt_tests():
129-
print('\n[ checking wasm-opt -o notation... ]\n')
109+
print('\n[ updating wasm-opt -o notation... ]\n')
130110
wast = os.path.join(shared.options.binaryen_test, 'hello_world.wat')
131111
cmd = shared.WASM_OPT + [wast, '-o', 'a.wast', '-S']
132112
support.run_command(cmd)
133113
open(wast, 'w').write(open('a.wast').read())
134114

135-
print('\n[ checking wasm-opt parsing & printing... ]\n')
115+
print('\n[ updating wasm-opt parsing & printing... ]\n')
136116
for t in shared.get_tests(shared.get_test_dir('print'), ['.wast']):
137117
print('..', os.path.basename(t))
138118
wasm = t.replace('.wast', '')
@@ -148,7 +128,7 @@ def update_wasm_opt_tests():
148128
with open(wasm + '.minified.txt', 'wb') as o:
149129
o.write(actual)
150130

151-
print('\n[ checking wasm-opt passes... ]\n')
131+
print('\n[ updating wasm-opt passes... ]\n')
152132
for t in shared.get_tests(shared.get_test_dir('passes'), ['.wast', '.wasm']):
153133
print('..', os.path.basename(t))
154134
# windows has some failures that need to be investigated:
@@ -183,38 +163,3 @@ def update_wasm_opt_tests():
183163
with open('a.wat') as i:
184164
with open(t + '.wat', 'w') as o:
185165
o.write(i.read())
186-
187-
print('\n[ checking wasm-opt testcases... ]\n')
188-
for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
189-
print('..', os.path.basename(t))
190-
f = t + '.from-wast'
191-
cmd = shared.WASM_OPT + [t, '--print', '-all']
192-
actual = support.run_command(cmd)
193-
actual = actual.replace('printing before:\n', '')
194-
open(f, 'w').write(actual)
195-
196-
print('\n[ checking binary format testcases... ]\n')
197-
for wast in shared.get_tests(shared.options.binaryen_test, ['.wast']):
198-
for debug_info in [0, 1]:
199-
cmd = shared.WASM_AS + [wast, '-o', 'a.wasm', '-all']
200-
if debug_info:
201-
cmd += ['-g']
202-
print(' '.join(cmd))
203-
if os.path.exists('a.wasm'):
204-
os.unlink('a.wasm')
205-
subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
206-
assert os.path.exists('a.wasm')
207-
208-
cmd = shared.WASM_DIS + ['a.wasm', '-o', 'a.wast', '-all']
209-
print(' '.join(cmd))
210-
if os.path.exists('a.wast'):
211-
os.unlink('a.wast')
212-
subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
213-
assert os.path.exists('a.wast')
214-
actual = open('a.wast').read()
215-
binary_file = wast + '.fromBinary'
216-
if not debug_info:
217-
binary_file += '.noDebugInfo'
218-
with open(binary_file, 'w') as o:
219-
print('writey', binary_file)
220-
o.write(actual)

test/atomics-unshared.wast

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/atomics-unshared.wast.from-wast

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/atomics-unshared.wast.fromBinary

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/atomics-unshared.wast.fromBinary.noDebugInfo

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/atomics.wast

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)