#!/usr/bin/env bash # Hermetic tests for the collected-module gate (build/lib-module-gate.sh): a # module whose vermagic is not this kernel's is refused before it is copied, # in the test-only list and in a release list (aic8800), and the test-only # directory needs CONFIG_WARDEN_TEST_HANG=m. Fixtures only: no kernel tree, no # compiler, no network. The refusal paths run with a module of the wrong # vermagic, which the grep-only checks in run-test-hang-tests.sh never did. set -uo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO="$(cd "$HERE/../.." && pwd)" TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT FAIL=0 ok() { printf '[PASS] %s\n' "$1"; } bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; } # shellcheck source=build/lib-module-gate.sh . "$REPO/build/lib-module-gate.sh" KREL=6.18.46 GOOD="6.18.46 SMP preempt mod_unload ARMv7 p2v8" STALE="5.10.0 SMP preempt mod_unload ARMv7" # mkko : a fixture module whose .modinfo holds the vermagic as # a NUL-separated string, the way a built .ko does. mkko() { mkdir -p "$(dirname "$1")" printf '\177ELF\000\000\000modinfo\000license=GPL\000vermagic=%s\000depends=\000' "$2" > "$1" } # expect