diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-24 14:58:45 (GMT) |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-24 14:58:45 (GMT) |
commit | 1090b56a0a6f1549affa0db9e70037e3c0883d67 (patch) | |
tree | 7a45b73259659f34b61e9aef57308f9623924f12 /tests | |
parent | a269d13d6d090f247b0314c97fb0a0c81d0aee8f (diff) | |
parent | c4220eaf0f552cfd68148ddefd6455ff2ce0e08c (diff) | |
download | patchelf-1090b56a0a6f1549affa0db9e70037e3c0883d67.zip patchelf-1090b56a0a6f1549affa0db9e70037e3c0883d67.tar.gz patchelf-1090b56a0a6f1549affa0db9e70037e3c0883d67.tar.bz2 |
Merge branch 'master' of github.com:vdanjean/patchelf
Conflicts:
tests/Makefile.am
Diffstat (limited to 'tests')
19 files changed, 86 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 708b17e..7922783 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,21 +1,50 @@ -check_PROGRAMS = simple main main-scoped big-dynstr +check_PROGRAMS = simple main main-scoped big-dynstr no-rpath -TESTS = plain-fail.sh plain-run.sh shrink-rpath.sh set-interpreter-short.sh \ +no_rpath_arch_TESTS = \ + no-rpath-amd64.sh \ + no-rpath-armel.sh \ + no-rpath-armhf.sh \ + no-rpath-hurd-i386.sh \ + no-rpath-i386.sh \ + no-rpath-ia64.sh \ + no-rpath-kfreebsd-amd64.sh \ + no-rpath-kfreebsd-i386.sh \ + no-rpath-mips.sh \ + no-rpath-mipsel.sh \ + no-rpath-powerpc.sh \ + no-rpath-s390.sh \ + no-rpath-sh4.sh \ + no-rpath-sparc.sh + +XFAIL_TESTS = no-rpath-ia64.sh + +src_TESTS = \ + plain-fail.sh plain-run.sh shrink-rpath.sh set-interpreter-short.sh \ set-interpreter-long.sh set-rpath.sh no-rpath.sh big-dynstr.sh \ set-rpath-library.sh soname.sh -EXTRA_DIST = no-rpath $(TESTS) + +build_TESTS = \ + $(no_rpath_arch_TESTS) + +TESTS = $(src_TESTS) $(build_TESTS) + +EXTRA_DIST = no-rpath-prebuild $(src_TESTS) no-rpath-prebuild.sh TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 +$(no_rpath_arch_TESTS): no-rpath-prebuild.sh + @ln -s $< $@ + CLEANFILES = big-dynstr.c clean-local: - $(RM) -r scratch + $(RM) -r scratch $(no_rpath_arch_TESTS) # by default, use -fpic to compile AM_CFLAGS = -fpic LDFLAGS_local = -Wl,--disable-new-dtags -Wl,-rpath-link=. -L. $(AM_LDFLAGS) LDFLAGS_sharedlib = -Wl,--disable-new-dtags -shared -L. $(AM_LDFLAGS) export NIX_DONT_SET_RPATH=1 +export NIX_LDFLAGS= simple_SOURCES = simple.c # no -fpic for simple.o @@ -64,3 +93,7 @@ libbar_scoped_so_LDFLAGS = $(LDFLAGS_sharedlib) libsimple_so_SOURCES = simple.c libsimple_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,-soname,libsimple.so.1.0 + +no_rpath_SOURCES = no-rpath.c +# no -fpic for no-rpath.o +no_rpath_CFLAGS = diff --git a/tests/no-rpath b/tests/no-rpath Binary files differdeleted file mode 100755 index b454dfe..0000000 --- a/tests/no-rpath +++ /dev/null diff --git a/tests/no-rpath-prebuild.sh b/tests/no-rpath-prebuild.sh new file mode 100755 index 0000000..0fc96d2 --- /dev/null +++ b/tests/no-rpath-prebuild.sh @@ -0,0 +1,41 @@ +#! /bin/sh -e +ARCH="$1" +SCRATCH=scratch/no-rpath-$ARCH + +if [ -z "$ARCH" ]; then + ARCH=$(basename $0 .sh | sed -e 's/.*-//') +fi + +if [ -z "$ARCH" ] || [ $ARCH = prebuild ] ; then + echo "Architecture required" + exit 1 +fi + +no_rpath_bin="${srcdir}/no-rpath-prebuild/no-rpath-$ARCH" + +if [ ! -f $no_rpath_bin ]; then + echo "no 'no-rpath' binary for '$ARCH' in '${srcdir}/no-rpath-prebuild'" + exit 1 +fi + +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} + +cp $no_rpath_bin ${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 + +newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath) +if ! echo "$newRPath" | grep -q '/foo:/bar'; then + echo "incomplete RPATH" + exit 1 +fi + +if [ "$(../src/patchelf --print-interpreter $no_rpath_bin)" \ + = "$(../src/patchelf --print-interpreter ../src/patchelf)" ]; then + cd ${SCRATCH} && ./no-rpath +fi diff --git a/tests/no-rpath-prebuild/no-rpath-amd64 b/tests/no-rpath-prebuild/no-rpath-amd64 Binary files differnew file mode 100755 index 0000000..f457704 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-amd64 diff --git a/tests/no-rpath-prebuild/no-rpath-armel b/tests/no-rpath-prebuild/no-rpath-armel Binary files differnew file mode 100755 index 0000000..8a9f879 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-armel diff --git a/tests/no-rpath-prebuild/no-rpath-armhf b/tests/no-rpath-prebuild/no-rpath-armhf Binary files differnew file mode 100755 index 0000000..aaaef60 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-armhf diff --git a/tests/no-rpath-prebuild/no-rpath-hurd-i386 b/tests/no-rpath-prebuild/no-rpath-hurd-i386 Binary files differnew file mode 100755 index 0000000..762c451 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-hurd-i386 diff --git a/tests/no-rpath-prebuild/no-rpath-i386 b/tests/no-rpath-prebuild/no-rpath-i386 Binary files differnew file mode 100755 index 0000000..07b3821 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-i386 diff --git a/tests/no-rpath-prebuild/no-rpath-ia64 b/tests/no-rpath-prebuild/no-rpath-ia64 Binary files differnew file mode 100755 index 0000000..4b65d7c --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-ia64 diff --git a/tests/no-rpath-prebuild/no-rpath-kfreebsd-amd64 b/tests/no-rpath-prebuild/no-rpath-kfreebsd-amd64 Binary files differnew file mode 100755 index 0000000..d7a2644 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-kfreebsd-amd64 diff --git a/tests/no-rpath-prebuild/no-rpath-kfreebsd-i386 b/tests/no-rpath-prebuild/no-rpath-kfreebsd-i386 Binary files differnew file mode 100755 index 0000000..36c0ed3 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-kfreebsd-i386 diff --git a/tests/no-rpath-prebuild/no-rpath-mips b/tests/no-rpath-prebuild/no-rpath-mips Binary files differnew file mode 100755 index 0000000..2cc2d28 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-mips diff --git a/tests/no-rpath-prebuild/no-rpath-mipsel b/tests/no-rpath-prebuild/no-rpath-mipsel Binary files differnew file mode 100755 index 0000000..0a6ae88 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-mipsel diff --git a/tests/no-rpath-prebuild/no-rpath-powerpc b/tests/no-rpath-prebuild/no-rpath-powerpc Binary files differnew file mode 100755 index 0000000..9abb07e --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-powerpc diff --git a/tests/no-rpath-prebuild/no-rpath-s390 b/tests/no-rpath-prebuild/no-rpath-s390 Binary files differnew file mode 100755 index 0000000..1334eab --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-s390 diff --git a/tests/no-rpath-prebuild/no-rpath-sh4 b/tests/no-rpath-prebuild/no-rpath-sh4 Binary files differnew file mode 100755 index 0000000..6135f0a --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-sh4 diff --git a/tests/no-rpath-prebuild/no-rpath-sparc b/tests/no-rpath-prebuild/no-rpath-sparc Binary files differnew file mode 100755 index 0000000..a87bb59 --- /dev/null +++ b/tests/no-rpath-prebuild/no-rpath-sparc diff --git a/tests/no-rpath.c b/tests/no-rpath.c new file mode 100644 index 0000000..e6a5b85 --- /dev/null +++ b/tests/no-rpath.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("Hello world\n"); + return 0; +} diff --git a/tests/no-rpath.sh b/tests/no-rpath.sh index 20c720c..3efa7f1 100755 --- a/tests/no-rpath.sh +++ b/tests/no-rpath.sh @@ -4,7 +4,7 @@ SCRATCH=scratch/$(basename $0 .sh) rm -rf ${SCRATCH} mkdir -p ${SCRATCH} -cp ${srcdir}/no-rpath ${SCRATCH}/ +cp no-rpath ${SCRATCH}/ oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath) if test -n "$oldRPath"; then exit 1; fi @@ -18,6 +18,4 @@ if ! echo "$newRPath" | grep -q '/foo:/bar'; then exit 1 fi -if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then - cd ${SCRATCH} && ./no-rpath -fi +cd ${SCRATCH} && ./no-rpath |