diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/test/spectest.js | 14 | ||||
-rw-r--r-- | scripts/test/wasm2js.py | 25 |
2 files changed, 23 insertions, 16 deletions
diff --git a/scripts/test/spectest.js b/scripts/test/spectest.js index 3c4bac1b5..ede13479e 100644 --- a/scripts/test/spectest.js +++ b/scripts/test/spectest.js @@ -2,19 +2,19 @@ export function print() { console.log(); } export function print_i32(arg) { - console.log(arg, ' : i32'); + console.log(arg, ': i32'); } export function print_f32(arg) { - console.log(arg, ' : f32'); + console.log(arg, ': f32'); } export function print_f64(arg) { - console.log(arg, ' : f64'); + console.log(arg, ': f64'); } export function print_i32_f32(arg0, arg1) { - console.log(arg0, ' : i32'); - console.log(arg1, ' : f32'); + console.log(arg0, ': i32'); + console.log(arg1, ': f32'); } export function print_f64_f64(arg0, arg1) { - console.log(arg0, ' : f64'); - console.log(arg1, ' : f64'); + console.log(arg0, ': f64'); + console.log(arg1, ': f64'); } diff --git a/scripts/test/wasm2js.py b/scripts/test/wasm2js.py index fec0d26db..97320445b 100644 --- a/scripts/test/wasm2js.py +++ b/scripts/test/wasm2js.py @@ -43,7 +43,8 @@ def test_wasm2js_output(): print('..', os.path.basename(t)) - all_out = [] + all_js = [] + all_out = '' for module, asserts in support.split_wast(t): support.write_wast('split.wast', module, asserts) @@ -58,21 +59,21 @@ def test_wasm2js_output(): cmd += ['--emscripten'] if 'deterministic' in t: cmd += ['--deterministic'] - out = support.run_command(cmd) - all_out.append(out) + js = support.run_command(cmd) + all_js.append(js) if not shared.NODEJS and not shared.MOZJS: print('No JS interpreters. Skipping spec tests.') continue - open('a.2asm.mjs', 'w').write(out) + open('a.2asm.mjs', 'w').write(js) cmd += ['--allow-asserts'] - out = support.run_command(cmd) + js = support.run_command(cmd) # also verify it passes pass-debug verifications shared.with_pass_debug(lambda: support.run_command(cmd)) - open('a.2asm.asserts.mjs', 'w').write(out) + open('a.2asm.asserts.mjs', 'w').write(js) # verify asm.js is valid js, note that we're using --experimental-modules # to enable ESM syntax and we're also passing a custom loader to handle the @@ -87,9 +88,15 @@ def test_wasm2js_output(): cmd = node[:] cmd.append('a.2asm.asserts.mjs') out = support.run_command(cmd, expected_err='', err_ignore='ExperimentalWarning') - shared.fail_if_not_identical(out, '') - - shared.fail_if_not_identical_to_file(''.join(all_out), expected_file) + all_out += out + + shared.fail_if_not_identical_to_file(''.join(all_js), expected_file) + expected_out = os.path.join(shared.get_test_dir('spec'), 'expected-output', os.path.basename(t) + '.log') + if os.path.exists(expected_out): + expected_out = open(expected_out).read() + else: + expected_out = '' + shared.fail_if_not_identical(all_out, expected_out) def test_asserts_output(): |