diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/test/generate_lld_tests.py | 3 | ||||
-rw-r--r-- | scripts/test/lld.py | 64 |
2 files changed, 35 insertions, 32 deletions
diff --git a/scripts/test/generate_lld_tests.py b/scripts/test/generate_lld_tests.py index 25a72f885..8338ffbd9 100755 --- a/scripts/test/generate_lld_tests.py +++ b/scripts/test/generate_lld_tests.py @@ -34,7 +34,7 @@ def generate_wat_files(llvm_bin, emscripten_root): print('\n[ building wat files from C sources... ]\n') lld_path = os.path.join(shared.options.binaryen_test, 'lld') - for src_file, ext in files_with_extensions(lld_path, ['.c', '.cpp']): + for src_file, ext in files_with_extensions(lld_path, ['.c', '.cpp', '.s']): print('..', src_file) obj_file = src_file.replace(ext, '.o') @@ -69,6 +69,7 @@ def generate_wat_files(llvm_bin, emscripten_root): '--export', '__wasm_call_ctors', '--export', '__data_end', '--global-base=568', + '--no-gc-sections', ] # We had a regression where this test only worked if debug names # were included. diff --git a/scripts/test/lld.py b/scripts/test/lld.py index 19528ebc6..1407ea4b7 100644 --- a/scripts/test/lld.py +++ b/scripts/test/lld.py @@ -30,41 +30,43 @@ def args_for_finalize(filename): return ret +def run_test(input_path): + print('..', input_path) + is_passive = '.passive.' in input_path + mem_file = input_path + '.mem' + extension_arg_map = { + '.out': [], + } + if not is_passive: + extension_arg_map.update({ + '.mem.out': ['--separate-data-segments', mem_file], + }) + for ext, args in extension_arg_map.items(): + expected_file = input_path + ext + if ext != '.out' and not os.path.exists(expected_file): + continue + + cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [input_path, '-S'] + args + cmd += args_for_finalize(os.path.basename(input_path)) + actual = support.run_command(cmd) + + if not os.path.exists(expected_file): + print(actual) + shared.fail_with_error('output ' + expected_file + + ' does not exist') + shared.fail_if_not_identical_to_file(actual, expected_file) + if ext == '.mem.out': + with open(mem_file) as mf: + mem = mf.read() + shared.fail_if_not_identical_to_file(mem, input_path + '.mem.mem') + os.remove(mem_file) + + def test_wasm_emscripten_finalize(): print('\n[ checking wasm-emscripten-finalize testcases... ]\n') for input_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat', '.wasm']): - print('..', input_path) - is_passive = '.passive.' in input_path - mem_file = input_path + '.mem' - extension_arg_map = { - '.out': [], - } - if not is_passive: - extension_arg_map.update({ - '.mem.out': ['--separate-data-segments', mem_file], - }) - for ext, ext_args in extension_arg_map.items(): - expected_file = input_path + ext - if ext != '.out' and not os.path.exists(expected_file): - continue - - cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [input_path, '-S'] + \ - ext_args - cmd += args_for_finalize(os.path.basename(input_path)) - actual = support.run_command(cmd) - - if not os.path.exists(expected_file): - print(actual) - shared.fail_with_error('output ' + expected_file + - ' does not exist') - shared.fail_if_not_identical_to_file(actual, expected_file) - if ext == '.mem.out': - with open(mem_file) as mf: - mem = mf.read() - shared.fail_if_not_identical_to_file(mem, input_path + - '.mem.mem') - os.remove(mem_file) + run_test(input_path) def update_lld_tests(): |