Skip to content

Commit d98e3c4

Browse files
authored
[test] Use test-specific filename when running spec tests (#7384)
These means that the intermediate files don't conflict with each other and you can inspect them by name after the test run.
1 parent adfdb1b commit d98e3c4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

check.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,25 +225,24 @@ def check_expected(actual, expected):
225225

226226
# check binary format. here we can verify execution of the final
227227
# result, no need for an output verification
228-
split_num = 0
229228
actual = ''
230-
with open('spec.wast', 'w') as transformed_spec_file:
231-
for module, asserts in support.split_wast(wast):
229+
with open(base, 'w') as transformed_spec_file:
230+
for i, (module, asserts) in enumerate(support.split_wast(wast)):
232231
if not module:
233232
# Skip any initial assertions that don't have a module
234233
continue
235-
print(' testing split module', split_num)
236-
split_num += 1
237-
support.write_wast('split.wast', module)
238-
run_opt_test('split.wast') # also that our optimizer doesn't break on it
239-
result_wast_file = shared.binary_format_check('split.wast', verify_final_result=False)
234+
print(f' testing split module {i}')
235+
split_name = os.path.splitext(base)[0] + f'_split{i}.wast'
236+
support.write_wast(split_name, module)
237+
run_opt_test(split_name) # also that our optimizer doesn't break on it
238+
result_wast_file = shared.binary_format_check(split_name, verify_final_result=False)
240239
with open(result_wast_file) as f:
241240
result_wast = f.read()
242241
# add the asserts, and verify that the test still passes
243242
transformed_spec_file.write(result_wast + '\n' + '\n'.join(asserts))
244243

245244
# compare all the outputs to the expected output
246-
actual = run_spec_test('spec.wast')
245+
actual = run_spec_test(base)
247246
check_expected(actual, os.path.join(shared.get_test_dir('spec'), 'expected-output', base + '.log'))
248247

249248

0 commit comments

Comments
 (0)