Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1670261 > unrolled thread

[PATCH v3] selftests: lib: Skip tests on missing test modules

Started bySumit Semwal <sumit.semwal@linaro.org>
First post2017-06-20 06:50 +0200
Last post2017-06-23 18:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] selftests: lib: Skip tests on missing test modules Sumit Semwal <sumit.semwal@linaro.org> - 2017-06-20 06:50 +0200
    Re: [PATCH v3] selftests: lib: Skip tests on missing test modules Shuah Khan <shuah@kernel.org> - 2017-06-23 18:20 +0200

#1670261 — [PATCH v3] selftests: lib: Skip tests on missing test modules

FromSumit Semwal <sumit.semwal@linaro.org>
Date2017-06-20 06:50 +0200
Subject[PATCH v3] selftests: lib: Skip tests on missing test modules
Message-ID<tUjgZ-3VF-9@gated-at.bofh.it>
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.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
---
 tools/testing/selftests/lib/bitmap.sh | 4 ++++
 tools/testing/selftests/lib/printf.sh | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh
index 2da187b6ddad..b073c22a3435 100755
--- a/tools/testing/selftests/lib/bitmap.sh
+++ b/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
diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh
index 4fdc70fe6980..cbf3b124bd94 100755
--- a/tools/testing/selftests/lib/printf.sh
+++ b/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
-- 
2.7.4

[toc] | [next] | [standalone]


#1673664

FromShuah Khan <shuah@kernel.org>
Date2017-06-23 18:20 +0200
Message-ID<tVzto-4pX-15@gated-at.bofh.it>
In reply to#1670261
Hi Sumit,

On 06/19/2017 10:48 PM, Sumit Semwal wrote:
> 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.
---------------------------------------------------------------------------

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.

> 
> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>

Applied to linux-ksefltest next for 4.13-rc1

thanks,
-- Shuah

> ---
>  tools/testing/selftests/lib/bitmap.sh | 4 ++++
>  tools/testing/selftests/lib/printf.sh | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh
> index 2da187b6ddad..b073c22a3435 100755
> --- a/tools/testing/selftests/lib/bitmap.sh
> +++ b/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
> diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh
> index 4fdc70fe6980..cbf3b124bd94 100755
> --- a/tools/testing/selftests/lib/printf.sh
> +++ b/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
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web