selftests: lib: Skip tests on missing test modules
PATCH 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.
Add the skip portion on missing the respective test_XXX module. Error out the same way as prime_numbers.sh.
--- tools/testing/selftests/lib/bitmap.sh | 5 +++++ tools/testing/selftests/lib/printf.sh | 5 +++++ 2 files changed, 10 insertions(+)
tools/testing/selftests/lib/bitmap.sh +5 -0
@@ -1,6 +1,11 @@ #!/bin/sh # Runs bitmap infrastructure tests using test_bitmap kernel module +if ! /sbin/modprobe -q test_bitmap; then + echo "bitmap: [SKIP]" + exit 77 +fi + if /sbin/modprobe -q test_bitmap; then /sbin/modprobe -q -r test_bitmap echo "bitmap: ok"
tools/testing/selftests/lib/printf.sh +5 -0
@@ -1,6 +1,11 @@ #!/bin/sh # Runs printf infrastructure using test_printf kernel module +if ! /sbin/modprobe -q test_printf; then + echo "printf: [SKIP]" + exit 77 +fi + if /sbin/modprobe -q test_printf; then /sbin/modprobe -q -r test_printf echo "printf: ok"
Signature · 1 line
2.7.4
Shuah Khan
maintainerHi Sumit,
Quoted 17 lines · Sumit Semwal
With older kernels,
printf.shandbitmap.shfail because they can't find the respective test modules they are looking for.Add the skip portion on missing the respective
test_XXXmodule. Error out the same way asprime_numbers.sh.Signed-off-by Sumit Semwal <[email protected]>--- tools/testing/selftests/lib/bitmap.sh | 5 +++++ tools/testing/selftests/lib/printf.sh | 5 +++++ 2 files changed, 10 insertions(+)tools/testing/selftests/lib/bitmap.sh +0
-0
tools/testing/selftests/lib/bitmap.sh line 7
Quoted 7 lines
tools/testing/selftests/lib/bitmap.sh +4
-0@@ -1,6 +1,11 @@ #!/bin/sh # Runs bitmap infrastructure tests using test_bitmap kernel module +if ! /sbin/modprobe -q test_bitmap; then + echo "bitmap: [SKIP]" + exit 77 +fi
Please add this logic below in the else clause instead of adding duplicate block.
I think it is would be good to differentiate when a modules isn't present vs. modprobe failed keying off of
"Module test_printf not found" message.
The second one can be separate patch.
Quoted 9 lines
tools/testing/selftests/lib/bitmap.sh +1
-0+ if /sbin/modprobe -q test_bitmap; then /sbin/modprobe -q -r test_bitmap echo "bitmap: ok"tools/testing/selftests/lib/printf.sh +0
-0
tools/testing/selftests/lib/printf.sh line 7
Quoted 7 lines
tools/testing/selftests/lib/printf.sh +4
-0@@ -1,6 +1,11 @@ #!/bin/sh # Runs printf infrastructure using test_printf kernel module +if ! /sbin/modprobe -q test_printf; then + echo "printf: [SKIP]" + exit 77 +fi
Please add this logic below in the else clause instead of adding duplicate block.
I think it is would be good to differentiate when a modules isn't present vs. modprobe failed keying off of
"Module test_printf not found" message.
The second one can be separate patch.
tools/testing/selftests/lib/printf.sh line 11
Quoted 5 lines
tools/testing/selftests/lib/printf.sh +1
-0+ if /sbin/modprobe -q test_printf; then /sbin/modprobe -q -r test_printf echo "printf: ok"
thanks,
-- Shuah
Shuah Khan
maintainerQuoted 31 lines · Shuah Khan
Hi Sumit,
Quoted 17 lines · Sumit Semwal
With older kernels,
printf.shandbitmap.shfail because they can't find the respective test modules they are looking for.Add the skip portion on missing the respective
test_XXXmodule. Error out the same way asprime_numbers.sh.Signed-off-by Sumit Semwal <[email protected]>--- tools/testing/selftests/lib/bitmap.sh | 5 +++++ tools/testing/selftests/lib/printf.sh | 5 +++++ 2 files changed, 10 insertions(+)tools/testing/selftests/lib/bitmap.sh +0
-0tools/testing/selftests/lib/bitmap.sh line 7
Quoted 7 lines
tools/testing/selftests/lib/bitmap.sh +4
-0@@ -1,6 +1,11 @@ #!/bin/sh # Runs bitmap infrastructure tests using test_bitmap kernel module +if ! /sbin/modprobe -q test_bitmap; then + echo "bitmap: [SKIP]" + exit 77 +fiPlease add this logic below in the else clause instead of adding duplicate block.
Quoted 6 lines
I think it is would be good to differentiate when a modules isn't present vs. modprobe failed keying off of
"Module
test_printfnot found" message.The second one can be separate patch.
Please make the change to detect module not present vs. module failed load in the same patch. Thinking about more, this change will always report SKIP which is worse than what we had before that it always reports FAIL.
The reason being, reporting SKIP when module is present and failed load due to some error is worse than reporting FAIL when module isn't present.
Quoted 21 lines
Quoted 10 lines
tools/testing/selftests/lib/bitmap.sh +1
-0+ if /sbin/modprobe -q test_bitmap; then /sbin/modprobe -q -r test_bitmap echo "bitmap: ok"tools/testing/selftests/lib/printf.sh +0
-0tools/testing/selftests/lib/printf.sh line 7
Quoted 7 lines
tools/testing/selftests/lib/printf.sh +4
-0@@ -1,6 +1,11 @@ #!/bin/sh # Runs printf infrastructure using test_printf kernel module +if ! /sbin/modprobe -q test_printf; then + echo "printf: [SKIP]" + exit 77 +fiPlease add this logic below in the else clause instead of adding duplicate block.
Quoted 6 lines
I think it is would be good to differentiate when a modules isn't present vs. modprobe failed keying off of
"Module
test_printfnot found" message.The second one can be separate patch.
Same commnet as above.
Quoted 11 lines
tools/testing/selftests/lib/printf.sh line 11
Quoted 6 lines
tools/testing/selftests/lib/printf.sh +1
-0+ if /sbin/modprobe -q test_printf; then /sbin/modprobe -q -r test_printf echo "printf: ok"thanks,
-- Shuah
thanks,
-- Shuah