Skip to contentSkip to conversation

selftests: lib: Skip tests on missing test modules

PATCH Superseded Sumit Semwal 2 participants 3 messages Jun 16, 2017 Kselftest

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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
index 2da187b6ddad..85294b4a0861 100755
@@ -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
index 4fdc70fe6980..024e749a83d4 100755
@@ -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
maintainer
#1 lore raw

Hi Sumit,

Quoted 17 lines · Sumit Semwal

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 +0 -0
index 2da187b6ddad..85294b4a0861 100755

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
index 4fdc70fe6980..024e749a83d4 100755

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

maintainer
#2 lore raw
Quoted 31 lines · Shuah Khan

Hi Sumit,

Quoted 17 lines · Sumit Semwal

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 +0 -0
index 2da187b6ddad..85294b4a0861 100755

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.

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_printf not 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 -0
index 4fdc70fe6980..024e749a83d4 100755

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.

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_printf not 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