All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: magnus.karlsson@intel.com, bjorn@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, netdev@vger.kernel.org,
	maciej.fijalkowski@intel.com, yhs@fb.com, andrii@kernel.org,
	kafai@fb.com, songliubraving@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org
Cc: jonathan.lemon@gmail.com, bpf@vger.kernel.org
Subject: [PATCH bpf-next 6/9] selftests: xsk: cleanup veth pair at ctrl-c
Date: Tue, 10 May 2022 13:56:01 +0200	[thread overview]
Message-ID: <20220510115604.8717-7-magnus.karlsson@gmail.com> (raw)
In-Reply-To: <20220510115604.8717-1-magnus.karlsson@gmail.com>

From: Magnus Karlsson <magnus.karlsson@intel.com>

Remove the veth pair when the tests are aborted by pressing
ctrl-c. Currently in this situation, the veth pair is left on the
system polluting the netdev space.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
 tools/testing/selftests/bpf/test_xsk.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index d06215ee843d..567500299231 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -97,6 +97,13 @@ NS0=root
 NS1=af_xdp${VETH1_POSTFIX}
 MTU=1500
 
+trap ctrl_c INT
+
+function ctrl_c() {
+        cleanup_exit ${VETH0} ${VETH1} ${NS1}
+	exit 1
+}
+
 setup_vethPairs() {
 	if [[ $verbose -eq 1 ]]; then
 	        echo "setting up ${VETH0}: namespace: ${NS0}"
-- 
2.34.1


  parent reply	other threads:[~2022-05-10 11:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 11:55 [PATCH bpf-next 0/9] selftests: xsk: add busy-poll testing plus various fixes Magnus Karlsson
2022-05-10 11:55 ` [PATCH bpf-next 1/9] selftests: xsk: cleanup bash scripts Magnus Karlsson
2022-05-10 11:55 ` [PATCH bpf-next 2/9] selftests: xsk: do not send zero-length packets Magnus Karlsson
2022-05-10 11:55 ` [PATCH bpf-next 3/9] selftests: xsk: run all tests for busy-poll Magnus Karlsson
2022-05-10 11:55 ` [PATCH bpf-next 4/9] selftests: xsk: fix reporting of failed tests Magnus Karlsson
2022-05-10 11:56 ` [PATCH bpf-next 5/9] selftests: xsk: add timeout to tests Magnus Karlsson
2022-05-10 11:56 ` Magnus Karlsson [this message]
2022-05-10 11:56 ` [PATCH bpf-next 7/9] selftests: xsk: introduce validation functions Magnus Karlsson
2022-05-10 11:56 ` [PATCH bpf-next 8/9] selftests: xsk: make the stats tests normal tests Magnus Karlsson
2022-05-10 11:56 ` [PATCH bpf-next 9/9] selftests: xsk: make stat tests not spin on getsockopt Magnus Karlsson
2022-05-10 17:07 ` [PATCH bpf-next 0/9] selftests: xsk: add busy-poll testing plus various fixes Alexei Starovoitov
2022-05-11 14:08 ` Björn Töpel
2022-05-11 15:10 ` patchwork-bot+netdevbpf

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=20220510115604.8717-7-magnus.karlsson@gmail.com \
    --to=magnus.karlsson@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /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.