Re: [PATCH bpf-next 2/4] selftests/bpf: Add RUN_MPTCP_TEST macro

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

 



On Tue, May 7, 2024 at 3:53 AM Matthieu Baerts (NGI0)
<matttbe@xxxxxxxxxx> wrote:
>
> From: Geliang Tang <tanggeliang@xxxxxxxxxx>
>
> Each MPTCP subtest tests test__start_subtest(suffix), then invokes
> test_suffix(). It makes sense to add a new macro RUN_MPTCP_TEST to
> simpolify the code.
>
> Signed-off-by: Geliang Tang <tanggeliang@xxxxxxxxxx>
> Reviewed-by: Mat Martineau <martineau@xxxxxxxxxx>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/prog_tests/mptcp.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index baf976a7a1dd..9d1b255bb654 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -347,10 +347,14 @@ static void test_mptcpify(void)
>         close(cgroup_fd);
>  }
>
> +#define RUN_MPTCP_TEST(suffix)                                 \
> +do {                                                           \
> +       if (test__start_subtest(#suffix))                       \
> +               test_##suffix();                                \
> +} while (0)

Please no.
Don't hide it behind macros.

>  void test_mptcp(void)
>  {
> -       if (test__start_subtest("base"))
> -               test_base();
> -       if (test__start_subtest("mptcpify"))
> -               test_mptcpify();
> +       RUN_MPTCP_TEST(base);
> +       RUN_MPTCP_TEST(mptcpify);
>  }
>
> --
> 2.43.0
>





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux