From: Geliang Tang <geliang@kernel.org>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: [PATCH mptcp-next v8 3/4] selftests/bpf: Handle SIGINT when creating netns
Date: Sat, 20 Apr 2024 19:23:28 +0800 [thread overview]
Message-ID: <52828eced92baaed52e180c5975f96620255e9c0.1713612119.git.tanggeliang@kylinos.cn> (raw)
In-Reply-To: <cover.1713612119.git.tanggeliang@kylinos.cn>
From: Geliang Tang <tanggeliang@kylinos.cn>
It's necessary to delete netns during the MPTCP bpf tests interrupt,
otherwise the next tests run will fail due to unable to create netns.
This patch adds a new SIGINT handle sig_int, and deletes NS_TEST in it.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/bpf/prog_tests/mptcp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 0b0da4556d91..307d4b360350 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -79,11 +79,18 @@ struct mptcp_storage {
char ca_name[TCP_CA_NAME_MAX];
};
+static void sig_int(int sig)
+{
+ signal(sig, SIG_IGN);
+ SYS_NOFAIL("ip netns del %s", NS_TEST);
+}
+
static struct nstoken *create_netns(void)
{
SYS(fail, "ip netns add %s", NS_TEST);
SYS(fail, "ip -net %s link set dev lo up", NS_TEST);
+ signal(SIGINT, sig_int);
return open_netns(NS_TEST);
fail:
return NULL;
--
2.40.1
next prev parent reply other threads:[~2024-04-20 11:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 11:23 [PATCH mptcp-next v8 0/4] setsockopt per subflow: BPF Geliang Tang
2024-04-20 11:23 ` [PATCH mptcp-next v8 1/4] selftests/bpf: Add mptcp subflow example Geliang Tang
2024-04-20 11:23 ` [PATCH mptcp-next v8 2/4] selftests/bpf: Add mptcp subflow subtest Geliang Tang
2024-04-23 20:58 ` Mat Martineau
2024-04-20 11:23 ` Geliang Tang [this message]
2024-04-20 11:23 ` [PATCH mptcp-next v8 4/4] Squash to "selftests/bpf: Add bpf scheduler test" Geliang Tang
2024-04-20 12:17 ` [PATCH mptcp-next v8 0/4] setsockopt per subflow: BPF MPTCP CI
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=52828eced92baaed52e180c5975f96620255e9c0.1713612119.git.tanggeliang@kylinos.cn \
--to=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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.