diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2023-02-19 08:55:11 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2023-02-20 23:18:33 +0100 |
commit | be4b84635f806998853825e23d94b14723e37b55 (patch) | |
tree | 187d04463c9d81395c34c43c0ff4472dc21d5eeb /tests/force-rpath.sh | |
parent | 365e1e01868f453ee01c5aaafd78631818ddf7f0 (diff) | |
download | patchelf-be4b84635f806998853825e23d94b14723e37b55.tar.gz |
tests: apply suggestions from shellcheck
Diffstat (limited to 'tests/force-rpath.sh')
-rwxr-xr-x | tests/force-rpath.sh | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/force-rpath.sh b/tests/force-rpath.sh index c9b9a5d..a673f20 100755 --- a/tests/force-rpath.sh +++ b/tests/force-rpath.sh @@ -1,29 +1,33 @@ #! /bin/sh -e -SCRATCH=scratch/$(basename $0 .sh) +SCRATCH=scratch/$(basename "$0" .sh) OBJDUMP=${OBJDUMP:-objdump} -rm -rf ${SCRATCH} -mkdir -p ${SCRATCH} +rm -rf "${SCRATCH}" +mkdir -p "${SCRATCH}" SCRATCHFILE=${SCRATCH}/libfoo.so -cp libfoo.so $SCRATCHFILE +cp libfoo.so "$SCRATCHFILE" doit() { - echo patchelf $* - ../src/patchelf $* $SCRATCHFILE + set +x + ../src/patchelf "$@" "$SCRATCHFILE" + set -x } expect() { - out=$(echo $($OBJDUMP -x $SCRATCHFILE | grep PATH)) + out=$("$OBJDUMP" -x "$SCRATCHFILE" | grep PATH || true) - if [ "$out" != "$*" ]; then - echo "Expected '$*' but got '$out'" - exit 1 - fi + for i in $out; do + if [ "$i" != "$1" ]; then + echo "Expected '$*' but got '$out'" + exit 1 + fi + shift + done } doit --remove-rpath -expect +expect "" doit --set-rpath foo expect RUNPATH foo doit --force-rpath --set-rpath foo |