aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-26 15:52:05 -0700
committerRob Landley <rob@landley.net>2019-07-27 16:26:22 -0500
commit0f64560002b885fca7e04544ece3504e92dc29ae (patch)
tree364fcf92b54c3794897813e22a9b6fa17b9560f1
parente439a16c086ad3d6eb215daebf6eec76f90638e0 (diff)
downloadtoybox-0f64560002b885fca7e04544ece3504e92dc29ae.tar.gz
modinfo.test: bail out early if there are no modules.
We need /proc/modules *and* a directory of modules.
-rw-r--r--tests/modinfo.test14
1 files changed, 9 insertions, 5 deletions
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)