selftests: lib: Skip tests on missing test modules
authorSumit Semwal <sumit.semwal@linaro.org>
Tue, 20 Jun 2017 04:48:18 +0000 (10:18 +0530)
committerShuah Khan <shuahkh@osg.samsung.com>
Fri, 23 Jun 2017 15:41:53 +0000 (09:41 -0600)
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.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/lib/bitmap.sh
tools/testing/selftests/lib/printf.sh

index 2da187b6ddad574374bf46f6ab756b9208e1f297..b073c22a3435a25ab829a9337636f5784174a247 100755 (executable)
@@ -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
index 4fdc70fe6980273f6058b27c6337dcaf187d47cf..cbf3b124bd94a2af428e13be8365ddb2bd709591 100755 (executable)
@@ -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