浏览代码

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.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Sumit Semwal 8 年之前
父节点
当前提交
e0912c0129
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 4 0
      tools/testing/selftests/lib/bitmap.sh
  2. 4 0
      tools/testing/selftests/lib/printf.sh

+ 4 - 0
tools/testing/selftests/lib/bitmap.sh

@@ -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

+ 4 - 0
tools/testing/selftests/lib/printf.sh

@@ -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