Re: [PATCH bpf-next] selftests/bpf: improve netcnt test robustness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 15, 2023 at 1:48 PM Andrii Nakryiko <andrii@xxxxxxxxxx> 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 <sdf@xxxxxxxxxx>
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>

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

> ---
>  tools/testing/selftests/bpf/prog_tests/netcnt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/netcnt.c b/tools/testing/selftests/bpf/prog_tests/netcnt.c
> index d3915c58d0e1..c3333edd029f 100644
> --- a/tools/testing/selftests/bpf/prog_tests/netcnt.c
> +++ b/tools/testing/selftests/bpf/prog_tests/netcnt.c
> @@ -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
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux