2022-12-30 09:49:46

by Po-Hsu Lin

[permalink] [raw]
Subject: [PATCH 0/2] selftests: net: fix for arp_ndisc_evict_nocarrier test

This patchset will fix a false-positive issue caused by the command in
cleanup_v6() of the arp_ndisc_evict_nocarrier test.

Also, it will make the test to return a non-zero value for any failure
reported in the test for us to avoid false-negative results.

Po-Hsu Lin (2):
selftests: net: fix cleanup_v6() for arp_ndisc_evict_nocarrier
selftests: net: return non-zero for failures reported in
arp_ndisc_evict_nocarrier

tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

--
2.7.4


2022-12-30 09:50:26

by Po-Hsu Lin

[permalink] [raw]
Subject: [PATCH 1/2] selftests: net: fix cleanup_v6() for arp_ndisc_evict_nocarrier

The cleanup_v6() will cause the arp_ndisc_evict_nocarrier script exit
with 255 (No such file or directory), even the tests are good:

# selftests: net: arp_ndisc_evict_nocarrier.sh
# run arp_evict_nocarrier=1 test
# RTNETLINK answers: File exists
# ok
# run arp_evict_nocarrier=0 test
# RTNETLINK answers: File exists
# ok
# run all.arp_evict_nocarrier=0 test
# RTNETLINK answers: File exists
# ok
# run ndisc_evict_nocarrier=1 test
# ok
# run ndisc_evict_nocarrier=0 test
# ok
# run all.ndisc_evict_nocarrier=0 test
# ok
not ok 1 selftests: net: arp_ndisc_evict_nocarrier.sh # exit=255

This is because it's trying to modify the parameter for ipv4 instead.

Also, tests for ipv6 (run_ndisc_evict_nocarrier_enabled() and
run_ndisc_evict_nocarrier_disabled() are working on veth1, reflect
this fact in cleanup_v6().

Fixes: f86ca07eb531 ("selftests: net: add arp_ndisc_evict_nocarrier")
Signed-off-by: Po-Hsu Lin <[email protected]>
---
tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh b/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
index b5af08a..b4ec1ee 100755
--- a/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
+++ b/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
@@ -24,8 +24,8 @@ cleanup_v6()
ip netns del me
ip netns del peer

- sysctl -w net.ipv4.conf.veth0.ndisc_evict_nocarrier=1 >/dev/null 2>&1
- sysctl -w net.ipv4.conf.all.ndisc_evict_nocarrier=1 >/dev/null 2>&1
+ sysctl -w net.ipv6.conf.veth1.ndisc_evict_nocarrier=1 >/dev/null 2>&1
+ sysctl -w net.ipv6.conf.all.ndisc_evict_nocarrier=1 >/dev/null 2>&1
}

create_ns()
--
2.7.4

2022-12-30 10:11:03

by Po-Hsu Lin

[permalink] [raw]
Subject: [PATCH 2/2] selftests: net: return non-zero for failures reported in arp_ndisc_evict_nocarrier

Return non-zero return value if there is any failure reported in this
script during the test. Otherwise it can only reflect the status of
the last command.

Fixes: f86ca07eb531 ("selftests: net: add arp_ndisc_evict_nocarrier")
Signed-off-by: Po-Hsu Lin <[email protected]>
---
tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh b/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
index b4ec1ee..4a110bb 100755
--- a/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
+++ b/tools/testing/selftests/net/arp_ndisc_evict_nocarrier.sh
@@ -18,6 +18,7 @@ readonly V4_ADDR1=10.0.10.2
readonly V6_ADDR0=2001:db8:91::1
readonly V6_ADDR1=2001:db8:91::2
nsid=100
+ret=0

cleanup_v6()
{
@@ -61,7 +62,7 @@ setup_v6() {
if [ $? -ne 0 ]; then
cleanup_v6
echo "failed"
- exit
+ exit 1
fi

# Set veth2 down, which will put veth1 in NOCARRIER state
@@ -88,7 +89,7 @@ setup_v4() {
if [ $? -ne 0 ]; then
cleanup_v4
echo "failed"
- exit
+ exit 1
fi

# Set veth1 down, which will put veth0 in NOCARRIER state
@@ -115,6 +116,7 @@ run_arp_evict_nocarrier_enabled() {

if [ $? -eq 0 ];then
echo "failed"
+ ret=1
else
echo "ok"
fi
@@ -134,6 +136,7 @@ run_arp_evict_nocarrier_disabled() {
echo "ok"
else
echo "failed"
+ ret=1
fi

cleanup_v4
@@ -164,6 +167,7 @@ run_ndisc_evict_nocarrier_enabled() {

if [ $? -eq 0 ];then
echo "failed"
+ ret=1
else
echo "ok"
fi
@@ -182,6 +186,7 @@ run_ndisc_evict_nocarrier_disabled() {
echo "ok"
else
echo "failed"
+ ret=1
fi

cleanup_v6
@@ -198,6 +203,7 @@ run_ndisc_evict_nocarrier_disabled_all() {
echo "ok"
else
echo "failed"
+ ret=1
fi

cleanup_v6
@@ -218,3 +224,4 @@ if [ "$(id -u)" -ne 0 ];then
fi

run_all_tests
+exit $ret
--
2.7.4

2023-01-01 12:25:21

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH 0/2] selftests: net: fix for arp_ndisc_evict_nocarrier test

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

On Fri, 30 Dec 2022 17:18:27 +0800 you wrote:
> This patchset will fix a false-positive issue caused by the command in
> cleanup_v6() of the arp_ndisc_evict_nocarrier test.
>
> Also, it will make the test to return a non-zero value for any failure
> reported in the test for us to avoid false-negative results.
>
> Po-Hsu Lin (2):
> selftests: net: fix cleanup_v6() for arp_ndisc_evict_nocarrier
> selftests: net: return non-zero for failures reported in
> arp_ndisc_evict_nocarrier
>
> [...]

Here is the summary with links:
- [1/2] selftests: net: fix cleanup_v6() for arp_ndisc_evict_nocarrier
https://git.kernel.org/netdev/net/c/9c4d7f45d607
- [2/2] selftests: net: return non-zero for failures reported in arp_ndisc_evict_nocarrier
https://git.kernel.org/netdev/net/c/1856628baa17

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html