aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-03-09 22:07:47 -0700
committerRob Landley <rob@landley.net>2020-03-10 09:48:15 -0500
commite6b3ac496f8b72f089247e93e6892bb6fa094976 (patch)
tree6f5751e14011383f2f5e78a92e3f266ed6da6160 /tests
parentbdcb9de92aba82c13554b7d198d3fffabecd976b (diff)
downloadtoybox-e6b3ac496f8b72f089247e93e6892bb6fa094976.tar.gz
modinfo: various fixes.
I came here because the new -Wno-unreachable-code-loop-increment warning didn't like the for loop on line 86. That loop is indeed not necessary. Use strend() to do a string suffix match. Use memmem() to search. It's available on macOS and Android by default, but it's behind _GNU_SOURCE for glibc, so add that to portability.h. Output the tags in the same order as the Debian modinfo. I've left "parmtype" in even though the Debian modinfo doesn't output it at all. Also fix the tests so that they work on a device that has modules for multiple kernels installed (like my laptop) --- make sure that the two modules we pick come from the same kernel.
Diffstat (limited to 'tests')
-rw-r--r--tests/modinfo.test2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/modinfo.test b/tests/modinfo.test
index aaa7a7bd..261acfda 100644
--- a/tests/modinfo.test
+++ b/tests/modinfo.test
@@ -19,7 +19,7 @@ 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)
-MODULE_PATH2=$(find $MODULE_ROOT/lib/modules -name *.ko | tail -1 2>/dev/null)
+MODULE_PATH2=$(find $MODULE_ROOT/lib/modules -name *.ko | head -2 | tail -1 2>/dev/null)
MODULE2=$(basename -s .ko $MODULE_PATH2)
DASH_MODULE=$(basename -s .ko \
$(find $MODULE_ROOT/lib/modules -name *-*.ko | tail -1 2>/dev/null))