We need /proc/modules *and* a directory of modules.
---
tests/modinfo.test | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
From e8733953992d7f9b3574564bd4b1979ec2906755 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Fri, 26 Jul 2019 15:52:05 -0700
Subject: [PATCH] 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(-)
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)
--
2.22.0.709.g102302147b-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net