From 21888c253f775047bcfac28e8110abdcad9d6bcb Mon Sep 17 00:00:00 2001 From: Heejin Ahn <aheejin@gmail.com> Date: Wed, 20 Nov 2019 16:37:09 -0800 Subject: Simplify test scripts (NFC) (#2457) This makes test scripts simpler by reducing loop depths and extracting repeating code into methods or variables. - `get_tests` returns a list of tests with specified extensions. This includes files with a full path rather than just file names. - Reduces loop depths by using early exits and `get_tests`. --- scripts/test/lld.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/test/lld.py') diff --git a/scripts/test/lld.py b/scripts/test/lld.py index 7372698cd..41db2baa2 100755 --- a/scripts/test/lld.py +++ b/scripts/test/lld.py @@ -16,7 +16,7 @@ import os from .support import run_command from .shared import ( - fail_with_error, files_with_pattern, options, + fail_with_error, get_test_dir, get_tests, WASM_EMSCRIPTEN_FINALIZE, fail_if_not_identical_to_file ) @@ -35,7 +35,7 @@ def args_for_finalize(filename): def test_wasm_emscripten_finalize(): print('\n[ checking wasm-emscripten-finalize testcases... ]\n') - for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): + for wast_path in get_tests(get_test_dir('lld'), ['.wast']): print('..', wast_path) is_passive = '.passive.' in wast_path mem_file = wast_path + '.mem' @@ -69,7 +69,7 @@ def test_wasm_emscripten_finalize(): def update_lld_tests(): print('\n[ updatring wasm-emscripten-finalize testcases... ]\n') - for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): + for wast_path in get_tests(get_test_dir('lld'), ['.wast']): print('..', wast_path) is_passive = '.passive.' in wast_path mem_file = wast_path + '.mem' -- cgit v1.2.3