summaryrefslogtreecommitdiff
path: root/tests/no-rpath-prebuild.sh
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2020-08-29 12:03:40 -0400
committerFelipe Sateler <fsateler@debian.org>2020-08-29 12:03:40 -0400
commit77491da34a860663eb38626910aa8913aa9d3c9c (patch)
tree14a0243a4845e0305bab8e40480787043ecdde94 /tests/no-rpath-prebuild.sh
Import patchelf_0.12.orig.tar.gz
[dgit import orig patchelf_0.12.orig.tar.gz]
Diffstat (limited to 'tests/no-rpath-prebuild.sh')
-rwxr-xr-xtests/no-rpath-prebuild.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/no-rpath-prebuild.sh b/tests/no-rpath-prebuild.sh
new file mode 100755
index 0000000..c58cf8e
--- /dev/null
+++ b/tests/no-rpath-prebuild.sh
@@ -0,0 +1,39 @@
+#! /bin/sh -e
+set -x
+ARCH="$1"
+PAGESIZE=4096
+
+if [ -z "$ARCH" ]; then
+ ARCH=$(basename $0 .sh | sed -e 's/^no-rpath-//')
+fi
+
+SCRATCH=scratch/no-rpath-$ARCH
+
+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 --page-size ${PAGESIZE} --print-rpath ${SCRATCH}/no-rpath)
+if test -n "$oldRPath"; then exit 1; fi
+../src/patchelf --page-size ${PAGESIZE} \
+ --set-interpreter "$(../src/patchelf --page-size ${PAGESIZE} --print-interpreter ../src/patchelf)" \
+ --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath
+
+newRPath=$(../src/patchelf --page-size ${PAGESIZE} --print-rpath ${SCRATCH}/no-rpath)
+if ! echo "$newRPath" | grep -q '/foo:/bar'; then
+ echo "incomplete RPATH"
+ exit 1
+fi