@@ -265,17 +265,24 @@ def run_tests_from_test_suite(
265265 meta = TestSuiteMeta (manifest .name , manifest .wasi_version ,
266266 runtime .get_meta ())
267267
268- for test_path in glob .glob (os .path .join (test_suite_path , "*.wasm" )):
269- test_name = os .path .splitext (os .path .basename (test_path ))[0 ]
268+ all_tests = [
269+ (test_path ,
270+ os .path .splitext (os .path .basename (test_path ))[0 ],
271+ _read_test_config (test_path ))
272+ for test_path in glob .glob (os .path .join (test_suite_path , "*.wasm" ))
273+ ]
274+
275+ for test_path , name , config in all_tests :
270276 for filt in filters :
271277 # for now, just drop the skip reason string. it might be
272278 # useful to make reporters report it.
273- skip , _ = filt .should_skip (meta , test_name )
279+ skip , _ = filt .should_skip (meta , name , config )
274280 if skip :
275- test_case = _skip_single_test (test_path )
281+ test_case = _skip_single_test (name , config )
276282 break
277283 else :
278- test_case = _execute_single_test (runtime , meta , test_path )
284+ test_case = _execute_single_test (
285+ runtime , meta , test_path , name , config )
279286 test_cases .append (test_case )
280287 for reporter in reporters :
281288 reporter .report_test (meta , test_case )
@@ -290,10 +297,9 @@ def run_tests_from_test_suite(
290297 )
291298
292299
293- def _skip_single_test (test_path : str ) -> TestCase :
294- config = _read_test_config (test_path )
300+ def _skip_single_test (name : str , config : Config ) -> TestCase :
295301 return TestCase (
296- name = os . path . splitext ( os . path . basename ( test_path ))[ 0 ] ,
302+ name = name ,
297303 argv = [],
298304 config = config ,
299305 result = Result (is_executed = False , failures = []),
@@ -320,16 +326,16 @@ def _cleanup_test_output(host_dir: Path) -> None:
320326
321327
322328def _execute_single_test (
323- runtime : RuntimeAdapter , meta : TestSuiteMeta , test_path : str
329+ runtime : RuntimeAdapter , meta : TestSuiteMeta , test_path : str ,
330+ name : str , config : Config
324331) -> TestCase :
325- config = _read_test_config (test_path )
326332 runner = TestCaseRunner (config , test_path , meta .wasi_version , runtime )
327333 test_start = time .time ()
328334 result = runner .run ()
329335 elapsed = time .time () - test_start
330336
331337 return TestCase (
332- name = os . path . splitext ( os . path . basename ( test_path ))[ 0 ] ,
338+ name = name ,
333339 argv = runner .last_argv (),
334340 config = config ,
335341 result = result ,
0 commit comments