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'): print '..', wast_path mem_file = wast_path + '.mem' extension_arg_map = { '.out': [], '.mem.out': ['--separate-data-segments', mem_file], } for ext, ext_args in extension_arg_map.items(): expected_file = wast_path + ext if ext != '.out' and not os.path.exists(expected_file): continue cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args cmd += args_for_finalize(os.path.basename(wast_path)) actual = run_command(cmd) if not os.path.exists(expected_file): print actual fail_with_error('output ' + expected_file + ' does not exist') fail_if_not_identical_to_file(actual, expected_file) if ext == '.mem.out': with open(mem_file) as mf: mem = mf.read() fail_if_not_identical_to_file(mem, wast_path + '.mem.mem') os.remove(mem_file)
def test_wasm_emscripten_finalize(): print '\n[ checking wasm-emscripten-finalize testcases... ]\n' extension_arg_map = { '.out': [], '.jscall.out': ['--emscripten-reserved-function-pointers=3'], } for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): print '..', wast_path for ext, ext_args in extension_arg_map.items(): expected_file = wast_path + ext if ext != '.out' and not os.path.exists(expected_file): continue cmd = (WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S', '--global-base=568'] + ext_args) actual = run_command(cmd) if not os.path.exists(expected_file): print actual fail_with_error('output ' + expected_file + ' does not exist') expected = open(expected_file, 'rb').read() if actual != expected: fail(actual, expected)
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'): print '..', wast_path mem_file = wast_path + '.mem' extension_arg_map = { '.out': [], '.mem.out': ['--separate-data-segments', mem_file], } for ext, ext_args in extension_arg_map.items(): expected_file = wast_path + ext if ext != '.out' and not os.path.exists(expected_file): continue cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args cmd += args_for_finalize(os.path.basename(wast_path)) actual = run_command(cmd) if not os.path.exists(expected_file): print actual fail_with_error('output ' + expected_file + ' does not exist') fail_if_not_identical_to_file(actual, expected_file) if ext == '.mem.out': with open(mem_file) as mf: mem = mf.read() fail_if_not_identical_to_file(mem, wast_path + '.mem.mem') os.remove(mem_file)
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'): print '..', wast_path expected_file = wast_path + '.out' cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] actual = run_command(cmd) if not os.path.exists(expected_file): print actual fail_with_error('output ' + expected_file + ' does not exist') expected = open(expected_file, 'rb').read() if actual != expected: fail(actual, expected)
def test_wasm_link_metadata(): print '\n[ checking wasm-link-metadata testcases... ]\n' for obj_path in files_with_pattern(options.binaryen_test, 'lld', '*.o'): print '..', obj_path expected_file = obj_path.replace('.o', '.json') cmd = WASM_LINK_METADATA + [obj_path] actual = run_command(cmd) if not os.path.exists(expected_file): print actual fail_with_error('output ' + expected_file + ' does not exist') expected = open(expected_file, 'rb').read() if actual != expected: fail(actual, expected)
def update_lld_tests(): print '\n[ updatring wasm-emscripten-finalize testcases... ]\n' for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): print '..', wast_path mem_file = wast_path + '.mem' extension_arg_map = { '.out': [], '.mem.out': ['--separate-data-segments', mem_file + '.mem'], } for ext, ext_args in extension_arg_map.items(): out_path = wast_path + ext if ext != '.out' and not os.path.exists(out_path): continue cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args cmd += args_for_finalize(os.path.basename(wast_path)) actual = run_command(cmd) with open(out_path, 'w') as o: o.write(actual)
def update_lld_tests(): print '\n[ updatring wasm-emscripten-finalize testcases... ]\n' for wast_path in files_with_pattern(options.binaryen_test, 'lld', '*.wast'): print '..', wast_path mem_file = wast_path + '.mem' extension_arg_map = { '.out': [], '.mem.out': ['--separate-data-segments', mem_file + '.mem'], } for ext, ext_args in extension_arg_map.items(): out_path = wast_path + ext if ext != '.out' and not os.path.exists(out_path): continue cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args cmd += args_for_finalize(os.path.basename(wast_path)) actual = run_command(cmd) with open(out_path, 'w') as o: o.write(actual)