mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-16 05:36:30 +08:00
tests: apply suggestions from shellcheck
Re-cherry-pick for the files that were not in the last cherry-pick.
(cherry picked from commit be4b84635f
)
This commit is contained in:

committed by
John Ericson

parent
aeaaa426ab
commit
edec2a9ad7
@@ -1,44 +1,29 @@
|
|||||||
#! /bin/sh -e
|
#! /bin/sh -e
|
||||||
|
|
||||||
SCRATCH=scratch/$(basename $0 .sh)
|
SCRATCH=scratch/$(basename "$0" .sh)
|
||||||
|
|
||||||
rm -rf ${SCRATCH}
|
rm -rf "${SCRATCH}"
|
||||||
mkdir -p ${SCRATCH}
|
mkdir -p "${SCRATCH}"
|
||||||
|
|
||||||
cp simple-pie ${SCRATCH}/simple-pie
|
cp simple-pie "${SCRATCH}/simple-pie"
|
||||||
|
|
||||||
# Save the old OS ABI
|
# Save the old OS ABI
|
||||||
OLDABI=`../src/patchelf --print-os-abi ${SCRATCH}/simple-pie`
|
OLDABI=$(../src/patchelf --print-os-abi "${SCRATCH}/simple-pie")
|
||||||
# Ensure it's not empty
|
# Ensure it's not empty
|
||||||
test -n "$OLDABI"
|
test -n "$OLDABI"
|
||||||
|
|
||||||
# Change OS ABI and verify it has been changed
|
# Change OS ABI and verify it has been changed
|
||||||
{
|
for ABI in "System V" "HP-UX" "NetBSD" "Linux" "GNU Hurd" "Solaris" "AIX" "IRIX" "FreeBSD" "Tru64" "OpenBSD" "OpenVMS"; do
|
||||||
echo "System V"
|
echo "Set OS ABI to '$ABI'..."
|
||||||
echo "HP-UX"
|
../src/patchelf --set-os-abi "$ABI" "${SCRATCH}/simple-pie"
|
||||||
echo "NetBSD"
|
|
||||||
echo "Linux"
|
|
||||||
echo "GNU Hurd"
|
|
||||||
echo "Solaris"
|
|
||||||
echo "AIX"
|
|
||||||
echo "IRIX"
|
|
||||||
echo "FreeBSD"
|
|
||||||
echo "Tru64"
|
|
||||||
echo "OpenBSD"
|
|
||||||
echo "OpenVMS"
|
|
||||||
} | {
|
|
||||||
while IFS="\n" read ABI; do
|
|
||||||
echo "Set OS ABI to '$ABI'..."
|
|
||||||
../src/patchelf --set-os-abi "$ABI" ${SCRATCH}/simple-pie
|
|
||||||
|
|
||||||
echo "Check is OS ABI is '$ABI'..."
|
echo "Check is OS ABI is '$ABI'..."
|
||||||
NEWABI=`../src/patchelf --print-os-abi ${SCRATCH}/simple-pie`
|
NEWABI=$(../src/patchelf --print-os-abi "${SCRATCH}/simple-pie")
|
||||||
test "$NEWABI" = "$ABI"
|
test "$NEWABI" = "$ABI"
|
||||||
done
|
done
|
||||||
}
|
|
||||||
|
|
||||||
# Reset OS ABI to the saved one
|
# Reset OS ABI to the saved one
|
||||||
../src/patchelf --set-os-abi "$OLDABI" ${SCRATCH}/simple-pie
|
../src/patchelf --set-os-abi "$OLDABI" "${SCRATCH}/simple-pie"
|
||||||
|
|
||||||
# Verify we still can run the executable
|
# Verify we still can run the executable
|
||||||
${SCRATCH}/simple-pie
|
"${SCRATCH}/simple-pie"
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
#! /bin/sh -e
|
#! /bin/sh -e
|
||||||
|
|
||||||
SCRATCH=scratch/$(basename $0 .sh)
|
SCRATCH=scratch/$(basename "$0" .sh)
|
||||||
|
|
||||||
rm -rf ${SCRATCH}
|
rm -rf "${SCRATCH}"
|
||||||
mkdir -p ${SCRATCH}
|
mkdir -p "${SCRATCH}"
|
||||||
cp $(dirname $(readlink -f $0))/empty-note ${SCRATCH}/
|
cp "$(dirname "$(readlink -f "$0")")/empty-note" "${SCRATCH}/"
|
||||||
|
|
||||||
# Running --set-interpreter on this binary should not produce the following
|
# Running --set-interpreter on this binary should not produce the following
|
||||||
# error:
|
# error:
|
||||||
# patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections
|
# patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections
|
||||||
../src/patchelf --set-interpreter ld-linux-x86-64.so.2 ${SCRATCH}/empty-note
|
../src/patchelf --set-interpreter ld-linux-x86-64.so.2 "${SCRATCH}/empty-note"
|
||||||
|
Reference in New Issue
Block a user