test: assert EM_AARCH64 (offset 18) instead of guessing at the e_flags byte
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-11 07:09:17
Commit8ed4cb4b
Parents373cae83
Changed files
tests/run.sh+7−6■■■■■
1 file+7−6
Diff
tests/run.sh+7−6■■■■■
index 65374be..04c3700 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -340,13 +340,14 @@ else
340340 echo " skip musl (not built)"
341341 fi
342342 if [ -f plugin_disks.arm64 ]; then
343- case $(head -c 20 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in
344- 7f454c46*000000b7*) pass "arm64 artifact is an aarch64 ELF" ;;
345- *) case $(head -c 4 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in
346- 7f454c46) pass "arm64 artifact is ELF (arch not probed)" ;;
347- *) fail "arm64 artifact is not ELF" ;;
348- esac ;;
343+ case $(head -c 4 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in
344+ 7f454c46) pass "arm64 artifact is ELF" ;;
345+ *) fail "arm64 artifact is not ELF" ;;
349346 esac
347+ # e_machine sits at offset 18, little endian: b7 00 == EM_AARCH64
348+ EM=$(od -An -tx1 -j 18 -N 2 plugin_disks.arm64 | tr -d ' \n')
349+ [ "$EM" = "b700" ] && pass "arm64 artifact declares EM_AARCH64" \
350+ || fail "arm64 artifact e_machine is $EM, expected b700"
350351 else
351352 echo " skip arm64 (not built)"
352353 fi
353354
tests/run.sh+7−6■■■■■
index 65374be..04c3700 100755index 65374be..04c3700 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -340,13 +340,14 @@ else@@ -340,13 +340,14 @@ else
340 echo " skip musl (not built)"340 echo " skip musl (not built)"
341 fi341 fi
342 if [ -f plugin_disks.arm64 ]; then342 if [ -f plugin_disks.arm64 ]; then
343- case $(head -c 20 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in343+ case $(head -c 4 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in
344- 7f454c46*000000b7*) pass "arm64 artifact is an aarch64 ELF" ;;344+ 7f454c46) pass "arm64 artifact is ELF" ;;
345- *) case $(head -c 4 plugin_disks.arm64 | od -An -tx1 | tr -d ' \n') in345+ *) fail "arm64 artifact is not ELF" ;;
346- 7f454c46) pass "arm64 artifact is ELF (arch not probed)" ;;
347- *) fail "arm64 artifact is not ELF" ;;
348- esac ;;
349 esac346 esac
347+ # e_machine sits at offset 18, little endian: b7 00 == EM_AARCH64
348+ EM=$(od -An -tx1 -j 18 -N 2 plugin_disks.arm64 | tr -d ' \n')
349+ [ "$EM" = "b700" ] && pass "arm64 artifact declares EM_AARCH64" \
350+ || fail "arm64 artifact e_machine is $EM, expected b700"
350 else351 else
351 echo " skip arm64 (not built)"352 echo " skip arm64 (not built)"
352 fi353 fi
353354