Skip to content

Commit a8dd169

Browse files
Use relative paths for spec tests to skip
1 parent b141e31 commit a8dd169

File tree

1 file changed

+93
-83
lines changed

1 file changed

+93
-83
lines changed

scripts/test/shared.py

Lines changed: 93 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ def get_tests(test_dir, extensions=[], recursive=False):
385385

386386

387387
if options.spec_tests:
388-
options.spec_tests = [os.path.abspath(t) for t in options.spec_tests]
388+
non_existent_tests = [test_name for test_name in options.spec_tests if not os.path.isfile(test_name)]
389+
if non_existent_tests:
390+
raise ValueError(f"Supplied test files do not exist: {non_existent_tests}")
391+
options.spec_tests = options.spec_tests
389392
else:
390393
options.spec_tests = get_tests(get_test_dir('spec'), ['.wast'], recursive=True)
391394

@@ -399,106 +402,113 @@ def get_tests(test_dir, extensions=[], recursive=False):
399402
# corresponding 'old_[FILENAME].wast' file. When you fix the new file and
400403
# delete the old file, make sure you rename the corresponding .wast.log file in
401404
# expected-output/ if any.
405+
# Paths are relative to the test/ directory
402406
SPEC_TESTS_TO_SKIP = [
403407
# Requires us to write our own floating point parser
404-
'const.wast',
408+
'spec/const.wast',
405409

406410
# Unlinkable module accepted
407-
'linking.wast',
411+
'spec/linking.wast',
408412

409413
# Invalid module accepted
410-
'unreached-invalid.wast',
414+
'spec/unreached-invalid.wast',
411415

412416
# Test invalid
413-
'elem.wast',
417+
'spec/elem.wast',
414418
]
415419
SPEC_TESTSUITE_PROPOSALS_TO_SKIP = [
416420
'custom-page-sizes',
417421
'wide-arithmetic',
418422
]
423+
424+
# Paths are relative to the test/ directory
419425
SPEC_TESTSUITE_TESTS_TO_SKIP = [
420-
'address.wast', # 64-bit offset allowed by memory64
421-
'array_new_elem.wast', # Failure to parse element segment item abbreviation
422-
'binary.wast', # Missing data count section validation
423-
'call_indirect64.wast', # Failure to parse element segment abbreviation
424-
'comments.wast', # Issue with carriage returns being treated as newlines
425-
'const.wast', # Hex float constant not recognized as out of range
426-
'conversions.wast', # Promoted NaN should be canonical
427-
'data.wast', # Fail to parse data segment offset abbreviation
428-
'elem.wast', # Requires modeling empty declarative segments
429-
'f32.wast', # Adding -0 and -nan should give a canonical NaN
430-
'f64.wast', # Adding -0 and -nan should give a canonical NaN
431-
'float_exprs.wast', # Adding 0 and NaN should give canonical NaN
432-
'float_misc.wast', # Rounding wrong on f64.sqrt
433-
'func.wast', # Duplicate parameter names not properly rejected
434-
'global.wast', # Fail to parse table
435-
'if.wast', # Requires more precise unreachable validation
436-
'imports.wast', # Missing validation of missing function on instantiation
437-
'linking.wast', # Missing function type validation on instantiation
438-
'memory.wast', # Requires wast `module definition` support
439-
'memory64-imports.wast', # Missing validation on instantiation
440-
'annotations.wast', # String annotations IDs should be allowed
441-
'id.wast', # Empty IDs should be disallowed
442-
'instance.wast', # Requires wast `module definition` support
443-
'table64.wast', # Requires wast `module definition` support
444-
'table_grow.wast', # Incorrect table linking semantics in interpreter
445-
'tag.wast', # Non-empty tag results allowed by stack switching
446-
'try_table.wast', # Requires try_table interpretation
447-
'local_init.wast', # Requires local validation to respect unnamed blocks
448-
'ref_func.wast', # Requires rejecting undeclared functions references
449-
'ref_is_null.wast', # Requires ref.null wast constants
450-
'ref_null.wast', # Requires ref.null wast constants
451-
'return_call_indirect.wast', # Requires more precise unreachable validation
452-
'select.wast', # Requires ref.null wast constants
453-
'table.wast', # Requires support for table default elements
454-
'unreached-invalid.wast', # Requires more precise unreachable validation
455-
'array.wast', # Requires support for table default elements
456-
'br_if.wast', # Requires more precise branch validation
457-
'br_on_cast.wast', # Requires host references to not be externalized i31refs
458-
'br_on_cast_fail.wast', # Requires host references to not be externalized i31refs
459-
'extern.wast', # Requires ref.host wast constants
460-
'i31.wast', # Requires support for table default elements
461-
'ref_cast.wast', # Requires host references to not be externalized i31refs
462-
'ref_test.wast', # Requires host references to not be externalized i31refs
463-
'struct.wast', # Duplicate field names not properly rejected
464-
'type-rec.wast', # Missing function type validation on instantiation
465-
'type-subtyping.wast', # ShellExternalInterface::callTable does not handle subtyping
466-
'call_indirect.wast', # Bug with 64-bit inline element segment parsing
467-
'memory64.wast', # Requires wast `module definition` support
468-
'imports0.wast', # Missing memory type validation on instantiation
469-
'imports2.wast', # Missing memory type validation on instantiation
470-
'imports3.wast', # Missing memory type validation on instantiation
471-
'linking0.wast', # Missing memory type validation on instantiation
472-
'linking3.wast', # Fatal error on missing table.
473-
'i16x8_relaxed_q15mulr_s.wast', # Requires wast `either` support
474-
'i32x4_relaxed_trunc.wast', # Requires wast `either` support
475-
'i8x16_relaxed_swizzle.wast', # Requires wast `either` support
476-
'relaxed_dot_product.wast', # Requires wast `either` support
477-
'relaxed_laneselect.wast', # Requires wast `either` support
478-
'relaxed_madd_nmadd.wast', # Requires wast `either` support
479-
'relaxed_min_max.wast', # Requires wast `either` support
480-
'simd_const.wast', # Hex float constant not recognized as out of range
481-
'simd_conversions.wast', # Promoted NaN should be canonical
482-
'simd_f32x4.wast', # Min of 0 and NaN should give a canonical NaN
483-
'simd_f32x4_arith.wast', # Adding inf and -inf should give a canonical NaN
484-
'simd_f32x4_rounding.wast', # Ceil of NaN should give a canonical NaN
485-
'simd_f64x2.wast', # Min of 0 and NaN should give a canonical NaN
486-
'simd_f64x2_arith.wast', # Adding inf and -inf should give a canonical NaN
487-
'simd_f64x2_rounding.wast', # Ceil of NaN should give a canonical NaN
488-
'simd_i32x4_cmp.wast', # UBSan error on integer overflow
489-
'simd_i32x4_arith2.wast', # UBSan error on integer overflow
490-
'simd_i32x4_dot_i16x8.wast', # UBSan error on integer overflow
491-
'token.wast', # Lexer should require spaces between strings and non-paren tokens
426+
'spec/testsuite/address.wast', # 64-bit offset allowed by memory64
427+
'spec/testsuite/array_new_elem.wast', # Failure to parse element segment item abbreviation
428+
'spec/testsuite/binary.wast', # Missing data count section validation
429+
'spec/testsuite/call_indirect64.wast', # Failure to parse element segment abbreviation
430+
'spec/testsuite/comments.wast', # Issue with carriage returns being treated as newlines
431+
'spec/testsuite/const.wast', # Hex float constant not recognized as out of range
432+
'spec/testsuite/conversions.wast', # Promoted NaN should be canonical
433+
'spec/testsuite/data.wast', # Fail to parse data segment offset abbreviation
434+
'spec/testsuite/elem.wast', # Requires modeling empty declarative segments
435+
'spec/testsuite/f32.wast', # Adding -0 and -nan should give a canonical NaN
436+
'spec/testsuite/f64.wast', # Adding -0 and -nan should give a canonical NaN
437+
'spec/testsuite/float_exprs.wast', # Adding 0 and NaN should give canonical NaN
438+
'spec/testsuite/float_misc.wast', # Rounding wrong on f64.sqrt
439+
'spec/testsuite/func.wast', # Duplicate parameter names not properly rejected
440+
'spec/testsuite/global.wast', # Fail to parse table
441+
'spec/testsuite/if.wast', # Requires more precise unreachable validation
442+
'spec/testsuite/imports.wast', # Missing validation of missing function on instantiation
443+
'proposals/threads/imports.wast', # Missing memory type validation on instantiation
444+
'spec/testsuite/linking.wast', # Missing function type validation on instantiation
445+
'spec/testsuite/memory.wast', # Requires wast `module definition` support
446+
'spec/testsuite/proposals/threads/memory.wast', # Missing memory type validation on instantiation
447+
'spec/testsuite/memory64-imports.wast', # Missing validation on instantiation
448+
'spec/testsuite/annotations.wast', # String annotations IDs should be allowed
449+
'spec/testsuite/id.wast', # Empty IDs should be disallowed
450+
'spec/testsuite/instance.wast', # Requires wast `module definition` support
451+
'spec/testsuite/table64.wast', # Requires wast `module definition` support
452+
'spec/testsuite/table_grow.wast', # Incorrect table linking semantics in interpreter
453+
'spec/testsuite/tag.wast', # Non-empty tag results allowed by stack switching
454+
'spec/testsuite/try_table.wast', # Requires try_table interpretation
455+
'spec/testsuite/local_init.wast', # Requires local validation to respect unnamed blocks
456+
'spec/testsuite/ref_func.wast', # Requires rejecting undeclared functions references
457+
'spec/testsuite/ref_is_null.wast', # Requires ref.null wast constants
458+
'spec/testsuite/ref_null.wast', # Requires ref.null wast constants
459+
'spec/testsuite/return_call_indirect.wast', # Requires more precise unreachable validation
460+
'spec/testsuite/select.wast', # Requires ref.null wast constants
461+
'spec/testsuite/table.wast', # Requires support for table default elements
462+
'spec/testsuite/unreached-invalid.wast', # Requires more precise unreachable validation
463+
'spec/testsuite/array.wast', # Requires support for table default elements
464+
'spec/testsuite/br_if.wast', # Requires more precise branch validation
465+
'spec/testsuite/br_on_cast.wast', # Requires host references to not be externalized i31refs
466+
'spec/testsuite/br_on_cast_fail.wast', # Requires host references to not be externalized i31refs
467+
'spec/testsuite/extern.wast', # Requires ref.host wast constants
468+
'spec/testsuite/i31.wast', # Requires support for table default elements
469+
'spec/testsuite/ref_cast.wast', # Requires host references to not be externalized i31refs
470+
'spec/testsuite/ref_test.wast', # Requires host references to not be externalized i31refs
471+
'spec/testsuite/struct.wast', # Duplicate field names not properly rejected
472+
'spec/testsuite/type-rec.wast', # Missing function type validation on instantiation
473+
'spec/testsuite/type-subtyping.wast', # ShellExternalInterface::callTable does not handle subtyping
474+
'spec/testsuite/call_indirect.wast', # Bug with 64-bit inline element segment parsing
475+
'spec/testsuite/memory64.wast', # Requires wast `module definition` support
476+
'spec/testsuite/imports0.wast', # Missing memory type validation on instantiation
477+
'spec/testsuite/imports2.wast', # Missing memory type validation on instantiation
478+
'spec/testsuite/imports3.wast', # Missing memory type validation on instantiation
479+
'spec/testsuite/linking0.wast', # Missing memory type validation on instantiation
480+
'spec/testsuite/linking3.wast', # Fatal error on missing table.
481+
'spec/testsuite/i16x8_relaxed_q15mulr_s.wast', # Requires wast `either` support
482+
'spec/testsuite/i32x4_relaxed_trunc.wast', # Requires wast `either` support
483+
'spec/testsuite/i8x16_relaxed_swizzle.wast', # Requires wast `either` support
484+
'spec/testsuite/relaxed_dot_product.wast', # Requires wast `either` support
485+
'spec/testsuite/relaxed_laneselect.wast', # Requires wast `either` support
486+
'spec/testsuite/relaxed_madd_nmadd.wast', # Requires wast `either` support
487+
'spec/testsuite/relaxed_min_max.wast', # Requires wast `either` support
488+
'spec/testsuite/simd_const.wast', # Hex float constant not recognized as out of range
489+
'spec/testsuite/simd_conversions.wast', # Promoted NaN should be canonical
490+
'spec/testsuite/simd_f32x4.wast', # Min of 0 and NaN should give a canonical NaN
491+
'spec/testsuite/simd_f32x4_arith.wast', # Adding inf and -inf should give a canonical NaN
492+
'spec/testsuite/simd_f32x4_rounding.wast', # Ceil of NaN should give a canonical NaN
493+
'spec/testsuite/simd_f64x2.wast', # Min of 0 and NaN should give a canonical NaN
494+
'spec/testsuite/simd_f64x2_arith.wast', # Adding inf and -inf should give a canonical NaN
495+
'spec/testsuite/simd_f64x2_rounding.wast', # Ceil of NaN should give a canonical NaN
496+
'spec/testsuite/simd_i32x4_cmp.wast', # UBSan error on integer overflow
497+
'spec/testsuite/simd_i32x4_arith2.wast', # UBSan error on integer overflow
498+
'spec/testsuite/simd_i32x4_dot_i16x8.wast', # UBSan error on integer overflow
499+
'spec/testsuite/token.wast', # Lexer should require spaces between strings and non-paren tokens
492500
]
493501

494502

495503
def _can_run_spec_test(test):
496-
if 'testsuite' in test:
497-
for proposal in SPEC_TESTSUITE_PROPOSALS_TO_SKIP:
498-
if proposal in test:
499-
return False
500-
return os.path.basename(test) not in SPEC_TESTSUITE_TESTS_TO_SKIP
501-
return os.path.basename(test) not in SPEC_TESTS_TO_SKIP
504+
path_relative_to_test_dir = test.removeprefix("test/")
505+
if 'testsuite' not in test:
506+
return path_relative_to_test_dir not in SPEC_TESTS_TO_SKIP
507+
508+
if any(proposal in test for proposal in SPEC_TESTSUITE_PROPOSALS_TO_SKIP):
509+
return False
510+
511+
return path_relative_to_test_dir not in SPEC_TESTSUITE_TESTS_TO_SKIP
502512

503513

504514
options.spec_tests = [t for t in options.spec_tests if _can_run_spec_test(t)]

0 commit comments

Comments
 (0)