summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2021-07-24 18:00:55 +0300
committerOvidiu Panait <ovpanait@gmail.com>2021-07-24 19:25:16 +0300
commit33009993176d923e23ff70414197539774e44c3a (patch)
tree6b2bbf00119bf61a38577650c37852ff646df9a2 /tests
parentf533f7b8987648286a587d25c33b12be8ff5f0c0 (diff)
downloadpatchelf-33009993176d923e23ff70414197539774e44c3a.tar.gz
tests: plain-needed.sh: add tescases for --add-needed-/--remove-needed
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/plain-needed.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/plain-needed.sh b/tests/plain-needed.sh
index 36267fb..8967303 100755
--- a/tests/plain-needed.sh
+++ b/tests/plain-needed.sh
@@ -1,4 +1,25 @@
#! /bin/sh
set -e
+
+SCRATCH=scratch/$(basename $0 .sh)
+MAIN_ELF="${SCRATCH}/main"
+
+PATCHELF="../src/patchelf"
+
+rm -rf ${SCRATCH}
+mkdir -p ${SCRATCH}
+cp main ${SCRATCH}/
+
echo "Confirming main requires libfoo"
-../src/patchelf --print-needed main | grep -q libfoo.so
+${PATCHELF} --print-needed "${MAIN_ELF}" | grep -q libfoo.so
+
+echo "Testing --add-needed functionality"
+${PATCHELF} --add-needed bar.so "${MAIN_ELF}"
+${PATCHELF} --print-needed "${MAIN_ELF}" | grep -q bar.so
+
+echo "Testing --remove-needed functionality"
+${PATCHELF} --remove-needed bar.so "${MAIN_ELF}"
+if ${PATCHELF} --print-needed "${MAIN_ELF}" | grep -q bar.so; then
+ echo "ERROR: --remove-needed did not eliminate bar.so!"
+ exit 1
+fi