* [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module
@ 2022-09-05 7:22 Yauheni Kaliuta
2022-09-06 16:51 ` Song Liu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Yauheni Kaliuta @ 2022-09-05 7:22 UTC (permalink / raw)
To: bpf; +Cc: andrii, alexei.starovoitov, daniel, Yauheni Kaliuta
It's possible to specify particular tests for test_bpf.ko with
module parameters. Make it possible to pass a module parameter as
the first test_kmod.sh argument, example:
test_kmod.sh test_range=1,3
Since magnitude tests take long time it can be reasonable to skip
them.
Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
---
tools/testing/selftests/bpf/test_kmod.sh | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index 4f6444bcd53f..3cb52ba20db8 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -4,6 +4,8 @@
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
+MOD_PARAM="$1"
+
msg="skip all tests:"
if [ "$(id -u)" != "0" ]; then
echo $msg please run this as root >&2
@@ -26,15 +28,15 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
- insmod ${OUTPUT}/lib/test_bpf.ko 2> /dev/null
+ insmod ${OUTPUT}/lib/test_bpf.ko $MOD_PARAM 2> /dev/null
if [ $? -ne 0 ]; then
rc=1
fi
else
# Use modprobe dry run to check for missing test_bpf module
- if ! /sbin/modprobe -q -n test_bpf; then
+ if ! /sbin/modprobe -q -n test_bpf $MOD_PARAM; then
echo "test_bpf: [SKIP]"
- elif /sbin/modprobe -q test_bpf; then
+ elif /sbin/modprobe -q test_bpf $MOD_PARAM; then
echo "test_bpf: ok"
else
echo "test_bpf: [FAIL]"
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module
2022-09-05 7:22 [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module Yauheni Kaliuta
@ 2022-09-06 16:51 ` Song Liu
2022-09-08 11:44 ` [PATCH bpf-next v2] selftests: bpf: test_kmod.sh: pass parameters " Yauheni Kaliuta
2022-09-08 12:01 ` [PATCH bpf-next v3] " Yauheni Kaliuta
2 siblings, 0 replies; 5+ messages in thread
From: Song Liu @ 2022-09-06 16:51 UTC (permalink / raw)
To: Yauheni Kaliuta; +Cc: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann
On Mon, Sep 5, 2022 at 12:25 AM Yauheni Kaliuta <ykaliuta@redhat.com> wrote:
>
> It's possible to specify particular tests for test_bpf.ko with
> module parameters. Make it possible to pass a module parameter as
> the first test_kmod.sh argument, example:
>
> test_kmod.sh test_range=1,3
>
> Since magnitude tests take long time it can be reasonable to skip
> them.
>
> Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
> ---
> tools/testing/selftests/bpf/test_kmod.sh | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
> index 4f6444bcd53f..3cb52ba20db8 100755
> --- a/tools/testing/selftests/bpf/test_kmod.sh
> +++ b/tools/testing/selftests/bpf/test_kmod.sh
> @@ -4,6 +4,8 @@
> # Kselftest framework requirement - SKIP code is 4.
> ksft_skip=4
>
> +MOD_PARAM="$1"
Shall we use $@ to pass all remaining arguments to insmod/modprobe?
Otherwise, users may get confused when some parameters don't get
passed.
We should also add a help/usage message or at least a comment in the
script.
Thanks,
Song
> +
> msg="skip all tests:"
> if [ "$(id -u)" != "0" ]; then
> echo $msg please run this as root >&2
> @@ -26,15 +28,15 @@ test_run()
> echo "[ JIT enabled:$1 hardened:$2 ]"
> dmesg -C
> if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
> - insmod ${OUTPUT}/lib/test_bpf.ko 2> /dev/null
> + insmod ${OUTPUT}/lib/test_bpf.ko $MOD_PARAM 2> /dev/null
> if [ $? -ne 0 ]; then
> rc=1
> fi
> else
> # Use modprobe dry run to check for missing test_bpf module
> - if ! /sbin/modprobe -q -n test_bpf; then
> + if ! /sbin/modprobe -q -n test_bpf $MOD_PARAM; then
> echo "test_bpf: [SKIP]"
> - elif /sbin/modprobe -q test_bpf; then
> + elif /sbin/modprobe -q test_bpf $MOD_PARAM; then
> echo "test_bpf: ok"
> else
> echo "test_bpf: [FAIL]"
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bpf-next v2] selftests: bpf: test_kmod.sh: pass parameters to the module
2022-09-05 7:22 [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module Yauheni Kaliuta
2022-09-06 16:51 ` Song Liu
@ 2022-09-08 11:44 ` Yauheni Kaliuta
2022-09-08 12:01 ` [PATCH bpf-next v3] " Yauheni Kaliuta
2 siblings, 0 replies; 5+ messages in thread
From: Yauheni Kaliuta @ 2022-09-08 11:44 UTC (permalink / raw)
To: bpf; +Cc: andrii, alexei.starovoitov, daniel, song, Yauheni Kaliuta
It's possible to specify particular tests for test_bpf.ko with
module parameters. Make it possible to pass the module parameters,
example:
test_kmod.sh test_range=1,3
Since magnitude tests take long time it can be reasonable to skip
them.
Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
---
v1->v2: pass all the parameters, "$@", not only the first one.
---
tools/testing/selftests/bpf/test_kmod.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index 4f6444bcd53f..6550d523b04a 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -26,15 +26,15 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
- insmod ${OUTPUT}/lib/test_bpf.ko 2> /dev/null
+ insmod ${OUTPUT}/lib/test_bpf.ko "$@" 2> /dev/null
if [ $? -ne 0 ]; then
rc=1
fi
else
# Use modprobe dry run to check for missing test_bpf module
- if ! /sbin/modprobe -q -n test_bpf; then
+ if ! /sbin/modprobe -q -n test_bpf "$@"; then
echo "test_bpf: [SKIP]"
- elif /sbin/modprobe -q test_bpf; then
+ elif /sbin/modprobe -q test_bpf "$@"; then
echo "test_bpf: ok"
else
echo "test_bpf: [FAIL]"
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH bpf-next v3] selftests: bpf: test_kmod.sh: pass parameters to the module
2022-09-05 7:22 [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module Yauheni Kaliuta
2022-09-06 16:51 ` Song Liu
2022-09-08 11:44 ` [PATCH bpf-next v2] selftests: bpf: test_kmod.sh: pass parameters " Yauheni Kaliuta
@ 2022-09-08 12:01 ` Yauheni Kaliuta
2022-09-22 0:20 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Yauheni Kaliuta @ 2022-09-08 12:01 UTC (permalink / raw)
To: bpf; +Cc: andrii, alexei.starovoitov, daniel, song, Yauheni Kaliuta
It's possible to specify particular tests for test_bpf.ko with
module parameters. Make it possible to pass the module parameters,
example:
test_kmod.sh test_range=1,3
Since magnitude tests take long time it can be reasonable to skip
them.
Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
---
v2->v3: add usage comment.
v1->v2: pass all the parameters, "$@", not only the first one.
---
tools/testing/selftests/bpf/test_kmod.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index 4f6444bcd53f..d4a4279c0181 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,6 +1,11 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
+# Usage:
+# ./test_kmod.sh [module_param]...
+# Ex.: ./test_kmod.sh test_range=1,3
+# All the parameters are passed to the kernel module.
+
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
@@ -26,15 +31,15 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
- insmod ${OUTPUT}/lib/test_bpf.ko 2> /dev/null
+ insmod ${OUTPUT}/lib/test_bpf.ko "$@" 2> /dev/null
if [ $? -ne 0 ]; then
rc=1
fi
else
# Use modprobe dry run to check for missing test_bpf module
- if ! /sbin/modprobe -q -n test_bpf; then
+ if ! /sbin/modprobe -q -n test_bpf "$@"; then
echo "test_bpf: [SKIP]"
- elif /sbin/modprobe -q test_bpf; then
+ elif /sbin/modprobe -q test_bpf "$@"; then
echo "test_bpf: ok"
else
echo "test_bpf: [FAIL]"
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v3] selftests: bpf: test_kmod.sh: pass parameters to the module
2022-09-08 12:01 ` [PATCH bpf-next v3] " Yauheni Kaliuta
@ 2022-09-22 0:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-22 0:20 UTC (permalink / raw)
To: Yauheni Kaliuta; +Cc: bpf, andrii, alexei.starovoitov, daniel, song
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Thu, 8 Sep 2022 15:01:46 +0300 you wrote:
> It's possible to specify particular tests for test_bpf.ko with
> module parameters. Make it possible to pass the module parameters,
> example:
>
> test_kmod.sh test_range=1,3
>
> Since magnitude tests take long time it can be reasonable to skip
> them.
>
> [...]
Here is the summary with links:
- [bpf-next,v3] selftests: bpf: test_kmod.sh: pass parameters to the module
https://git.kernel.org/bpf/bpf-next/c/272d1f4cfa3c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-22 0:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 7:22 [PATCH bpf-next] selftests: bpf: test_kmod.sh: pass parameter to the module Yauheni Kaliuta
2022-09-06 16:51 ` Song Liu
2022-09-08 11:44 ` [PATCH bpf-next v2] selftests: bpf: test_kmod.sh: pass parameters " Yauheni Kaliuta
2022-09-08 12:01 ` [PATCH bpf-next v3] " Yauheni Kaliuta
2022-09-22 0:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.