diff mbox series

[bpf-next,2/4] selftests/bpf: expose debug arg to shell script for xsk tests

Message ID 20210217160214.7869-3-ciara.loftus@intel.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series selftests/bpf: xsk improvements and new stats tests | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: linux-kselftest@vger.kernel.org daniel@iogearbox.net andrii@kernel.org yhs@fb.com john.fastabend@gmail.com kpsingh@kernel.org ast@kernel.org songliubraving@fb.com shuah@kernel.org kafai@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 92 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Ciara Loftus Feb. 17, 2021, 4:02 p.m. UTC
Launching xdpxceiver with -D enables debug mode. Make it possible
to pass this flag to the app via the test_xsk.sh shell script like
so:

./test_xsk.sh -d

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 tools/testing/selftests/bpf/test_xsk.sh    | 7 ++++++-
 tools/testing/selftests/bpf/xsk_prereqs.sh | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Magnus Karlsson Feb. 19, 2021, 1:12 p.m. UTC | #1
On Wed, Feb 17, 2021 at 5:36 PM Ciara Loftus <ciara.loftus@intel.com> wrote:
>
> Launching xdpxceiver with -D enables debug mode. Make it possible

Would be clearer if the option was the same both in the shell and in
the xdpreceiver app, so please pick -d or -D and stick with it. And
how about calling the mode "dump packets" instead of debug, because
that is what it is doing right now?

> to pass this flag to the app via the test_xsk.sh shell script like
> so:
>
> ./test_xsk.sh -d
>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
>  tools/testing/selftests/bpf/test_xsk.sh    | 7 ++++++-
>  tools/testing/selftests/bpf/xsk_prereqs.sh | 3 ++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
> index 91127a5be90d..a72f8ed2932d 100755
> --- a/tools/testing/selftests/bpf/test_xsk.sh
> +++ b/tools/testing/selftests/bpf/test_xsk.sh
> @@ -74,11 +74,12 @@
>
>  . xsk_prereqs.sh
>
> -while getopts "cv" flag
> +while getopts "cvd" flag
>  do
>         case "${flag}" in
>                 c) colorconsole=1;;
>                 v) verbose=1;;
> +               d) debug=1;;
>         esac
>  done
>
> @@ -135,6 +136,10 @@ if [[ $verbose -eq 1 ]]; then
>         VERBOSE_ARG="-v"
>  fi
>
> +if [[ $debug -eq 1 ]]; then
> +       DEBUG_ARG="-D"
> +fi
> +
>  test_status $retval "${TEST_NAME}"
>
>  ## START TESTS
> diff --git a/tools/testing/selftests/bpf/xsk_prereqs.sh b/tools/testing/selftests/bpf/xsk_prereqs.sh
> index ef8c5b31f4b6..d95018051fcc 100755
> --- a/tools/testing/selftests/bpf/xsk_prereqs.sh
> +++ b/tools/testing/selftests/bpf/xsk_prereqs.sh
> @@ -128,5 +128,6 @@ execxdpxceiver()
>                         copy[$index]=${!current}
>                 done
>
> -       ./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS} ${VERBOSE_ARG}
> +       ./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS} ${VERBOSE_ARG} \
> +               ${DEBUG_ARG}
>  }
> --
> 2.17.1
>
Ciara Loftus Feb. 22, 2021, 2:29 p.m. UTC | #2
> 
> On Wed, Feb 17, 2021 at 5:36 PM Ciara Loftus <ciara.loftus@intel.com>
> wrote:
> >
> > Launching xdpxceiver with -D enables debug mode. Make it possible
> 
> Would be clearer if the option was the same both in the shell and in
> the xdpreceiver app, so please pick -d or -D and stick with it. And
> how about calling the mode "dump packets" instead of debug, because
> that is what it is doing right now?

+1. Will stick with -D to be consistent with the current interface.
Will make the long opt '--dump_pkts'.

Thanks,
Ciara

> 
> > to pass this flag to the app via the test_xsk.sh shell script like
> > so:
> >
> > ./test_xsk.sh -d
> >
> > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> > ---
> >  tools/testing/selftests/bpf/test_xsk.sh    | 7 ++++++-
> >  tools/testing/selftests/bpf/xsk_prereqs.sh | 3 ++-
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_xsk.sh
> b/tools/testing/selftests/bpf/test_xsk.sh
> > index 91127a5be90d..a72f8ed2932d 100755
> > --- a/tools/testing/selftests/bpf/test_xsk.sh
> > +++ b/tools/testing/selftests/bpf/test_xsk.sh
> > @@ -74,11 +74,12 @@
> >
> >  . xsk_prereqs.sh
> >
> > -while getopts "cv" flag
> > +while getopts "cvd" flag
> >  do
> >         case "${flag}" in
> >                 c) colorconsole=1;;
> >                 v) verbose=1;;
> > +               d) debug=1;;
> >         esac
> >  done
> >
> > @@ -135,6 +136,10 @@ if [[ $verbose -eq 1 ]]; then
> >         VERBOSE_ARG="-v"
> >  fi
> >
> > +if [[ $debug -eq 1 ]]; then
> > +       DEBUG_ARG="-D"
> > +fi
> > +
> >  test_status $retval "${TEST_NAME}"
> >
> >  ## START TESTS
> > diff --git a/tools/testing/selftests/bpf/xsk_prereqs.sh
> b/tools/testing/selftests/bpf/xsk_prereqs.sh
> > index ef8c5b31f4b6..d95018051fcc 100755
> > --- a/tools/testing/selftests/bpf/xsk_prereqs.sh
> > +++ b/tools/testing/selftests/bpf/xsk_prereqs.sh
> > @@ -128,5 +128,6 @@ execxdpxceiver()
> >                         copy[$index]=${!current}
> >                 done
> >
> > -       ./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS}
> ${VERBOSE_ARG}
> > +       ./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS}
> ${VERBOSE_ARG} \
> > +               ${DEBUG_ARG}
> >  }
> > --
> > 2.17.1
> >
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 91127a5be90d..a72f8ed2932d 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -74,11 +74,12 @@ 
 
 . xsk_prereqs.sh
 
-while getopts "cv" flag
+while getopts "cvd" flag
 do
 	case "${flag}" in
 		c) colorconsole=1;;
 		v) verbose=1;;
+		d) debug=1;;
 	esac
 done
 
@@ -135,6 +136,10 @@  if [[ $verbose -eq 1 ]]; then
 	VERBOSE_ARG="-v"
 fi
 
+if [[ $debug -eq 1 ]]; then
+	DEBUG_ARG="-D"
+fi
+
 test_status $retval "${TEST_NAME}"
 
 ## START TESTS
diff --git a/tools/testing/selftests/bpf/xsk_prereqs.sh b/tools/testing/selftests/bpf/xsk_prereqs.sh
index ef8c5b31f4b6..d95018051fcc 100755
--- a/tools/testing/selftests/bpf/xsk_prereqs.sh
+++ b/tools/testing/selftests/bpf/xsk_prereqs.sh
@@ -128,5 +128,6 @@  execxdpxceiver()
 			copy[$index]=${!current}
 		done
 
-	./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS} ${VERBOSE_ARG}
+	./${XSKOBJ} -i ${VETH0} -i ${VETH1},${NS1} ${copy[*]} -C ${NUMPKTS} ${VERBOSE_ARG} \
+		${DEBUG_ARG}
 }