diff options
author | Vincent Danjean <Vincent.Danjean@ens-lyon.org> | 2012-06-21 09:43:57 (GMT) |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-10 22:16:24 (GMT) |
commit | 3226dea3610c8d3cb81b574e1aa478948ddc6c91 (patch) | |
tree | 589be58acd0b07fdee94091f2042f9884bfc8cef /tests | |
parent | d0dac944aeb6385da874d07da2c9897f2f9bd7d6 (diff) | |
download | patchelf-3226dea3610c8d3cb81b574e1aa478948ddc6c91.zip patchelf-3226dea3610c8d3cb81b574e1aa478948ddc6c91.tar.gz patchelf-3226dea3610c8d3cb81b574e1aa478948ddc6c91.tar.bz2 |
Allow parallel execution of tests
Each test use its own subdirectory in scratch/
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/big-dynstr.sh | 23 | ||||
-rwxr-xr-x | tests/no-rpath.sh | 15 | ||||
-rwxr-xr-x | tests/set-interpreter-long.sh | 17 | ||||
-rwxr-xr-x | tests/set-interpreter-short.sh | 11 | ||||
-rwxr-xr-x | tests/set-rpath-library.sh | 33 | ||||
-rwxr-xr-x | tests/set-rpath.sh | 23 | ||||
-rwxr-xr-x | tests/shrink-rpath.sh | 15 |
7 files changed, 72 insertions, 65 deletions
diff --git a/tests/big-dynstr.sh b/tests/big-dynstr.sh index bb95366..19adad1 100755 --- a/tests/big-dynstr.sh +++ b/tests/big-dynstr.sh @@ -1,24 +1,25 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) -rm -rf scratch -mkdir -p scratch -mkdir -p scratch/libsA -mkdir -p scratch/libsB +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/ +cp big-dynstr ${SCRATCH}/ +cp libfoo.so ${SCRATCH}/libsA/ +cp libbar.so ${SCRATCH}/libsB/ -oldRPath=$(../src/patchelf --print-rpath scratch/big-dynstr) +oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/big-dynstr) if test -z "$oldRPath"; then oldRPath="/oops"; fi -../src/patchelf --force-rpath --set-rpath $oldRPath:$(pwd)/scratch/libsA:$(pwd)/scratch/libsB scratch/big-dynstr +../src/patchelf --force-rpath --set-rpath $oldRPath:$(pwd)/${SCRATCH}/libsA:$(pwd)/${SCRATCH}/libsB ${SCRATCH}/big-dynstr if test "$(uname)" = FreeBSD; then - export LD_LIBRARY_PATH=$(pwd)/scratch/libsB + export LD_LIBRARY_PATH=$(pwd)/${SCRATCH}/libsB fi exitCode=0 -cd scratch && ./big-dynstr || exitCode=$? +cd ${SCRATCH} && ./big-dynstr || exitCode=$? if test "$exitCode" != 46; then echo "bad exit code!" diff --git a/tests/no-rpath.sh b/tests/no-rpath.sh index 7245317..20c720c 100755 --- a/tests/no-rpath.sh +++ b/tests/no-rpath.sh @@ -1,22 +1,23 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) -rm -rf scratch -mkdir -p scratch +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} -cp ${srcdir}/no-rpath scratch/ +cp ${srcdir}/no-rpath ${SCRATCH}/ -oldRPath=$(../src/patchelf --print-rpath scratch/no-rpath) +oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath) if test -n "$oldRPath"; then exit 1; fi ../src/patchelf \ --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \ - --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx scratch/no-rpath + --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath -newRPath=$(../src/patchelf --print-rpath scratch/no-rpath) +newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath) if ! echo "$newRPath" | grep -q '/foo:/bar'; then echo "incomplete RPATH" exit 1 fi if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then - cd scratch && ./no-rpath + cd ${SCRATCH} && ./no-rpath fi diff --git a/tests/set-interpreter-long.sh b/tests/set-interpreter-long.sh index 55ced77..058ccd2 100755 --- a/tests/set-interpreter-long.sh +++ b/tests/set-interpreter-long.sh @@ -1,4 +1,5 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) ./simple @@ -10,24 +11,24 @@ if test "$(uname)" = Linux; then "$oldInterpreter" ./simple fi -rm -rf scratch -mkdir -p scratch +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} -newInterpreter=$(pwd)/scratch/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii -cp simple scratch/ -../src/patchelf --set-interpreter "$newInterpreter" scratch/simple +newInterpreter=$(pwd)/${SCRATCH}/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +cp simple ${SCRATCH}/ +../src/patchelf --set-interpreter "$newInterpreter" ${SCRATCH}/simple echo "running with missing interpreter..." -if scratch/simple; then +if ${SCRATCH}/simple; then echo "simple works, but it shouldn't" exit 1 fi echo "running with new interpreter..." ln -s "$oldInterpreter" "$newInterpreter" -scratch/simple +${SCRATCH}/simple if test "$(uname)" = Linux; then echo "running with explicit interpreter..." - "$oldInterpreter" scratch/simple + "$oldInterpreter" ${SCRATCH}/simple fi diff --git a/tests/set-interpreter-short.sh b/tests/set-interpreter-short.sh index 62990c9..2c9f4eb 100755 --- a/tests/set-interpreter-short.sh +++ b/tests/set-interpreter-short.sh @@ -1,18 +1,19 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) ./simple oldInterpreter=$(../src/patchelf --print-interpreter ./simple) echo "current interpreter is $oldInterpreter" -rm -rf scratch -mkdir -p scratch +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} -cp simple scratch/ -../src/patchelf --set-interpreter /oops scratch/simple +cp simple ${SCRATCH}/ +../src/patchelf --set-interpreter /oops ${SCRATCH}/simple echo "running with missing interpreter..." -if scratch/simple; then +if ${SCRATCH}/simple; then echo "simple works, but it shouldn't" exit 1 fi diff --git a/tests/set-rpath-library.sh b/tests/set-rpath-library.sh index 50e58b8..dd1381f 100755 --- a/tests/set-rpath-library.sh +++ b/tests/set-rpath-library.sh @@ -1,27 +1,28 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) if test "$(uname)" = FreeBSD; then echo "skipping on FreeBSD" exit 0 fi -rm -rf scratch -mkdir -p scratch -mkdir -p scratch/libsA -mkdir -p scratch/libsB +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} +mkdir -p ${SCRATCH}/libsA +mkdir -p ${SCRATCH}/libsB -cp main-scoped scratch/ -cp libfoo-scoped.so scratch/libsA/ -cp libbar-scoped.so scratch/libsB/ +cp main-scoped ${SCRATCH}/ +cp libfoo-scoped.so ${SCRATCH}/libsA/ +cp libbar-scoped.so ${SCRATCH}/libsB/ -oldRPath=$(../src/patchelf --print-rpath scratch/main-scoped) +oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/main-scoped) if test -z "$oldRPath"; then oldRPath="/oops"; fi -../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsA:$(pwd)/scratch/libsB scratch/main-scoped +../src/patchelf --set-rpath $oldRPath:$(pwd)/${SCRATCH}/libsA:$(pwd)/${SCRATCH}/libsB ${SCRATCH}/main-scoped # "main" contains libbar in its RUNPATH, but that's ignored when # resolving libfoo. So libfoo won't find libbar and this will fail. exitCode=0 -(cd scratch && ./main-scoped) || exitCode=$? +(cd ${SCRATCH} && ./main-scoped) || exitCode=$? if test "$exitCode" = 46; then echo "expected failure" @@ -29,12 +30,12 @@ if test "$exitCode" = 46; then fi # So set an RUNPATH on libfoo as well. -oldRPath=$(../src/patchelf --print-rpath scratch/libsA/libfoo-scoped.so) +oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/libsA/libfoo-scoped.so) if test -z "$oldRPath"; then oldRPath="/oops"; fi -../src/patchelf --set-rpath $oldRPath:$(pwd)/scratch/libsB scratch/libsA/libfoo-scoped.so +../src/patchelf --set-rpath $oldRPath:$(pwd)/${SCRATCH}/libsB ${SCRATCH}/libsA/libfoo-scoped.so exitCode=0 -(cd scratch && ./main-scoped) || exitCode=$? +(cd ${SCRATCH} && ./main-scoped) || exitCode=$? if test "$exitCode" != 46; then echo "bad exit code!" @@ -42,15 +43,15 @@ if test "$exitCode" != 46; then fi # Remove the libbar PATH from main using --shrink-rpath. -../src/patchelf --shrink-rpath scratch/main-scoped -if ../src/patchelf --print-rpath scratch/main-scoped | grep /libsB; then +../src/patchelf --shrink-rpath ${SCRATCH}/main-scoped +if ../src/patchelf --print-rpath ${SCRATCH}/main-scoped | grep /libsB; then echo "shrink failed" exit 1 fi # And it should still run. exitCode=0 -(cd scratch && ./main-scoped) || exitCode=$? +(cd ${SCRATCH} && ./main-scoped) || exitCode=$? if test "$exitCode" != 46; then echo "bad exit code!" diff --git a/tests/set-rpath.sh b/tests/set-rpath.sh index b797017..90452f9 100755 --- a/tests/set-rpath.sh +++ b/tests/set-rpath.sh @@ -1,24 +1,25 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) -rm -rf scratch -mkdir -p scratch -mkdir -p scratch/libsA -mkdir -p scratch/libsB +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} +mkdir -p ${SCRATCH}/libsA +mkdir -p ${SCRATCH}/libsB -cp main scratch/ -cp libfoo.so scratch/libsA/ -cp libbar.so scratch/libsB/ +cp main ${SCRATCH}/ +cp libfoo.so ${SCRATCH}/libsA/ +cp libbar.so ${SCRATCH}/libsB/ -oldRPath=$(../src/patchelf --print-rpath scratch/main) +oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/main) if test -z "$oldRPath"; then oldRPath="/oops"; fi -../src/patchelf --force-rpath --set-rpath $oldRPath:$(pwd)/scratch/libsA:$(pwd)/scratch/libsB scratch/main +../src/patchelf --force-rpath --set-rpath $oldRPath:$(pwd)/${SCRATCH}/libsA:$(pwd)/${SCRATCH}/libsB ${SCRATCH}/main if test "$(uname)" = FreeBSD; then - export LD_LIBRARY_PATH=$(pwd)/scratch/libsB + export LD_LIBRARY_PATH=$(pwd)/${SCRATCH}/libsB fi exitCode=0 -(cd scratch && ./main) || exitCode=$? +(cd ${SCRATCH} && ./main) || exitCode=$? if test "$exitCode" != 46; then echo "bad exit code!" diff --git a/tests/shrink-rpath.sh b/tests/shrink-rpath.sh index e0c82c1..3adc846 100755 --- a/tests/shrink-rpath.sh +++ b/tests/shrink-rpath.sh @@ -1,4 +1,5 @@ #! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) rpath=$(../src/patchelf --print-rpath ./libbar.so) echo "RPATH before: $rpath" @@ -7,22 +8,22 @@ if ! echo "$rpath" | grep -q /no-such-path; then exit 1 fi -rm -rf scratch -mkdir -p scratch -cp libbar.so scratch/ -../src/patchelf --shrink-rpath scratch/libbar.so +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} +cp libbar.so ${SCRATCH}/ +../src/patchelf --shrink-rpath ${SCRATCH}/libbar.so -rpath=$(../src/patchelf --print-rpath scratch/libbar.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" exit 1 fi -cp libfoo.so scratch/ +cp libfoo.so ${SCRATCH}/ exitCode=0 -cd scratch && LD_LIBRARY_PATH=. ../main || exitCode=$? +cd ${SCRATCH} && LD_LIBRARY_PATH=. ../../main || exitCode=$? if test "$exitCode" != 46; then echo "bad exit code!" |