selftests: lib: Skip tests on missing test modules
PATCH v3 1/1 selftests: lib: Skip tests on missing test modules
With older kernels, printf.sh and bitmap.sh fail because they can't find the respective test modules they are looking for.
Use modprobe dry run to check for missing test_XXX module. Error out with the same error code as prime_numbers.sh.
v3: As pointed out by Kees, modules can be in-built too, so use 'modprobe
-q -n' to check presence of the module, instead of 'find ..'.
v2: Per Shuah's review, search for the module rather than do modprobe.
--- tools/testing/selftests/lib/bitmap.sh | 4 ++++ tools/testing/selftests/lib/printf.sh | 4 ++++ 2 files changed, 8 insertions(+)
tools/testing/selftests/lib/bitmap.sh +4 -0
@@ -1,5 +1,9 @@ #!/bin/sh # Runs bitmap infrastructure tests using test_bitmap kernel module +if ! /sbin/modprobe -q -n test_bitmap; then + echo "bitmap: [SKIP]" + exit 77 +fi if /sbin/modprobe -q test_bitmap; then /sbin/modprobe -q -r test_bitmap
tools/testing/selftests/lib/printf.sh +4 -0
@@ -1,5 +1,9 @@ #!/bin/sh # Runs printf infrastructure using test_printf kernel module +if ! /sbin/modprobe -q -n test_printf; then + echo "printf: [SKIP]" + exit 77 +fi if /sbin/modprobe -q test_printf; then /sbin/modprobe -q -r test_printf
Signature · 1 line
2.7.4
Shuah Khan
maintainerHi Sumit,
Quoted 6 lines · Sumit Semwal
With older kernels,
printf.shandbitmap.shfail because they can't find the respective test modules they are looking for.Use modprobe dry run to check for missing
test_XXXmodule. Error out with the same error code asprime_numbers.sh.
---------------------------------------------------------------------------
Quoted 3 lines
v3: As pointed out by Kees, modules can be in-built too, so use 'modprobe
-q -n' to check presence of the module, instead of 'find ..'.
v2: Per Shuah's review, search for the module rather than do modprobe.
---------------------------------------------------------------------------
Please note that the patch version details don't belong in the commit log. I edited it before applying to linux-kselftest next. Please make sure to add such information in the right place in future patches.
Quoted 2 lines
Signed-off-by Sumit Semwal <[email protected]>
Applied to linux-ksefltest next for 4.13-rc1
thanks,
-- Shuah
Quoted 34 lines
--- tools/testing/selftests/lib/bitmap.sh | 4 ++++ tools/testing/selftests/lib/printf.sh | 4 ++++ 2 files changed, 8 insertions(+)tools/testing/selftests/lib/bitmap.sh +4
-0@@ -1,5 +1,9 @@ #!/bin/sh # Runs bitmap infrastructure tests using test_bitmap kernel module +if ! /sbin/modprobe -q -n test_bitmap; then + echo "bitmap: [SKIP]" + exit 77 +fi if /sbin/modprobe -q test_bitmap; then /sbin/modprobe -q -r test_bitmaptools/testing/selftests/lib/printf.sh +4
-0@@ -1,5 +1,9 @@ #!/bin/sh # Runs printf infrastructure using test_printf kernel module +if ! /sbin/modprobe -q -n test_printf; then + echo "printf: [SKIP]" + exit 77 +fi if /sbin/modprobe -q test_printf; then /sbin/modprobe -q -r test_printf