summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitry Moskalchuk <dm@crystax.net>2022-09-17 16:20:10 +0300
committerDmitry Moskalchuk <dm@crystax.net>2022-09-17 16:20:49 +0300
commit5faf4534366826350654db8d65cba81e50387519 (patch)
treec26e93de7bc15f6faa0413978200c0e528ce2df8 /tests
parenta37476da03960964e3124d4f54cf8e9503db9f3e (diff)
downloadpatchelf-5faf4534366826350654db8d65cba81e50387519.tar.gz
Add documentation and test case for --print-os-abi and --set-os-abi
Signed-off-by: Dmitry Moskalchuk <dm@crystax.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/change-abi.sh44
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bbea1ba..600639d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,7 @@ src_TESTS = \
endianness.sh \
contiguous-note-sections.sh \
no-gnu-hash.sh \
+ change-abi.sh \
grow-file.sh \
no-dynamic-section.sh \
args-from-file.sh \
diff --git a/tests/change-abi.sh b/tests/change-abi.sh
new file mode 100755
index 0000000..26a151d
--- /dev/null
+++ b/tests/change-abi.sh
@@ -0,0 +1,44 @@
+#! /bin/sh -e
+
+SCRATCH=scratch/$(basename $0 .sh)
+
+rm -rf ${SCRATCH}
+mkdir -p ${SCRATCH}
+
+cp simple-pie ${SCRATCH}/simple-pie
+
+# Save the old OS ABI
+OLDABI=`../src/patchelf --print-os-abi ${SCRATCH}/simple-pie`
+# Ensure it's not empty
+test -n "$OLDABI"
+
+# Change OS ABI and verify it has been changed
+{
+ echo "System V"
+ echo "HP-UX"
+ 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'..."
+ NEWABI=`../src/patchelf --print-os-abi ${SCRATCH}/simple-pie`
+ test "$NEWABI" = "$ABI"
+ done
+}
+
+# Reset OS ABI to the saved one
+../src/patchelf --set-os-abi "$OLDABI" ${SCRATCH}/simple-pie
+
+# Verify we still can run the executable
+${SCRATCH}/simple-pie