All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kui-Feng Lee <thinker.li@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
	song@kernel.org, kernel-team@meta.com, andrii@kernel.org
Cc: sinquersw@gmail.com, kuifeng@meta.com,
	Kui-Feng Lee <thinker.li@gmail.com>
Subject: [PATCH bpf-next 2/4] selftests/bpf: Monitor traffic for tc_redirect/tc_redirect_dtime.
Date: Fri, 12 Jul 2024 22:55:50 -0700	[thread overview]
Message-ID: <20240713055552.2482367-3-thinker.li@gmail.com> (raw)
In-Reply-To: <20240713055552.2482367-1-thinker.li@gmail.com>

Enable traffic monitoring for the test case tc_redirect/tc_redirect_dtime.
The traffic log is only printed when the subtest fails.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
index 327d51f59142..345f8ce93b29 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
@@ -900,6 +900,7 @@ static void test_udp_dtime(struct test_tc_dtime *skel, int family, bool bpf_fwd)
 static void test_tc_redirect_dtime(struct netns_setup_result *setup_result)
 {
 	struct test_tc_dtime *skel;
+	struct tmonitor_ctx *tmon = NULL;
 	struct nstoken *nstoken;
 	int hold_tstamp_fd, err;
 
@@ -934,6 +935,9 @@ static void test_tc_redirect_dtime(struct netns_setup_result *setup_result)
 	if (!ASSERT_OK(err, "disable forwarding"))
 		goto done;
 
+	tmon = traffic_monitor_start(NS_DST);
+	ASSERT_NEQ(tmon, NULL, "traffic_monitor_start");
+
 	test_tcp_clear_dtime(skel);
 
 	test_tcp_dtime(skel, AF_INET, true);
@@ -958,6 +962,9 @@ static void test_tc_redirect_dtime(struct netns_setup_result *setup_result)
 	test_udp_dtime(skel, AF_INET6, false);
 
 done:
+	if (env.subtest_state->error_cnt)
+		traffic_monitor_report(tmon);
+	traffic_monitor_stop(tmon);
 	test_tc_dtime__destroy(skel);
 	close(hold_tstamp_fd);
 }
-- 
2.34.1


  parent reply	other threads:[~2024-07-13  5:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  5:55 [PATCH bpf-next 0/4] monitor network traffic for flaky test cases Kui-Feng Lee
2024-07-13  5:55 ` [PATCH bpf-next 1/4] selftests/bpf: Add traffic monitor functions Kui-Feng Lee
2024-07-14  0:18   ` Kui-Feng Lee
2024-07-14 15:27   ` kernel test robot
2024-07-13  5:55 ` Kui-Feng Lee [this message]
2024-07-13  5:55 ` [PATCH bpf-next 3/4] selftests/bpf: Monitor traffic for sockmap_listen Kui-Feng Lee
2024-07-13  5:55 ` [PATCH bpf-next 4/4] selftests/bpf: Monitor traffic for select_reuseport Kui-Feng Lee
2024-07-13 19:29 ` [PATCH bpf-next 0/4] monitor network traffic for flaky test cases Kui-Feng Lee
2024-07-15 21:33 ` Stanislav Fomichev
2024-07-15 22:07   ` Kui-Feng Lee
2024-07-15 23:56     ` Martin KaFai Lau
2024-07-16  0:57       ` Kui-Feng Lee
2024-07-16  3:25         ` Stanislav Fomichev
2024-07-16  6:46           ` Kui-Feng Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240713055552.2482367-3-thinker.li@gmail.com \
    --to=thinker.li@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuifeng@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=sinquersw@gmail.com \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.