summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-10-03 18:22:32 (GMT)
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-10-03 18:22:32 (GMT)
commitb60d8d3ef2dee991cab7e953c963e46136a92733 (patch)
tree890313aac2ec02d5552d616d9d294fcffd17228a
parentdf7806f98294c29fa8aa8d71fcf1ef3d728a46d9 (diff)
downloadpatchelf-b60d8d3ef2dee991cab7e953c963e46136a92733.zip
patchelf-b60d8d3ef2dee991cab7e953c963e46136a92733.tar.gz
patchelf-b60d8d3ef2dee991cab7e953c963e46136a92733.tar.bz2
* Add a test for programs that crash when .dynstr etc. are moved.
-rw-r--r--tests/Makefile.am21
-rwxr-xr-xtests/big-dynstr.sh22
-rwxr-xr-xtests/plain-fail.sh4
3 files changed, 40 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c0c2252..c19f9aa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,9 +1,7 @@
-check_PROGRAMS = main simple
+check_PROGRAMS = main simple big-dynstr
-TESTS = plain-run.sh shrink.sh set-interpreter-short.sh \
- set-interpreter-long.sh set-rpath.sh no-rpath.sh $(XFAIL_TESTS)
-
-XFAIL_TESTS = plain-fail.sh
+TESTS = plain-fail.sh plain-run.sh shrink.sh set-interpreter-short.sh \
+ set-interpreter-long.sh set-rpath.sh no-rpath.sh big-dynstr.sh
simple_SOURCES = simple.c
@@ -27,8 +25,19 @@ libbar.so: bar.o
bar.o: bar.c
$(CC) -fpic -o bar.o -c bar.c
+
+big_dynstr_SOURCES = big-dynstr.c
+
+big-dynstr: big-dynstr.o libfoo.so
+ LD_LIBRARY_PATH=. gcc -o big-dynstr big-dynstr.o -L . -lfoo
+
+big-dynstr.c: main.c
+ cat main.c > big-dynstr.c
+ for i in $$(seq 1 2000); do echo "void f$$i(void) { };" >> big-dynstr.c; done
+
+
clean-local:
- $(RM) *.o libfoo.so libbar.so main
+ $(RM) *.o libfoo.so libbar.so main big-dynstr big-dynstr.c
EXTRA_DIST = main.c foo.c bar.c no-rpath $(TESTS)
diff --git a/tests/big-dynstr.sh b/tests/big-dynstr.sh
new file mode 100755
index 0000000..2674e18
--- /dev/null
+++ b/tests/big-dynstr.sh
@@ -0,0 +1,22 @@
+#! /bin/sh -e
+
+rm -rf scratch
+mkdir -p scratch
+mkdir -p scratch/libsA
+mkdir -p scratch/libsB
+
+cp big-dynstr scratch/
+cp libfoo.so scratch/libsA/
+cp libbar.so scratch/libsB/
+
+oldRPath=$(../src/patchelf --print-rpath scratch/big-dynstr)
+if test -z "$oldRPath"; then oldRPath="/oops"; fi
+../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsA:$(pwd)/scratch/libsB scratch/big-dynstr
+
+exitCode=0
+cd scratch && ./big-dynstr || exitCode=$?
+
+if test "$exitCode" != 46; then
+ echo "bad exit code!"
+ exit 1
+fi
diff --git a/tests/plain-fail.sh b/tests/plain-fail.sh
index b8021bc..85ecc42 100755
--- a/tests/plain-fail.sh
+++ b/tests/plain-fail.sh
@@ -1,2 +1,4 @@
#! /bin/sh
-./main
+if ./main; then
+ exit 1
+fi