summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/set-rpath.sh15
-rwxr-xr-xtests/shrink.sh8
3 files changed, 19 insertions, 10 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ccd86dd..3d6a726 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,19 +10,19 @@ simple_SOURCES = simple.c
main: main.o libfoo.so
- LD_LIBRARY_PATH=. $(CC) -o main main.o -L . -lfoo
+ LD_LIBRARY_PATH=. gcc -o main main.o -L . -lfoo
main.o: main.c
$(CC) -fpic -o main.o -c main.c
libfoo.so: foo.o libbar.so
- $(CC) -shared -o libfoo.so foo.o -L . -lbar -Wl,-rpath,`pwd`/no-such-path
+ $(CC) -shared -o libfoo.so foo.o -L . -lbar
foo.o: foo.c
$(CC) -fpic -o foo.o -c foo.c
libbar.so: bar.o
- $(CC) -shared -o libbar.so bar.o -L .
+ NIX_DONT_SET_RPATH=1 $(CC) -shared -o libbar.so bar.o -L . -Wl,-rpath,`pwd`/no-such-path
bar.o: bar.c
$(CC) -fpic -o bar.o -c bar.c
diff --git a/tests/set-rpath.sh b/tests/set-rpath.sh
index 6446395..cbe1006 100755
--- a/tests/set-rpath.sh
+++ b/tests/set-rpath.sh
@@ -9,11 +9,20 @@ cp main scratch/
cp libfoo.so scratch/libsA/
cp libbar.so scratch/libsB/
-../src/patchelf --set-rpath $(pwd)/scratch/libsA scratch/main
-../src/patchelf --set-rpath $(pwd)/scratch/libsB scratch/libsA/libfoo.so
+oldRPath=$(../src/patchelf --print-rpath scratch/main)
+if test -z "$oldRPath"; then oldRPath="/oops"; fi
+../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsA:$(pwd)/scratch/libsB scratch/main
+
+#oldRPath=$(../src/patchelf --print-rpath scratch/libsA/libfoo.so)
+#if test -z "$oldRPath"; then oldRPath="/oops"; fi
+#../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsB scratch/libsA/libfoo.so
+
+#oldRPath=$(../src/patchelf --print-rpath scratch/libsB/libbar.so)
+#if test -z "$oldRPath"; then oldRPath="/oops"; fi
+#../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsC scratch/libsB/libbar.so
exitCode=0
-scratch/main || exitCode=$?
+cd scratch && ./main || exitCode=$?
if test "$exitCode" != 46; then
echo "bad exit code!"
diff --git a/tests/shrink.sh b/tests/shrink.sh
index 563270f..bbbf4d6 100755
--- a/tests/shrink.sh
+++ b/tests/shrink.sh
@@ -1,6 +1,6 @@
#! /bin/sh -e
-rpath=$(../src/patchelf --print-rpath ./libfoo.so)
+rpath=$(../src/patchelf --print-rpath ./libbar.so)
echo "RPATH before: $rpath"
if ! echo "$rpath" | grep -q /no-such-path; then
echo "incomplete RPATH"
@@ -9,10 +9,10 @@ fi
rm -rf scratch
mkdir -p scratch
-cp libfoo.so scratch/
-../src/patchelf --shrink-rpath scratch/libfoo.so
+cp libbar.so scratch/
+../src/patchelf --shrink-rpath scratch/libbar.so
-rpath=$(../src/patchelf --print-rpath scratch/libfoo.so)
+rpath=$(../src/patchelf --print-rpath scratch/libbar.so)
echo "RPATH after: $rpath"
if echo "$rpath" | grep -q /no-such-path; then
echo "RPATH not shrunk"