netdev.vger.kernel.org archive mirror
 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, bpf@vger.kernel.org, yhs@fb.com,
	andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, jolsa@kernel.org, tirthendu.sarkar@intel.com
Cc: jonathan.lemon@gmail.com
Subject: [PATCH bpf-next v2 06/15] selftests/xsk: add debug option for creating netdevs
Date: Wed,  4 Jan 2023 13:17:35 +0100	[thread overview]
Message-ID: <20230104121744.2820-7-magnus.karlsson@gmail.com> (raw)
In-Reply-To: <20230104121744.2820-1-magnus.karlsson@gmail.com>

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

Add a new option to the test_xsk.sh script that only creates the two
veth netdevs and the extra namespace, then exits without running any
tests. The failed test can then be executed in the debugger without
having to create the netdevs and namespace manually. For ease-of-use,
the veth netdevs to use are printed so they can be copied into the
debugger.

Here is an example how to use it:

> sudo ./test_xsk.sh -d

veth10 veth11

> gdb xskxceiver

In gdb:

run -i veth10 -i veth11

And now the test cases can be debugged with gdb.

If you want to debug the test suite on a real NIC in loopback mode,
there is no need to use this feature as you already know the netdev of
your NIC.

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

diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index d821fd098504..cb315d85148b 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -74,6 +74,9 @@
 # Run and dump packet contents:
 #   sudo ./test_xsk.sh -D
 #
+# Set up veth interfaces and leave them up so xskxceiver can be launched in a debugger:
+#   sudo ./test_xsk.sh -d
+#
 # Run test suite for physical device in loopback mode
 #   sudo ./test_xsk.sh -i IFACE
 
@@ -81,11 +84,12 @@
 
 ETH=""
 
-while getopts "vDi:" flag
+while getopts "vDi:d" flag
 do
 	case "${flag}" in
 		v) verbose=1;;
 		D) dump_pkts=1;;
+		d) debug=1;;
 		i) ETH=${OPTARG};;
 	esac
 done
@@ -174,6 +178,11 @@ statusList=()
 
 TEST_NAME="XSK_SELFTESTS_${VETH0}_SOFTIRQ"
 
+if [[ $debug -eq 1 ]]; then
+    echo "-i" ${VETH0} "-i" ${VETH1},${NS1}
+    exit
+fi
+
 exec_xskxceiver
 
 if [ -z $ETH ]; then
-- 
2.34.1


  parent reply	other threads:[~2023-01-04 12:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 12:17 [PATCH bpf-next v2 00/15] selftests/xsk: speed-ups, fixes, and new XDP programs Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 01/15] selftests/xsk: print correct payload for packet dump Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 02/15] selftests/xsk: do not close unused file descriptors Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 03/15] selftests/xsk: submit correct number of frames in populate_fill_ring Magnus Karlsson
2023-01-09 23:01   ` Maciej Fijalkowski
2023-01-04 12:17 ` [PATCH bpf-next v2 04/15] selftests/xsk: print correct error codes when exiting Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 05/15] selftests/xsk: remove unused variable outstanding_tx Magnus Karlsson
2023-01-04 12:17 ` Magnus Karlsson [this message]
2023-01-04 12:17 ` [PATCH bpf-next v2 07/15] selftests/xsk: replace asm acquire/release implementations Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 08/15] selftests/xsk: remove namespaces Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 09/15] selftests/xsk: load and attach XDP program only once per mode Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 10/15] selftests/xsk: remove unnecessary code in control path Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 11/15] selftests/xsk: get rid of built-in XDP program Magnus Karlsson
2023-01-04 18:14   ` David Vernet
2023-01-04 18:19     ` Stanislav Fomichev
2023-01-04 19:13       ` David Vernet
2023-01-04 19:46         ` Stanislav Fomichev
2023-01-05  8:38     ` Magnus Karlsson
2023-01-04 23:15   ` Andrii Nakryiko
2023-01-04 23:44     ` Stanislav Fomichev
2023-01-11 19:20       ` Andrii Nakryiko
2023-01-04 12:17 ` [PATCH bpf-next v2 12/15] selftests/xsk: add test when some packets are XDP_DROPed Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 13/15] selftests/xsk: merge dual and single thread dispatchers Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 14/15] selftests/xsk: automatically restore packet stream Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 15/15] selftests/xsk: automatically switch XDP programs Magnus Karlsson
2023-01-10 11:56   ` Maciej Fijalkowski
2023-01-10 12:08     ` Magnus Karlsson
2023-01-10 12:00 ` [PATCH bpf-next v2 00/15] selftests/xsk: speed-ups, fixes, and new " Maciej Fijalkowski
2023-01-10 12:10   ` Magnus Karlsson

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=20230104121744.2820-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=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jonathan.lemon@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tirthendu.sarkar@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).