Skip to content

Commit 2a972a9

Browse files
authored
Allow test/passes tests to have arbitrary names, with a side file that contains the passes (#2532)
We already supported this, but required that the filename be a number. This lets the name be anything, and we check if *.passes exists for it.
1 parent c1526e7 commit 2a972a9

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

auto_update_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ def update_wasm_opt_tests():
100100
binary = t.endswith('.wasm')
101101
base = os.path.basename(t).replace('.wast', '').replace('.wasm', '')
102102
passname = base
103-
if passname.isdigit():
104-
passname = open(os.path.join(shared.options.binaryen_test, 'passes', passname + '.passes')).read().strip()
103+
passes_file = os.path.join(shared.get_test_dir('passes'), passname + '.passes')
104+
if os.path.exists(passes_file):
105+
passname = open(passes_file).read().strip()
105106
opts = [('--' + p if not p.startswith('O') else '-' + p) for p in passname.split('_')]
106107
actual = ''
107108
for module, asserts in support.split_wast(t):

check.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ def run_wasm_opt_tests():
9696
binary = '.wasm' in t
9797
base = os.path.basename(t).replace('.wast', '').replace('.wasm', '')
9898
passname = base
99-
if passname.isdigit():
100-
passname = open(os.path.join(shared.get_test_dir('passes'), passname + '.passes')).read().strip()
99+
passes_file = os.path.join(shared.get_test_dir('passes'), passname + '.passes')
100+
if os.path.exists(passes_file):
101+
passname = open(passes_file).read().strip()
101102
opts = [('--' + p if not p.startswith('O') else '-' + p) for p in passname.split('_')]
102103
actual = ''
103104
for module, asserts in support.split_wast(t):
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)