From 0f64560002b885fca7e04544ece3504e92dc29ae Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 26 Jul 2019 15:52:05 -0700 Subject: modinfo.test: bail out early if there are no modules. We need /proc/modules *and* a directory of modules. --- tests/modinfo.test | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/modinfo.test b/tests/modinfo.test index f39dc6ff..aaa7a7bd 100644 --- a/tests/modinfo.test +++ b/tests/modinfo.test @@ -4,14 +4,18 @@ #testing "name" "command" "result" "infile" "stdin" -testcmd "missing" "missing 2>&1" "modinfo: missing: not found\n" "" "" - -[ -e /proc/modules ] || { echo "Skipping: no /proc/modules"; exit 1; } - -# Android keeps its modules on the vendor partition. +# Android keeps its modules (if any) on the vendor partition. MODULE_ROOT="" [ -d /vendor/lib/modules ] && MODULE_ROOT="/vendor" +if [[ ! -e /proc/modules || ! -d $MODULE_ROOT/lib/modules ]]; then + echo "$SHOWSKIP: modinfo (no modules)" + return 2>/dev/null + exit +fi + +testcmd "missing" "missing 2>&1" "modinfo: missing: not found\n" "" "" + # Find some modules to work with. MODULE_PATH1=$(find $MODULE_ROOT/lib/modules -name *.ko | head -1 2>/dev/null) MODULE1=$(basename -s .ko $MODULE_PATH1) -- cgit v1.2.3