* [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-06 21:07 ` naresh.kamboju
0 siblings, 0 replies; 9+ messages in thread
From: Naresh Kamboju @ 2018-02-06 21:07 UTC (permalink / raw)
To: shuahkh, linux-kselftest; +Cc: shuah, daniel, netdev, alexei.starovoitov, ast
test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.
Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
"modprobe test_bpf"
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
---
tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..54177b1 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,8 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
-SRC_TREE=../../../../
-
test_run()
{
sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
@@ -10,8 +8,13 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
- insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
- if [ $? -ne 0 ]; then
+ # Use modprobe dry run to check for missing test_bpf module
+ if ! /sbin/modprobe -q -n test_bpf; then
+ echo "test_bpf: [SKIP]"
+ elif /sbin/modprobe -q test_bpf; then
+ echo "test_bpf: ok"
+ else
+ echo "test_bpf: [FAIL]"
rc=1
fi
rmmod test_bpf 2> /dev/null
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-06 21:07 ` naresh.kamboju
0 siblings, 0 replies; 9+ messages in thread
From: naresh.kamboju @ 2018-02-06 21:07 UTC (permalink / raw)
test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.
Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
"modprobe test_bpf"
Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
---
tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..54177b1 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,8 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
-SRC_TREE=../../../../
-
test_run()
{
sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
@@ -10,8 +8,13 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
- insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
- if [ $? -ne 0 ]; then
+ # Use modprobe dry run to check for missing test_bpf module
+ if ! /sbin/modprobe -q -n test_bpf; then
+ echo "test_bpf: [SKIP]"
+ elif /sbin/modprobe -q test_bpf; then
+ echo "test_bpf: ok"
+ else
+ echo "test_bpf: [FAIL]"
rc=1
fi
rmmod test_bpf 2> /dev/null
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-06 21:07 ` naresh.kamboju
0 siblings, 0 replies; 9+ messages in thread
From: Naresh Kamboju @ 2018-02-06 21:07 UTC (permalink / raw)
test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.
Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
"modprobe test_bpf"
Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
---
tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..54177b1 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,8 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
-SRC_TREE=../../../../
-
test_run()
{
sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
@@ -10,8 +8,13 @@ test_run()
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
- insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
- if [ $? -ne 0 ]; then
+ # Use modprobe dry run to check for missing test_bpf module
+ if ! /sbin/modprobe -q -n test_bpf; then
+ echo "test_bpf: [SKIP]"
+ elif /sbin/modprobe -q test_bpf; then
+ echo "test_bpf: ok"
+ else
+ echo "test_bpf: [FAIL]"
rc=1
fi
rmmod test_bpf 2> /dev/null
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
2018-02-06 21:07 ` naresh.kamboju
(?)
@ 2018-02-07 13:32 ` daniel
-1 siblings, 0 replies; 9+ messages in thread
From: Daniel Borkmann @ 2018-02-07 13:32 UTC (permalink / raw)
To: Naresh Kamboju, shuahkh, linux-kselftest
Cc: shuah, netdev, alexei.starovoitov, ast
Hi Naresh,
On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
> test_kmod.sh reported false failure when module not present.
> Check test_bpf.ko is present in the path before loading it.
>
> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
> "modprobe test_bpf"
>
> Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Thanks for looking into this! Could we have a way to be able to
support both? Say, when test_bpf.ko from SRC_TREE is not present,
we try with modprobe -q fallback? I would still like to support
the case where you can make local changes and add new tests to
test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
having to install it first.
Thanks,
Daniel
> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
> index ed4774d..54177b1 100755
> --- a/tools/testing/selftests/bpf/test_kmod.sh
> +++ b/tools/testing/selftests/bpf/test_kmod.sh
> @@ -1,8 +1,6 @@
> #!/bin/sh
> # SPDX-License-Identifier: GPL-2.0
>
> -SRC_TREE=../../../../
> -
> test_run()
> {
> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
> @@ -10,8 +8,13 @@ test_run()
>
> echo "[ JIT enabled:$1 hardened:$2 ]"
> dmesg -C
> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
> - if [ $? -ne 0 ]; then
> + # Use modprobe dry run to check for missing test_bpf module
> + if ! /sbin/modprobe -q -n test_bpf; then
> + echo "test_bpf: [SKIP]"
> + elif /sbin/modprobe -q test_bpf; then
> + echo "test_bpf: ok"
> + else
> + echo "test_bpf: [FAIL]"
> rc=1
> fi
> rmmod test_bpf 2> /dev/null
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-07 13:32 ` daniel
0 siblings, 0 replies; 9+ messages in thread
From: daniel @ 2018-02-07 13:32 UTC (permalink / raw)
Hi Naresh,
On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
> test_kmod.sh reported false failure when module not present.
> Check test_bpf.ko is present in the path before loading it.
>
> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
> "modprobe test_bpf"
>
> Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
Thanks for looking into this! Could we have a way to be able to
support both? Say, when test_bpf.ko from SRC_TREE is not present,
we try with modprobe -q fallback? I would still like to support
the case where you can make local changes and add new tests to
test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
having to install it first.
Thanks,
Daniel
> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
> index ed4774d..54177b1 100755
> --- a/tools/testing/selftests/bpf/test_kmod.sh
> +++ b/tools/testing/selftests/bpf/test_kmod.sh
> @@ -1,8 +1,6 @@
> #!/bin/sh
> # SPDX-License-Identifier: GPL-2.0
>
> -SRC_TREE=../../../../
> -
> test_run()
> {
> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
> @@ -10,8 +8,13 @@ test_run()
>
> echo "[ JIT enabled:$1 hardened:$2 ]"
> dmesg -C
> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
> - if [ $? -ne 0 ]; then
> + # Use modprobe dry run to check for missing test_bpf module
> + if ! /sbin/modprobe -q -n test_bpf; then
> + echo "test_bpf: [SKIP]"
> + elif /sbin/modprobe -q test_bpf; then
> + echo "test_bpf: ok"
> + else
> + echo "test_bpf: [FAIL]"
> rc=1
> fi
> rmmod test_bpf 2> /dev/null
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-07 13:32 ` daniel
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Borkmann @ 2018-02-07 13:32 UTC (permalink / raw)
Hi Naresh,
On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
> test_kmod.sh reported false failure when module not present.
> Check test_bpf.ko is present in the path before loading it.
>
> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
> "modprobe test_bpf"
>
> Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
Thanks for looking into this! Could we have a way to be able to
support both? Say, when test_bpf.ko from SRC_TREE is not present,
we try with modprobe -q fallback? I would still like to support
the case where you can make local changes and add new tests to
test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
having to install it first.
Thanks,
Daniel
> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
> index ed4774d..54177b1 100755
> --- a/tools/testing/selftests/bpf/test_kmod.sh
> +++ b/tools/testing/selftests/bpf/test_kmod.sh
> @@ -1,8 +1,6 @@
> #!/bin/sh
> # SPDX-License-Identifier: GPL-2.0
>
> -SRC_TREE=../../../../
> -
> test_run()
> {
> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
> @@ -10,8 +8,13 @@ test_run()
>
> echo "[ JIT enabled:$1 hardened:$2 ]"
> dmesg -C
> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
> - if [ $? -ne 0 ]; then
> + # Use modprobe dry run to check for missing test_bpf module
> + if ! /sbin/modprobe -q -n test_bpf; then
> + echo "test_bpf: [SKIP]"
> + elif /sbin/modprobe -q test_bpf; then
> + echo "test_bpf: ok"
> + else
> + echo "test_bpf: [FAIL]"
> rc=1
> fi
> rmmod test_bpf 2> /dev/null
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
2018-02-07 13:32 ` daniel
(?)
@ 2018-02-07 18:17 ` naresh.kamboju
-1 siblings, 0 replies; 9+ messages in thread
From: Naresh Kamboju @ 2018-02-07 18:17 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Shuah Khan, linux-kselftest, Shuah Khan, netdev, alexei.starovoitov, ast
Hi Daniel,
On 7 February 2018 at 19:02, Daniel Borkmann <daniel@iogearbox.net> wrote:
> Hi Naresh,
>
> On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
>> test_kmod.sh reported false failure when module not present.
>> Check test_bpf.ko is present in the path before loading it.
>>
>> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
>> "modprobe test_bpf"
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
>
> Thanks for looking into this! Could we have a way to be able to
> support both? Say, when test_bpf.ko from SRC_TREE is not present,
> we try with modprobe -q fallback? I would still like to support
> the case where you can make local changes and add new tests to
> test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
> having to install it first.
Thanks for the review comments.
I have sent patch v2 with your comments addressed.
- Naresh
>
> Thanks,
> Daniel
>
>> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
>> index ed4774d..54177b1 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -1,8 +1,6 @@
>> #!/bin/sh
>> # SPDX-License-Identifier: GPL-2.0
>>
>> -SRC_TREE=../../../../
>> -
>> test_run()
>> {
>> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
>> @@ -10,8 +8,13 @@ test_run()
>>
>> echo "[ JIT enabled:$1 hardened:$2 ]"
>> dmesg -C
>> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> - if [ $? -ne 0 ]; then
>> + # Use modprobe dry run to check for missing test_bpf module
>> + if ! /sbin/modprobe -q -n test_bpf; then
>> + echo "test_bpf: [SKIP]"
>> + elif /sbin/modprobe -q test_bpf; then
>> + echo "test_bpf: ok"
>> + else
>> + echo "test_bpf: [FAIL]"
>> rc=1
>> fi
>> rmmod test_bpf 2> /dev/null
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-07 18:17 ` naresh.kamboju
0 siblings, 0 replies; 9+ messages in thread
From: naresh.kamboju @ 2018-02-07 18:17 UTC (permalink / raw)
Hi Daniel,
On 7 February 2018 at 19:02, Daniel Borkmann <daniel at iogearbox.net> wrote:
> Hi Naresh,
>
> On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
>> test_kmod.sh reported false failure when module not present.
>> Check test_bpf.ko is present in the path before loading it.
>>
>> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
>> "modprobe test_bpf"
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
>
> Thanks for looking into this! Could we have a way to be able to
> support both? Say, when test_bpf.ko from SRC_TREE is not present,
> we try with modprobe -q fallback? I would still like to support
> the case where you can make local changes and add new tests to
> test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
> having to install it first.
Thanks for the review comments.
I have sent patch v2 with your comments addressed.
- Naresh
>
> Thanks,
> Daniel
>
>> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
>> index ed4774d..54177b1 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -1,8 +1,6 @@
>> #!/bin/sh
>> # SPDX-License-Identifier: GPL-2.0
>>
>> -SRC_TREE=../../../../
>> -
>> test_run()
>> {
>> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
>> @@ -10,8 +8,13 @@ test_run()
>>
>> echo "[ JIT enabled:$1 hardened:$2 ]"
>> dmesg -C
>> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> - if [ $? -ne 0 ]; then
>> + # Use modprobe dry run to check for missing test_bpf module
>> + if ! /sbin/modprobe -q -n test_bpf; then
>> + echo "test_bpf: [SKIP]"
>> + elif /sbin/modprobe -q test_bpf; then
>> + echo "test_bpf: ok"
>> + else
>> + echo "test_bpf: [FAIL]"
>> rc=1
>> fi
>> rmmod test_bpf 2> /dev/null
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Linux-kselftest-mirror] [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod
@ 2018-02-07 18:17 ` naresh.kamboju
0 siblings, 0 replies; 9+ messages in thread
From: Naresh Kamboju @ 2018-02-07 18:17 UTC (permalink / raw)
Hi Daniel,
On 7 February 2018@19:02, Daniel Borkmann <daniel@iogearbox.net> wrote:
> Hi Naresh,
>
> On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
>> test_kmod.sh reported false failure when module not present.
>> Check test_bpf.ko is present in the path before loading it.
>>
>> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
>> "modprobe test_bpf"
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamboju at linaro.org>
>
> Thanks for looking into this! Could we have a way to be able to
> support both? Say, when test_bpf.ko from SRC_TREE is not present,
> we try with modprobe -q fallback? I would still like to support
> the case where you can make local changes and add new tests to
> test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
> having to install it first.
Thanks for the review comments.
I have sent patch v2 with your comments addressed.
- Naresh
>
> Thanks,
> Daniel
>
>> tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
>> index ed4774d..54177b1 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -1,8 +1,6 @@
>> #!/bin/sh
>> # SPDX-License-Identifier: GPL-2.0
>>
>> -SRC_TREE=../../../../
>> -
>> test_run()
>> {
>> sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
>> @@ -10,8 +8,13 @@ test_run()
>>
>> echo "[ JIT enabled:$1 hardened:$2 ]"
>> dmesg -C
>> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> - if [ $? -ne 0 ]; then
>> + # Use modprobe dry run to check for missing test_bpf module
>> + if ! /sbin/modprobe -q -n test_bpf; then
>> + echo "test_bpf: [SKIP]"
>> + elif /sbin/modprobe -q test_bpf; then
>> + echo "test_bpf: ok"
>> + else
>> + echo "test_bpf: [FAIL]"
>> rc=1
>> fi
>> rmmod test_bpf 2> /dev/null
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-02-07 18:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 21:07 [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod Naresh Kamboju
2018-02-06 21:07 ` [Linux-kselftest-mirror] " Naresh Kamboju
2018-02-06 21:07 ` naresh.kamboju
2018-02-07 13:32 ` Daniel Borkmann
2018-02-07 13:32 ` [Linux-kselftest-mirror] " Daniel Borkmann
2018-02-07 13:32 ` daniel
2018-02-07 18:17 ` Naresh Kamboju
2018-02-07 18:17 ` [Linux-kselftest-mirror] " Naresh Kamboju
2018-02-07 18:17 ` naresh.kamboju
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.