* [PATCH v2 1/2] selftests: lib: Skip tests on missing test modules
@ 2017-06-19 13:44 Sumit Semwal
2017-06-19 18:51 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Sumit Semwal @ 2017-06-19 13:44 UTC (permalink / raw)
To: shuah, linux-kselftest; +Cc: keescook, decot, linux-kernel, 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
with the same error code as prime_numbers.sh.
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 | 6 ++++++
tools/testing/selftests/lib/printf.sh | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh
index 2da187b6ddad..b893046d511f 100755
--- a/tools/testing/selftests/lib/bitmap.sh
+++ b/tools/testing/selftests/lib/bitmap.sh
@@ -1,6 +1,12 @@
#!/bin/sh
# Runs bitmap infrastructure tests using test_bitmap kernel module
+if ! find /lib/modules/$(uname -r) -type f -name test_bitmap.ko | grep -q .;
+then
+ echo "bitmap: test_bitmap.ko not found [SKIP]"
+ exit 77
+fi
+
if /sbin/modprobe -q test_bitmap; then
/sbin/modprobe -q -r test_bitmap
echo "bitmap: ok"
diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh
index 4fdc70fe6980..804b7e75acc0 100755
--- a/tools/testing/selftests/lib/printf.sh
+++ b/tools/testing/selftests/lib/printf.sh
@@ -1,6 +1,12 @@
#!/bin/sh
# Runs printf infrastructure using test_printf kernel module
+if ! find /lib/modules/$(uname -r) -type f -name test_printf.ko | grep -q .;
+then
+ echo "printf: test_printf.ko not found [SKIP]"
+ exit 77
+fi
+
if /sbin/modprobe -q test_printf; then
/sbin/modprobe -q -r test_printf
echo "printf: ok"
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] selftests: lib: Skip tests on missing test modules
2017-06-19 13:44 [PATCH v2 1/2] selftests: lib: Skip tests on missing test modules Sumit Semwal
@ 2017-06-19 18:51 ` Kees Cook
2017-06-20 3:24 ` Sumit Semwal
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2017-06-19 18:51 UTC (permalink / raw)
To: Sumit Semwal; +Cc: Shuah Khan, linux-kselftest, decot, LKML
On Mon, Jun 19, 2017 at 6:44 AM, Sumit Semwal <sumit.semwal@linaro.org> wrote:
> 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
> with the same error code as prime_numbers.sh.
>
> 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 | 6 ++++++
> tools/testing/selftests/lib/printf.sh | 6 ++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh
> index 2da187b6ddad..b893046d511f 100755
> --- a/tools/testing/selftests/lib/bitmap.sh
> +++ b/tools/testing/selftests/lib/bitmap.sh
> @@ -1,6 +1,12 @@
> #!/bin/sh
> # Runs bitmap infrastructure tests using test_bitmap kernel module
>
> +if ! find /lib/modules/$(uname -r) -type f -name test_bitmap.ko | grep -q .;
> +then
> + echo "bitmap: test_bitmap.ko not found [SKIP]"
> + exit 77
> +fi
> +
> if /sbin/modprobe -q test_bitmap; then
> /sbin/modprobe -q -r test_bitmap
> echo "bitmap: ok"
> diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh
> index 4fdc70fe6980..804b7e75acc0 100755
> --- a/tools/testing/selftests/lib/printf.sh
> +++ b/tools/testing/selftests/lib/printf.sh
> @@ -1,6 +1,12 @@
> #!/bin/sh
> # Runs printf infrastructure using test_printf kernel module
>
> +if ! find /lib/modules/$(uname -r) -type f -name test_printf.ko | grep -q .;
> +then
> + echo "printf: test_printf.ko not found [SKIP]"
> + exit 77
> +fi
> +
> if /sbin/modprobe -q test_printf; then
> /sbin/modprobe -q -r test_printf
> echo "printf: ok"
This doesn't seem right to me. Can't these be built-ins too?
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] selftests: lib: Skip tests on missing test modules
2017-06-19 18:51 ` Kees Cook
@ 2017-06-20 3:24 ` Sumit Semwal
0 siblings, 0 replies; 3+ messages in thread
From: Sumit Semwal @ 2017-06-20 3:24 UTC (permalink / raw)
To: Kees Cook; +Cc: Shuah Khan, linux-kselftest, David Decotigny, LKML
Hi Kees,
On 20 June 2017 at 00:21, Kees Cook <keescook@chromium.org> wrote:
> On Mon, Jun 19, 2017 at 6:44 AM, Sumit Semwal <sumit.semwal@linaro.org> wrote:
>> 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
>> with the same error code as prime_numbers.sh.
>>
>> 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 | 6 ++++++
>> tools/testing/selftests/lib/printf.sh | 6 ++++++
>> 2 files changed, 12 insertions(+)
>>
>> diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh
>> index 2da187b6ddad..b893046d511f 100755
>> --- a/tools/testing/selftests/lib/bitmap.sh
>> +++ b/tools/testing/selftests/lib/bitmap.sh
>> @@ -1,6 +1,12 @@
>> #!/bin/sh
>> # Runs bitmap infrastructure tests using test_bitmap kernel module
>>
>> +if ! find /lib/modules/$(uname -r) -type f -name test_bitmap.ko | grep -q .;
>> +then
>> + echo "bitmap: test_bitmap.ko not found [SKIP]"
>> + exit 77
>> +fi
>> +
>> if /sbin/modprobe -q test_bitmap; then
>> /sbin/modprobe -q -r test_bitmap
>> echo "bitmap: ok"
>> diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh
>> index 4fdc70fe6980..804b7e75acc0 100755
>> --- a/tools/testing/selftests/lib/printf.sh
>> +++ b/tools/testing/selftests/lib/printf.sh
>> @@ -1,6 +1,12 @@
>> #!/bin/sh
>> # Runs printf infrastructure using test_printf kernel module
>>
>> +if ! find /lib/modules/$(uname -r) -type f -name test_printf.ko | grep -q .;
>> +then
>> + echo "printf: test_printf.ko not found [SKIP]"
>> + exit 77
>> +fi
>> +
>> if /sbin/modprobe -q test_printf; then
>> /sbin/modprobe -q -r test_printf
>> echo "printf: ok"
>
> This doesn't seem right to me. Can't these be built-ins too?
>
Yes, it can be. I'm running test right now to check presence of module
with -q -n; that should take care of builtin as well. will send an
updated patch soon.
> -Kees
>
> --
> Kees Cook
> Pixel Security
Best,
Sumit.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-20 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 13:44 [PATCH v2 1/2] selftests: lib: Skip tests on missing test modules Sumit Semwal
2017-06-19 18:51 ` Kees Cook
2017-06-20 3:24 ` Sumit Semwal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).