* Add a test for programs that crash when .dynstr etc. are moved.

This commit is contained in:
Eelco Dolstra 2005-10-03 18:22:32 +00:00
parent df7806f982
commit b60d8d3ef2
3 changed files with 40 additions and 7 deletions

View File

@ -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)

22
tests/big-dynstr.sh Executable file
View File

@ -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

View File

@ -1,2 +1,4 @@
#! /bin/sh
./main
if ./main; then
exit 1
fi