From b60d8d3ef2dee991cab7e953c963e46136a92733 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 3 Oct 2005 18:22:32 +0000 Subject: * Add a test for programs that crash when .dynstr etc. are moved. --- tests/Makefile.am | 21 +++++++++++++++------ tests/big-dynstr.sh | 22 ++++++++++++++++++++++ tests/plain-fail.sh | 4 +++- 3 files changed, 40 insertions(+), 7 deletions(-) create mode 100755 tests/big-dynstr.sh 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 -- cgit v0.12