summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xauto_update_tests.py28
-rw-r--r--scripts/test/shared.py7
2 files changed, 20 insertions, 15 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index fd5999cad..876c162e2 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -4,7 +4,8 @@ import os, sys, subprocess, difflib
from scripts.test.support import run_command, split_wast
from scripts.test.shared import (
- ASM2WASM, MOZJS, S2WASM, WASM_SHELL, WASM_OPT, WASM_AS, WASM_DIS, WASM_CTOR_EVAL)
+ ASM2WASM, MOZJS, S2WASM, WASM_SHELL, WASM_OPT, WASM_AS, WASM_DIS,
+ WASM_CTOR_EVAL, WASM_MERGE, BINARYEN_INSTALL_DIR)
print '[ processing and updating testcases... ]\n'
@@ -143,7 +144,8 @@ print '\n[ checking example testcases... ]\n'
for t in sorted(os.listdir(os.path.join('test', 'example'))):
output_file = os.path.join('bin', 'example')
- cmd = ['-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread', '-o', output_file]
+ libdir = os.path.join(BINARYEN_INSTALL_DIR, 'lib')
+ cmd = ['-Isrc', '-g', '-lasmjs', '-lsupport', '-L' + libdir, '-pthread', '-o', output_file]
if t.endswith('.txt'):
# check if there is a trace in the file, if so, we should build it
out = subprocess.Popen([os.path.join('scripts', 'clean_c_api_trace.py'), os.path.join('test', 'example', t)], stdout=subprocess.PIPE).communicate()[0]
@@ -157,17 +159,17 @@ for t in sorted(os.listdir(os.path.join('test', 'example'))):
else:
src = os.path.join('test', 'example', t)
expected = os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt')
- if src.endswith(('.c', '.cpp')):
- # build the C file separately
- extra = [os.environ.get('CC') or 'gcc',
- src, '-c', '-o', 'example.o',
- '-Isrc', '-g', '-Llib/.', '-pthread']
- print 'build: ', ' '.join(extra)
- subprocess.check_call(extra)
- # Link against the binaryen C library DSO, using an executable-relative rpath
- cmd = ['example.o', '-lbinaryen'] + cmd + ['-Wl,-rpath=$ORIGIN/../lib']
- else:
+ if not src.endswith(('.c', '.cpp')):
continue
+ # build the C file separately
+ extra = [os.environ.get('CC') or 'gcc',
+ src, '-c', '-o', 'example.o',
+ '-Isrc', '-g', '-L' + libdir, '-pthread']
+ print 'build: ', ' '.join(extra)
+ print os.getcwd()
+ subprocess.check_call(extra)
+ # Link against the binaryen C library DSO, using rpath
+ cmd = ['example.o', '-lbinaryen', '-Wl,-rpath=' + os.path.abspath(libdir)] + cmd
print ' ', t, src, expected
if os.environ.get('COMPILER_FLAGS'):
for f in os.environ.get('COMPILER_FLAGS').split(' '):
@@ -220,7 +222,7 @@ for t in os.listdir(os.path.join('test', 'merge')):
u = t + '.toMerge'
for finalize in [0, 1]:
for opt in [0, 1]:
- cmd = [os.path.join('bin', 'wasm-merge'), t, u, '-o', 'a.wast', '-S', '--verbose']
+ cmd = WASM_MERGE + [t, u, '-o', 'a.wast', '-S', '--verbose']
if finalize: cmd += ['--finalize-memory-base=1024', '--finalize-table-base=8']
if opt: cmd += ['-O']
stdout = run_command(cmd)
diff --git a/scripts/test/shared.py b/scripts/test/shared.py
index f94f22fe8..aa1f9ae3e 100644
--- a/scripts/test/shared.py
+++ b/scripts/test/shared.py
@@ -102,9 +102,11 @@ if not options.binaryen_bin:
else:
options.binaryen_bin = 'bin'
+options.binaryen_bin = os.path.normpath(options.binaryen_bin)
+
wasm_dis_filenames = ['wasm-dis', 'wasm-dis.exe']
-if all(map(lambda f: not os.path.isfile(os.path.join(options.binaryen_bin, f)),
- wasm_dis_filenames)):
+if not any(os.path.isfile(os.path.join(options.binaryen_bin, f))
+ for f in wasm_dis_filenames):
warn('Binaryen not found (or has not been successfully built to bin/ ?')
# Locate Binaryen source directory if not specified.
@@ -151,6 +153,7 @@ NODEJS = which('nodejs') or which('node')
MOZJS = which('mozjs')
EMCC = which('emcc')
+BINARYEN_INSTALL_DIR = os.path.dirname(options.binaryen_bin)
WASM_OPT = [os.path.join(options.binaryen_bin, 'wasm-opt')]
WASM_AS = [os.path.join(options.binaryen_bin, 'wasm-as')]
WASM_DIS = [os.path.join(options.binaryen_bin, 'wasm-dis')]