diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-10-02 10:59:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-02 10:59:28 -0700 |
commit | 2ec15bea0c5b7d4112e06fadcc3a531f303d4a4c (patch) | |
tree | e1d52311bf0b91b8d618750cedcba674e7e1bbef /check.py | |
parent | ee9d515581998165c0e573d2b5a468c5b361cfcd (diff) | |
download | binaryen-2ec15bea0c5b7d4112e06fadcc3a531f303d4a4c.tar.gz binaryen-2ec15bea0c5b7d4112e06fadcc3a531f303d4a4c.tar.bz2 binaryen-2ec15bea0c5b7d4112e06fadcc3a531f303d4a4c.zip |
Thread fixes (#1205)
* don't use multiple threads in torture tests, which are parallel anyhow
* if we fail to create a thread, don't use multiple threads
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 57 |
1 files changed, 34 insertions, 23 deletions
@@ -471,31 +471,42 @@ def run_validator_tests(): def run_torture_tests(): print '\n[ checking torture testcases... ]\n' - unexpected_result_count = 0 + # torture tests are parallel anyhow, don't create multiple threads in each child + old_cores = os.environ.get('BINARYEN_CORES') + try: + os.environ['BINARYEN_CORES'] = '1' + + unexpected_result_count = 0 + + import test.waterfall.src.link_assembly_files as link_assembly_files + s2wasm_torture_out = os.path.abspath(os.path.join(options.binaryen_test, 's2wasm-torture-out')) + if os.path.isdir(s2wasm_torture_out): + shutil.rmtree(s2wasm_torture_out) + os.mkdir(s2wasm_torture_out) + unexpected_result_count += link_assembly_files.run( + linker=os.path.abspath(S2WASM_EXE), + files=os.path.abspath(os.path.join(options.binaryen_test, 'torture-s', '*.s')), + fails=os.path.abspath(os.path.join(options.binaryen_test, 's2wasm_known_gcc_test_failures.txt')), + out=s2wasm_torture_out) + assert os.path.isdir(s2wasm_torture_out), 'Expected output directory %s' % s2wasm_torture_out + + import test.waterfall.src.execute_files as execute_files + unexpected_result_count += execute_files.run( + runner=os.path.abspath(WASM_SHELL_EXE), + files=os.path.abspath(os.path.join(s2wasm_torture_out, '*.wast')), + fails=os.path.abspath(os.path.join(options.binaryen_test, 's2wasm_known_binaryen_shell_test_failures.txt')), + out='', + wasmjs='') - import test.waterfall.src.link_assembly_files as link_assembly_files - s2wasm_torture_out = os.path.abspath(os.path.join(options.binaryen_test, 's2wasm-torture-out')) - if os.path.isdir(s2wasm_torture_out): shutil.rmtree(s2wasm_torture_out) - os.mkdir(s2wasm_torture_out) - unexpected_result_count += link_assembly_files.run( - linker=os.path.abspath(S2WASM_EXE), - files=os.path.abspath(os.path.join(options.binaryen_test, 'torture-s', '*.s')), - fails=os.path.abspath(os.path.join(options.binaryen_test, 's2wasm_known_gcc_test_failures.txt')), - out=s2wasm_torture_out) - assert os.path.isdir(s2wasm_torture_out), 'Expected output directory %s' % s2wasm_torture_out - - import test.waterfall.src.execute_files as execute_files - unexpected_result_count += execute_files.run( - runner=os.path.abspath(WASM_SHELL_EXE), - files=os.path.abspath(os.path.join(s2wasm_torture_out, '*.wast')), - fails=os.path.abspath(os.path.join(options.binaryen_test, 's2wasm_known_binaryen_shell_test_failures.txt')), - out='', - wasmjs='') - - shutil.rmtree(s2wasm_torture_out) - if unexpected_result_count: - fail('%s failures' % unexpected_result_count, '0 failures') + if unexpected_result_count: + fail('%s failures' % unexpected_result_count, '0 failures') + + finally: + if old_cores: + os.environ['BINARYEN_CORES'] = old_cores + else: + del os.environ['BINARYEN_CORES'] def run_vanilla_tests(): print '\n[ checking emcc WASM_BACKEND testcases...]\n' |