summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index 8dac39faf..5380fc737 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -2,12 +2,6 @@
import os, sys, subprocess, difflib
-# find our dynamic libraries
-if os.environ.get('LD_LIBRARY_PATH'):
- os.environ['LD_LIBRARY_PATH'] += os.pathsep + 'lib'
-else:
- os.environ['LD_LIBRARY_PATH'] = 'lib'
-
print '[ processing and updating testcases... ]\n'
for asm in sorted(os.listdir('test')):
@@ -102,7 +96,8 @@ for wast in sorted(os.listdir('test')):
print '\n[ checking example testcases... ]\n'
for t in sorted(os.listdir(os.path.join('test', 'example'))):
- cmd = ['-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread']
+ output_file = os.path.join('bin', 'example')
+ cmd = ['-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread', '-o', output_file]
if t.endswith('.cpp'):
cmd = [os.path.join('test', 'example', t),
os.path.join('src', 'pass.cpp'),
@@ -115,7 +110,8 @@ for t in sorted(os.listdir(os.path.join('test', 'example'))):
'-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread']
print ' '.join(extra)
subprocess.check_call(extra)
- cmd = ['example.o', '-lbinaryen-c'] + cmd
+ # Link against the binaryen C library DSO, using an executable-relative rpath
+ cmd = ['example.o', '-lbinaryen-c'] + cmd + ['-Wl,-rpath=$ORIGIN/../lib']
else:
continue
if os.environ.get('COMPILER_FLAGS'):
@@ -123,8 +119,12 @@ for t in sorted(os.listdir(os.path.join('test', 'example'))):
cmd.append(f)
cmd = [os.environ.get('CXX') or 'g++', '-std=c++11'] + cmd
print ' '.join(cmd)
- subprocess.check_call(cmd)
- actual = subprocess.Popen(['./a.out'], stdout=subprocess.PIPE).communicate()[0]
- open(os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt'), 'w').write(actual)
+ try:
+ subprocess.check_call(cmd)
+ actual = subprocess.Popen([output_file], stdout=subprocess.PIPE).communicate()[0]
+ open(os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt'), 'w').write(actual)
+ finally:
+ os.remove(output_file)
+
print '\n[ success! ]'