@@ -471,31 +471,42 @@ def run_validator_tests():
471471def run_torture_tests ():
472472 print '\n [ checking torture testcases... ]\n '
473473
474- unexpected_result_count = 0
474+ # torture tests are parallel anyhow, don't create multiple threads in each child
475+ old_cores = os .environ .get ('BINARYEN_CORES' )
476+ try :
477+ os .environ ['BINARYEN_CORES' ] = '1'
478+
479+ unexpected_result_count = 0
480+
481+ import test .waterfall .src .link_assembly_files as link_assembly_files
482+ s2wasm_torture_out = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm-torture-out' ))
483+ if os .path .isdir (s2wasm_torture_out ):
484+ shutil .rmtree (s2wasm_torture_out )
485+ os .mkdir (s2wasm_torture_out )
486+ unexpected_result_count += link_assembly_files .run (
487+ linker = os .path .abspath (S2WASM_EXE ),
488+ files = os .path .abspath (os .path .join (options .binaryen_test , 'torture-s' , '*.s' )),
489+ fails = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm_known_gcc_test_failures.txt' )),
490+ out = s2wasm_torture_out )
491+ assert os .path .isdir (s2wasm_torture_out ), 'Expected output directory %s' % s2wasm_torture_out
492+
493+ import test .waterfall .src .execute_files as execute_files
494+ unexpected_result_count += execute_files .run (
495+ runner = os .path .abspath (WASM_SHELL_EXE ),
496+ files = os .path .abspath (os .path .join (s2wasm_torture_out , '*.wast' )),
497+ fails = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm_known_binaryen_shell_test_failures.txt' )),
498+ out = '' ,
499+ wasmjs = '' )
475500
476- import test .waterfall .src .link_assembly_files as link_assembly_files
477- s2wasm_torture_out = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm-torture-out' ))
478- if os .path .isdir (s2wasm_torture_out ):
479501 shutil .rmtree (s2wasm_torture_out )
480- os .mkdir (s2wasm_torture_out )
481- unexpected_result_count += link_assembly_files .run (
482- linker = os .path .abspath (S2WASM_EXE ),
483- files = os .path .abspath (os .path .join (options .binaryen_test , 'torture-s' , '*.s' )),
484- fails = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm_known_gcc_test_failures.txt' )),
485- out = s2wasm_torture_out )
486- assert os .path .isdir (s2wasm_torture_out ), 'Expected output directory %s' % s2wasm_torture_out
487-
488- import test .waterfall .src .execute_files as execute_files
489- unexpected_result_count += execute_files .run (
490- runner = os .path .abspath (WASM_SHELL_EXE ),
491- files = os .path .abspath (os .path .join (s2wasm_torture_out , '*.wast' )),
492- fails = os .path .abspath (os .path .join (options .binaryen_test , 's2wasm_known_binaryen_shell_test_failures.txt' )),
493- out = '' ,
494- wasmjs = '' )
495-
496- shutil .rmtree (s2wasm_torture_out )
497- if unexpected_result_count :
498- fail ('%s failures' % unexpected_result_count , '0 failures' )
502+ if unexpected_result_count :
503+ fail ('%s failures' % unexpected_result_count , '0 failures' )
504+
505+ finally :
506+ if old_cores :
507+ os .environ ['BINARYEN_CORES' ] = old_cores
508+ else :
509+ del os .environ ['BINARYEN_CORES' ]
499510
500511def run_vanilla_tests ():
501512 print '\n [ checking emcc WASM_BACKEND testcases...]\n '
0 commit comments