|
76 | 76 |
|
77 | 77 | print '\n[ checking wasm-link-metadata testcases... ]\n' |
78 | 78 |
|
| 79 | +link_metadata_extension_arg_map = { |
| 80 | + '.json': [], |
| 81 | + '.jscall.json': ['--emscripten-reserved-function-pointers=3'], |
| 82 | +} |
79 | 83 | for obj_path in files_with_pattern('test', 'lld', '*.o'): |
80 | 84 | print '..', obj_path |
81 | | - json_path = obj_path.replace('.o', '.json') |
82 | | - |
83 | | - cmd = WASM_LINK_METADATA + [obj_path] |
84 | | - actual = run_command(cmd) |
85 | | - with open(json_path, 'w') as o: o.write(actual) |
| 85 | + for ext, ext_args in link_metadata_extension_arg_map.items(): |
| 86 | + json_path = obj_path.replace('.o', ext) |
| 87 | + if ext != 'json' and not os.path.exists(json_path): |
| 88 | + continue |
| 89 | + cmd = WASM_LINK_METADATA + [obj_path] + ext_args |
| 90 | + actual = run_command(cmd) |
| 91 | + with open(json_path, 'w') as o: o.write(actual) |
86 | 92 |
|
87 | 93 | print '\n[ checking wasm-emscripten-finalize testcases... ]\n' |
88 | 94 |
|
| 95 | +emscripten_finalize_extension_arg_map = { |
| 96 | + '.out': [], |
| 97 | + '.jscall.out': ['--emscripten-reserved-function-pointers=3'], |
| 98 | +} |
89 | 99 | for wast_path in files_with_pattern('test', 'lld', '*.wast'): |
90 | 100 | print '..', wast_path |
91 | | - out_path = wast_path + '.out' |
92 | | - cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] |
93 | | - actual = run_command(cmd) |
94 | | - with open(out_path, 'w') as o: o.write(actual) |
| 101 | + for ext, ext_args in emscripten_finalize_extension_arg_map.items(): |
| 102 | + out_path = wast_path + ext |
| 103 | + if ext != '.out' and not os.path.exists(out_path): |
| 104 | + continue |
| 105 | + cmd = WASM_EMSCRIPTEN_FINALIZE + [wast_path, '-S'] + ext_args |
| 106 | + actual = run_command(cmd) |
| 107 | + with open(out_path, 'w') as o: o.write(actual) |
95 | 108 |
|
96 | 109 | for t in sorted(os.listdir(os.path.join('test', 'print'))): |
97 | 110 | if t.endswith('.wast'): |
|
0 commit comments