Re: [PATCH bpf-next 4/4] selftests/bpf: Add bpf_fib_lookup test

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

 



On Thu, Feb 16, 2023 at 4:42 PM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote:
>
> From: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
>
> This patch tests the bpf_fib_lookup helper when looking up
> a neigh in NUD_FAILED and NUD_STALE state. It also adds test
> for the new BPF_FIB_LOOKUP_SKIP_NEIGH flag.
>
> Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
> ---
>  .../selftests/bpf/prog_tests/fib_lookup.c     | 187 ++++++++++++++++++
>  .../testing/selftests/bpf/progs/fib_lookup.c  |  22 +++
>  2 files changed, 209 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/fib_lookup.c
>  create mode 100644 tools/testing/selftests/bpf/progs/fib_lookup.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/fib_lookup.c b/tools/testing/selftests/bpf/prog_tests/fib_lookup.c
> new file mode 100644
> index 000000000000..61ccddccf485
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/fib_lookup.c
> @@ -0,0 +1,187 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
> +
> +#include <sys/types.h>
> +#include <net/if.h>
> +
> +#include "test_progs.h"
> +#include "network_helpers.h"
> +#include "fib_lookup.skel.h"
> +
> +#define SYS(fmt, ...)                                          \
> +       ({                                                      \
> +               char cmd[1024];                                 \
> +               snprintf(cmd, sizeof(cmd), fmt, ##__VA_ARGS__); \
> +               if (!ASSERT_OK(system(cmd), cmd))               \
> +                       goto fail;                              \
> +       })

it's probably a high time to move this SYS() macro into test_progs.h
and stop copy/pasting it across many test?

[...]



[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