diff options
author | Nathan Froyd <froydnj@gmail.com> | 2018-02-14 15:30:10 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-02-14 12:30:10 -0800 |
commit | 4a592c7e03af7a692cfb5ba9cda0ce4ae723adde (patch) | |
tree | 578021ddc3494dee6d207fc381f01768fe524d24 /scripts/test/wasm2asm.py | |
parent | 55324135a5e105a2ad9ec5c3f74fe2a438a8bfba (diff) | |
download | binaryen-4a592c7e03af7a692cfb5ba9cda0ce4ae723adde.tar.gz binaryen-4a592c7e03af7a692cfb5ba9cda0ce4ae723adde.tar.bz2 binaryen-4a592c7e03af7a692cfb5ba9cda0ce4ae723adde.zip |
adjust test scripts to cope with out-of-tree builds (#1420)
Many places assume that test/blah is valid, but that's only valid if
you're executing scripts from the binaryen source directory. The
binaryen_test option is more general, and enables out-of-tree testing,
so that's what we should be using instead.
Diffstat (limited to 'scripts/test/wasm2asm.py')
-rwxr-xr-x | scripts/test/wasm2asm.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/scripts/test/wasm2asm.py b/scripts/test/wasm2asm.py index fe22e4f83..35c0d4b8c 100755 --- a/scripts/test/wasm2asm.py +++ b/scripts/test/wasm2asm.py @@ -3,15 +3,18 @@ import os from support import run_command -from shared import (WASM2ASM, MOZJS, NODEJS, fail_if_not_identical, tests) - +from shared import ( + WASM2ASM, MOZJS, NODEJS, fail_if_not_identical, options, tests +) # tests with i64s, invokes, etc. -spec_tests = [os.path.join('spec', t) - for t in sorted(os.listdir(os.path.join('test', 'spec'))) +spec_dir = os.path.join(options.binaryen_test, 'spec') +spec_tests = [os.path.join(spec_dir, t) + for t in sorted(os.listdir(spec_dir)) if '.fail' not in t] -extra_tests = [os.path.join('wasm2asm', t) for t in - sorted(os.listdir(os.path.join('test', 'wasm2asm')))] +wasm2asm_dir = os.path.join(options.binaryen_test, 'wasm2asm') +extra_tests = [os.path.join(wasm2asm_dir, t) for t in + sorted(os.listdir(wasm2asm_dir))] assert_tests = ['wasm2asm.wast.asserts'] @@ -21,14 +24,14 @@ def test_wasm2asm_output(): continue asm = os.path.basename(wasm).replace('.wast', '.2asm.js') - expected_file = os.path.join('test', asm) + expected_file = os.path.join(options.binaryen_test, asm) if not os.path.exists(expected_file): continue print '..', wasm - cmd = WASM2ASM + [os.path.join('test', wasm)] + cmd = WASM2ASM + [os.path.join(options.binaryen_test, wasm)] out = run_command(cmd) expected = open(expected_file).read() fail_if_not_identical(out, expected) @@ -68,10 +71,11 @@ def test_asserts_output(): asserts = os.path.basename(wasm).replace('.wast.asserts', '.asserts.js') traps = os.path.basename(wasm).replace('.wast.asserts', '.traps.js') - asserts_expected_file = os.path.join('test', asserts) - traps_expected_file = os.path.join('test', traps) + asserts_expected_file = os.path.join(options.binaryen_test, asserts) + traps_expected_file = os.path.join(options.binaryen_test, traps) - cmd = WASM2ASM + [os.path.join('test', wasm), '--allow-asserts'] + wasm = os.path.join(options.binaryen_test, wasm) + cmd = WASM2ASM + [wasm, '--allow-asserts'] out = run_command(cmd) expected = open(asserts_expected_file).read() fail_if_not_identical(out, expected) |