[PATCH mptcp-next v2] Squash to "selftests/bpf: Add bpf_bkup test"

Geliang Tang posted 1 patch 1 year ago
Failed in applying to current master (apply log)
tools/testing/selftests/bpf/prog_tests/mptcp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH mptcp-next v2] Squash to "selftests/bpf: Add bpf_bkup test"
Posted by Geliang Tang 1 year ago
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 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 6f69abcadebb..f318aba9e410 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -312,7 +312,7 @@ static void test_first(char *ns)
 	mptcp_bpf_first__destroy(first_skel);
 }
 
-static void test_bkup(void)
+static void test_bkup(char *ns)
 {
 	struct mptcp_bpf_bkup *bkup_skel;
 	int server_fd, client_fd;
@@ -328,17 +328,17 @@ static void test_bkup(void)
 		return;
 	}
 
-	sched_init("subflow backup", "bpf_bkup");
+	sched_init(ns, "subflow backup", "bpf_bkup");
 	server_fd = start_mptcp_server(AF_INET, ADDR_1, 0, 0);
 	client_fd = connect_to_fd(server_fd, 0);
 
 	send_data(server_fd, client_fd);
-	ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr_1");
-	ASSERT_GT(has_bytes_sent(ADDR_2), 0, "has_bytes_sent addr_2");
+	ASSERT_OK(has_bytes_sent(ns, ADDR_1), "has_bytes_sent addr_1");
+	ASSERT_GT(has_bytes_sent(ns, ADDR_2), 0, "has_bytes_sent addr_2");
 
 	close(client_fd);
 	close(server_fd);
-	sched_cleanup();
+	sched_cleanup(ns);
 	bpf_link__destroy(link);
 	mptcp_bpf_bkup__destroy(bkup_skel);
 }
@@ -362,7 +362,7 @@ void test_mptcp(void)
 	if (test__start_subtest("first"))
 		test_first(NS_TEST);
 	if (test__start_subtest("bkup"))
-		test_bkup();
+		test_bkup(NS_TEST);
 
 	if (nstoken)
 		close_netns(nstoken);
-- 
2.35.3