]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/rc: support compressed module files
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 12 Sep 2022 05:46:00 +0000 (14:46 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 20 Sep 2022 08:03:43 +0000 (17:03 +0900)
The commit 8017ea524367 ("common/rc: ensure modules are loadable in
_have_modules()") introduced a helper function _module_file_exists()
which assumes module files have extension ".ko". However, the assumption
is not true when module files are compressed. In this case, extensions
of modules files have abbreviations of compression algorithm such as
".ko.xz",".ko.gz" or ".ko.zstd". This results in module file existence
check failure and unexpected test skips.

Fix this by changing module file search condition to cover module file
extensions with the compression algorithm abbreviations.

Fixes: 8017ea524367 ("common/rc: ensure modules are loadable in _have_modules()")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://github.com/osandov/blktests/issues/101
common/rc

index a764b57d7deb86d76cfb23db78977a47da632ded..e49004192217aac8709291833b12e6d0512b7379 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -36,8 +36,8 @@ _module_file_exists()
        local -i count
 
        libpath="/lib/modules/$(uname -r)/kernel"
-       count=$(find "$libpath" -name "$ko_underscore" -o \
-                    -name "$ko_hyphen" | wc -l)
+       count=$(find "$libpath" -name "$ko_underscore*" -o \
+                    -name "$ko_hyphen*" | wc -l)
        ((count)) && return 0
        return 1
 }