summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-05-06 15:19:55 -0700
committerDerek Schuff <dschuff@chromium.org>2016-05-06 15:19:55 -0700
commita3b3a516bd8117cd83aa0625839e614110d1fc0b (patch)
tree077d3bbbdf337e91de884c19ec3564440e616470 /check.py
parent5f2b05fd3d03e353e5f461a6d334e2c8e2eadd3a (diff)
downloadbinaryen-a3b3a516bd8117cd83aa0625839e614110d1fc0b.tar.gz
binaryen-a3b3a516bd8117cd83aa0625839e614110d1fc0b.tar.bz2
binaryen-a3b3a516bd8117cd83aa0625839e614110d1fc0b.zip
Use rpath instead of LD_LIBRARY_PATH for shared object use (#448)
Use the -rpath linker flag to locate libbinaryen-c.so instead of injecting paths into the user's LD_LIBRARY_PATH Also Link libsupport and libasmjs into libbinaryen-c Fixes #444
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/check.py b/check.py
index 4c446d954..57d5a4290 100755
--- a/check.py
+++ b/check.py
@@ -50,12 +50,6 @@ BIN_DIR = os.path.abspath(os.path.join(WATERFALL_BUILD_DIR, 'wasm-install', 'bin
os.environ['BINARYEN'] = os.getcwd()
-# 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'
-
def fetch_waterfall():
rev = open(os.path.join('test', 'revision')).read().strip()
try:
@@ -601,7 +595,8 @@ if has_vanilla_emcc and has_vanilla_llvm:
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'),
@@ -614,7 +609,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'):
@@ -622,9 +618,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]
- expected = open(os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt')).read()
+ try:
+ subprocess.check_call(cmd)
+ actual = subprocess.Popen([output_file], stdout=subprocess.PIPE).communicate()[0]
+ expected = open(os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt')).read()
+ finally:
+ os.remove(output_file)
if actual != expected:
fail(actual, expected)