Message ID | 20240723182439.1434795-5-thinker.li@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | monitor network traffic for flaky test cases | expand |
On Tue, 2024-07-23 at 11:24 -0700, Kui-Feng Lee wrote: > Enable traffic monitoring for the subtests of select_reuseport. > > Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> > --- > tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 7 > +++++++ > 1 file changed, 7 insertions(+) > > diff --git > a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c > b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c > index 64c5f5eb2994..d3039957ee94 100644 > --- a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c > +++ b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c > @@ -22,6 +22,7 @@ > > #include "test_progs.h" > #include "test_select_reuseport_common.h" > +#include "network_helpers.h" > > #define MAX_TEST_NAME 80 > #define MIN_TCPHDR_LEN 20 > @@ -795,6 +796,7 @@ static void test_config(int sotype, sa_family_t > family, bool inany) > }; > char s[MAX_TEST_NAME]; > const struct test *t; > + struct tmonitor_ctx *tmon; > > for (t = tests; t < tests + ARRAY_SIZE(tests); t++) { > if (t->need_sotype && t->need_sotype != sotype) > @@ -808,9 +810,14 @@ static void test_config(int sotype, sa_family_t > family, bool inany) > if (!test__start_subtest(s)) > continue; > > + tmon = traffic_monitor_start(NULL); > + ASSERT_TRUE(tmon, "traffic_monitor_start"); The same here. It's better to use ASSERT_NEQ(NULL) like patch 2. > + > setup_per_test(sotype, family, inany, t- > >no_inner_map); > t->fn(sotype, family); > cleanup_per_test(t->no_inner_map); > + > + traffic_monitor_stop(tmon); > } > } >
diff --git a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c index 64c5f5eb2994..d3039957ee94 100644 --- a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c +++ b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c @@ -22,6 +22,7 @@ #include "test_progs.h" #include "test_select_reuseport_common.h" +#include "network_helpers.h" #define MAX_TEST_NAME 80 #define MIN_TCPHDR_LEN 20 @@ -795,6 +796,7 @@ static void test_config(int sotype, sa_family_t family, bool inany) }; char s[MAX_TEST_NAME]; const struct test *t; + struct tmonitor_ctx *tmon; for (t = tests; t < tests + ARRAY_SIZE(tests); t++) { if (t->need_sotype && t->need_sotype != sotype) @@ -808,9 +810,14 @@ static void test_config(int sotype, sa_family_t family, bool inany) if (!test__start_subtest(s)) continue; + tmon = traffic_monitor_start(NULL); + ASSERT_TRUE(tmon, "traffic_monitor_start"); + setup_per_test(sotype, family, inany, t->no_inner_map); t->fn(sotype, family); cleanup_per_test(t->no_inner_map); + + traffic_monitor_stop(tmon); } }
Enable traffic monitoring for the subtests of select_reuseport. Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> --- tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 7 +++++++ 1 file changed, 7 insertions(+)