Skip to content

Commit 435eeea

Browse files
authored
Add the upstream spec testsuite as a submodule (#6853)
Run the upstream tests by default, except for a large list of them that do not successfully run. Remove the local version of those that do successfully run where the local version is entirely subsumed by the upstream version.
1 parent 340ad71 commit 435eeea

Some content is hidden

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

64 files changed

+141
-32159
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "third_party/googletest"]
22
path = third_party/googletest
33
url = https://github.com/google/googletest.git
4+
[submodule "test/spec/testsuite"]
5+
path = test/spec/testsuite
6+
url = https://github.com/WebAssembly/testsuite.git

scripts/test/shared.py

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def get_tests(test_dir, extensions=[], recursive=False):
386386
if options.spec_tests:
387387
options.spec_tests = [os.path.abspath(t) for t in options.spec_tests]
388388
else:
389-
options.spec_tests = get_tests(get_test_dir('spec'), ['.wast'])
389+
options.spec_tests = get_tests(get_test_dir('spec'), ['.wast'], recursive=True)
390390

391391
os.chdir(options.out_dir)
392392

@@ -411,12 +411,102 @@ def get_tests(test_dir, extensions=[], recursive=False):
411411
# Test invalid
412412
'elem.wast',
413413
]
414+
SPEC_TESTSUITE_TESTS_TO_SKIP = [
415+
'address.wast',
416+
'align.wast',
417+
'binary-leb128.wast',
418+
'binary.wast',
419+
'block.wast',
420+
'br_table.wast',
421+
'bulk.wast',
422+
'comments.wast',
423+
'const.wast',
424+
'conversions.wast',
425+
'data.wast',
426+
'elem.wast',
427+
'f32.wast',
428+
'f64.wast',
429+
'fac.wast',
430+
'float_exprs.wast',
431+
'float_misc.wast',
432+
'func.wast',
433+
'global.wast',
434+
'if.wast',
435+
'imports.wast',
436+
'linking.wast',
437+
'loop.wast',
438+
'memory.wast',
439+
'annotations.wast',
440+
'id.wast',
441+
'throw.wast',
442+
'try_catch.wast',
443+
'tag.wast',
444+
'throw_ref.wast',
445+
'try_table.wast',
446+
'br_on_non_null.wast',
447+
'br_on_null.wast',
448+
'local_init.wast',
449+
'ref_func.wast',
450+
'ref_is_null.wast',
451+
'ref_null.wast',
452+
'return_call_indirect.wast',
453+
'select.wast',
454+
'table.wast',
455+
'type-equivalence.wast',
456+
'unreached-invalid.wast',
457+
'array.wast',
458+
'array_init_elem.wast',
459+
'br_if.wast',
460+
'br_on_cast.wast',
461+
'br_on_cast_fail.wast',
462+
'extern.wast',
463+
'i31.wast',
464+
'ref_cast.wast',
465+
'ref_test.wast',
466+
'struct.wast',
467+
'type-rec.wast',
468+
'type-subtyping.wast',
469+
'call_indirect.wast',
470+
'memory64.wast',
471+
'table_fill.wast',
472+
'table_get.wast',
473+
'table_grow.wast',
474+
'table_init.wast',
475+
'table_set.wast',
476+
'imports0.wast',
477+
'imports2.wast',
478+
'imports3.wast',
479+
'linking0.wast',
480+
'linking3.wast',
481+
'i16x8_relaxed_q15mulr_s.wast',
482+
'i32x4_relaxed_trunc.wast',
483+
'i8x16_relaxed_swizzle.wast',
484+
'relaxed_dot_product.wast',
485+
'relaxed_laneselect.wast',
486+
'relaxed_madd_nmadd.wast',
487+
'relaxed_min_max.wast',
488+
'simd_address.wast',
489+
'simd_boolean.wast',
490+
'simd_const.wast',
491+
'simd_conversions.wast',
492+
'simd_f32x4.wast',
493+
'simd_f32x4_arith.wast',
494+
'simd_f32x4_rounding.wast',
495+
'simd_f64x2.wast',
496+
'simd_f64x2_arith.wast',
497+
'simd_f64x2_rounding.wast',
498+
'simd_i32x4_cmp.wast', # UBSan error on integer overflow
499+
'simd_i32x4_arith2.wast', # UBSan error on integer overflow
500+
'simd_i32x4_dot_i16x8.wast', # UBSan error on integer overflow
501+
'token.wast',
502+
]
414503
options.spec_tests = [t for t in options.spec_tests if os.path.basename(t) not
415-
in SPEC_TESTS_TO_SKIP]
416-
504+
in (SPEC_TESTSUITE_TESTS_TO_SKIP if 'testsuite' in t
505+
else SPEC_TESTS_TO_SKIP)]
417506

418507
# check utilities
419508

509+
420510
def binary_format_check(wast, verify_final_result=True, wasm_as_args=['-g'],
421511
binary_suffix='.fromBinary'):
422512
# checks we can convert the wast to binary and back

scripts/test/wasm2js.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
wasm2js_tests = shared.get_tests(shared.get_test_dir('wasm2js'), ['.wast'])
2828
assert_tests = ['wasm2js.wast.asserts']
2929
# These tests exercise functionality not supported by wasm2js
30-
wasm2js_blacklist = ['empty_imported_table.wast']
30+
wasm2js_skipped_tests = [
31+
'empty_imported_table.wast',
32+
'br.wast', # depends on multivalue
33+
]
3134

3235

3336
def check_for_stale_files():
@@ -52,7 +55,7 @@ def test_wasm2js_output():
5255
for opt in (0, 1):
5356
for t in basic_tests + spec_tests + wasm2js_tests:
5457
basename = os.path.basename(t)
55-
if basename in wasm2js_blacklist:
58+
if basename in wasm2js_skipped_tests:
5659
continue
5760

5861
asm = basename.replace('.wast', '.2asm.js')
@@ -158,7 +161,7 @@ def update_wasm2js_tests():
158161
if not wasm.endswith('.wast'):
159162
continue
160163

161-
if os.path.basename(wasm) in wasm2js_blacklist:
164+
if os.path.basename(wasm) in wasm2js_skipped_tests:
162165
continue
163166

164167
asm = os.path.basename(wasm).replace('.wast', '.2asm.js')

src/tools/wasm2js.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,9 @@ void AssertionEmitter::emit() {
809809
// Skip other action assertions.
810810
continue;
811811
}
812+
} else if (std::get_if<AssertModule>(assn)) {
813+
// Skip module assertions
814+
continue;
812815
} else {
813816
Fatal() << "unsupported assertion on line " << script[i].line;
814817
}

0 commit comments

Comments
 (0)