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 --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 13594084d095..a968641cc94a 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -424,6 +424,7 @@ static void test_red(void)
{
struct mptcp_bpf_red *red_skel;
int server_fd, client_fd;
+ struct nstoken *nstoken;
struct bpf_link *link;
red_skel = mptcp_bpf_red__open_and_load();
@@ -436,7 +437,9 @@ static void test_red(void)
return;
}
- sched_init("subflow", "bpf_red");
+ nstoken = sched_init("subflow", "bpf_red");
+ if (!ASSERT_OK_PTR(nstoken, "sched_init:bpf_red"))
+ goto fail;
server_fd = start_mptcp_server(AF_INET, ADDR_1, 0, 0);
client_fd = connect_to_fd(server_fd, 0);
@@ -446,7 +449,8 @@ static void test_red(void)
close(client_fd);
close(server_fd);
- sched_cleanup();
+fail:
+ cleanup_netns(nstoken);
bpf_link__destroy(link);
mptcp_bpf_red__destroy(red_skel);
}
--
2.35.3