diff mbox series

[mptcp-next,v4,5/6] Squash to "selftests/bpf: Add bpf_rr test"

Message ID d9e5a3380e0757f2348415051effbf851154e3e2.1684362296.git.geliang.tang@suse.com (mailing list archive)
State Accepted, archived
Commit 8c10fe1b63652f3f73989f4a0346583ece422ae2
Delegated to: Matthieu Baerts
Headers show
Series run sched tests in a dedicated ns | expand

Checks

Context Check Description
matttbe/KVM_Validation__normal__only_selftest_mptcp_join_ success Success! ✅
matttbe/KVM_Validation__debug__except_selftest_mptcp_join_ warning Unstable: 4 failed test(s): packetdrill_fastopen packetdrill_mp_capable packetdrill_sockopts selftest_diag
matttbe/KVM_Validation__debug__only_selftest_mptcp_join_ success Success! ✅
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
matttbe/KVM_Validation__normal__except_selftest_mptcp_join_ warning Unstable: 1 failed test(s): packetdrill_fastopen

Commit Message

Geliang Tang May 17, 2023, 10:29 p.m. UTC
Run mptcp sched test in a dedicated netns.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 3d99b6a1aebf..13594084d095 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -389,6 +389,7 @@  static void test_rr(void)
 {
 	struct mptcp_bpf_rr *rr_skel;
 	int server_fd, client_fd;
+	struct nstoken *nstoken;
 	struct bpf_link *link;
 
 	rr_skel = mptcp_bpf_rr__open_and_load();
@@ -401,7 +402,9 @@  static void test_rr(void)
 		return;
 	}
 
-	sched_init("subflow", "bpf_rr");
+	nstoken = sched_init("subflow", "bpf_rr");
+	if (!ASSERT_OK_PTR(nstoken, "sched_init:bpf_rr"))
+		goto fail;
 	server_fd = start_mptcp_server(AF_INET, ADDR_1, 0, 0);
 	client_fd = connect_to_fd(server_fd, 0);
 
@@ -411,7 +414,8 @@  static void test_rr(void)
 
 	close(client_fd);
 	close(server_fd);
-	sched_cleanup();
+fail:
+	cleanup_netns(nstoken);
 	bpf_link__destroy(link);
 	mptcp_bpf_rr__destroy(rr_skel);
 }