Skip to contentSkip to conversation

selftests/bpf: improve netcnt test robustness

PATCH Applied Andrii Nakryiko 3 participants 4 messages May 15, 2023 – May 17, 2023

Subsystems (3)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 1/1 selftests/bpf: improve netcnt test robustness

Change netcnt to demand at least 10K packets, as we frequently see some stray packet arriving during the test in BPF CI. It seems more important to make sure we haven't lost any packet than enforcing exact number of packets.

Cc Stanislav Fomichev <[email protected]>
---
 tools/testing/selftests/bpf/prog_tests/netcnt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/netcnt.c +2 -2
index d3915c58d0e1..c3333edd029f 100644
@@ -67,12 +67,12 @@ void serial_test_netcnt(void)
 	}
 
 	/* No packets should be lost */
-	ASSERT_EQ(packets, 10000, "packets");
+	ASSERT_GE(packets, 10000, "packets");
 
 	/* Let's check that bytes counter matches the number of packets
 	 * multiplied by the size of ipv6 ICMP packet.
 	 */
-	ASSERT_EQ(bytes, packets * 104, "bytes");
+	ASSERT_GE(bytes, packets * 104, "bytes");
 
 err:
 	if (cg_fd != -1)
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrii Nakryiko

Change netcnt to demand at least 10K packets, as we frequently see some stray packet arriving during the test in BPF CI. It seems more important to make sure we haven't lost any packet than enforcing exact number of packets.

Cc Stanislav Fomichev <[email protected]>

I was gonna try to count only icmp packets in the bpf program, but _GE works as well :-)

Quoted 26 lines
---
 tools/testing/selftests/bpf/prog_tests/netcnt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/netcnt.c +2 -3
index d3915c58d0e1..c3333edd029f 100644
@@ -67,12 +67,12 @@ void serial_test_netcnt(void)
        }
 
        /* No packets should be lost */
-       ASSERT_EQ(packets, 10000, "packets");
+       ASSERT_GE(packets, 10000, "packets");
 
        /* Let's check that bytes counter matches the number of packets
         * multiplied by the size of ipv6 ICMP packet.
         */
-       ASSERT_EQ(bytes, packets * 104, "bytes");
+       ASSERT_GE(bytes, packets * 104, "bytes");
 
 err:
        if (cg_fd != -1)
--

2.34.1

#2 lore raw
In reply to Andrii Nakryiko
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:

Quoted 9 lines · On Mon, 15 May 2023 13:48:33 -0700 you wrote:

Change netcnt to demand at least 10K packets, as we frequently see some stray packet arriving during the test in BPF CI. It seems more important to make sure we haven't lost any packet than enforcing exact number of packets.

Cc Stanislav Fomichev <[email protected]>

[...]

Here is the summary with links:
- [bpf-next] selftests/bpf: improve netcnt test robustness

    https://git.kernel.org/bpf/bpf-next/c/fdb16e48e1c8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Andrii Nakryiko
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 9 lines · On Mon, 15 May 2023 13:48:33 -0700 you wrote:

Change netcnt to demand at least 10K packets, as we frequently see some stray packet arriving during the test in BPF CI. It seems more important to make sure we haven't lost any packet than enforcing exact number of packets.

Cc Stanislav Fomichev <[email protected]>

[...]

Here is the summary with links:
- [bpf-next] selftests/bpf: improve netcnt test robustness

    https://git.kernel.org/bpf/bpf-next/c/387912285917

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html