Skip to content

Commit 132d81e

Browse files
authored
Auto-update spec test outputs (#2481)
This makes auto_update_tests.py update spec test outputs (ones that are printed with `spectest.print` import) and extracts spec tests blacklist into shared.py with comments for reasons why each of them fails. Also deletes if-label-scope.fail.wast.log because it does not seem to match with any of existing tests.
1 parent d15fe87 commit 132d81e

4 files changed

Lines changed: 32 additions & 18 deletions

File tree

auto_update_tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,20 @@ def update_reduce_tests():
310310
support.run_command(shared.WASM_DIS + ['c.wasm', '-o', expected])
311311

312312

313+
def update_spec_tests():
314+
print('\n[ updating wasm-shell spec testcases... ]\n')
315+
316+
for t in shared.options.spec_tests:
317+
print('..', os.path.basename(t))
318+
319+
cmd = shared.WASM_SHELL + [t]
320+
expected = os.path.join(shared.get_test_dir('spec'), 'expected-output', os.path.basename(t) + '.log')
321+
if os.path.isfile(expected):
322+
stdout = support.run_command(cmd, stderr=subprocess.PIPE)
323+
with open(expected, 'w') as o:
324+
o.write(stdout)
325+
326+
313327
TEST_SUITES = OrderedDict([
314328
('wasm-opt', update_wasm_opt_tests),
315329
('asm2wasm', update_asm_js_tests),
@@ -318,6 +332,7 @@ def update_reduce_tests():
318332
('ctor-eval', update_ctor_eval_tests),
319333
('wasm-metadce', update_metadce_tests),
320334
('wasm-reduce', update_reduce_tests),
335+
('spec', update_spec_tests),
321336
('binaryenjs', update_binaryen_js_tests),
322337
('lld', lld.update_lld_tests),
323338
('wasm2js', wasm2js.update_wasm2js_tests),

check.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,11 @@ def run_wasm_reduce_tests():
278278
def run_spec_tests():
279279
print('\n[ checking wasm-shell spec testcases... ]\n')
280280

281-
if not shared.options.spec_tests:
282-
# FIXME we support old and new memory formats, for now, until 0xc, and so can't pass this old-style test.
283-
BLACKLIST = ['binary.wast']
284-
# FIXME to update the spec to 0xd, we need to implement (register "name") for import.wast
285-
spec_tests = shared.get_tests(shared.get_test_dir('spec'), ['.wast'])
286-
spec_tests = [t for t in spec_tests if os.path.basename(t) not in BLACKLIST]
287-
else:
288-
spec_tests = shared.options.spec_tests[:]
289-
290-
for wast in spec_tests:
281+
for wast in shared.options.spec_tests:
291282
print('..', os.path.basename(wast))
292283

293-
# skip checks for some tests
294-
if os.path.basename(wast) in ['linking.wast', 'nop.wast', 'stack.wast', 'typecheck.wast', 'unwind.wast']: # FIXME
295-
continue
296-
297284
def run_spec_test(wast):
298285
cmd = shared.WASM_SHELL + [wast]
299-
# we must skip the stack machine portions of spec tests or apply other extra args
300-
extra = {}
301-
cmd = cmd + (extra.get(os.path.basename(wast)) or [])
302286
return support.run_command(cmd, stderr=subprocess.PIPE)
303287

304288
def run_opt_test(wast):

scripts/test/shared.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,22 @@ def get_tests(test_dir, extensions=[]):
397397
warn('no functional emcc submodule found')
398398

399399

400+
if not options.spec_tests:
401+
options.spec_tests = get_tests(get_test_dir('spec'), ['.wast'])
402+
else:
403+
options.spec_tests = options.spec_tests[:]
404+
405+
SPEC_TEST_BLACKLIST = [
406+
'binary.wast', # Cannot parse binary modules
407+
'linking.wast', # No support for 'register' command
408+
'nop.wast', # Stacky code
409+
'stack.wast', # Stacky code
410+
'unwind.wast' # Stacky code
411+
]
412+
options.spec_tests = [t for t in options.spec_tests if os.path.basename(t) not
413+
in SPEC_TEST_BLACKLIST]
414+
415+
400416
# check utilities
401417

402418

test/spec/expected-output/if-label-scope.fail.wast.log

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)