diff mbox series

[bpf-next,10/10] selftests/xsk: display command line options with -h

Message ID 20230809124343.12957-11-magnus.karlsson@gmail.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series seltests/xsk: various improvements to xskxceiver | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 5 maintainers not CCed: shuah@kernel.org yonghong.song@linux.dev mykolal@fb.com linux-kselftest@vger.kernel.org jonathan.lemon@gmail.com
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-6 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-11 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for veristat
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for test_maps on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 fail Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for test_progs_no_alu32 on s390x with gcc

Commit Message

Magnus Karlsson Aug. 9, 2023, 12:43 p.m. UTC
From: Magnus Karlsson <magnus.karlsson@intel.com>

Add the -h option to display all available command line options
available for test_xsk.sh and xskxceiver.

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

Comments

Przemek Kitszel Aug. 10, 2023, 12:19 p.m. UTC | #1
On 8/9/23 14:43, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Add the -h option to display all available command line options
> available for test_xsk.sh and xskxceiver.
> 
> 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 94b4b86d5239..baaeb016d699 100755
> --- a/tools/testing/selftests/bpf/test_xsk.sh
> +++ b/tools/testing/selftests/bpf/test_xsk.sh
> @@ -79,12 +79,15 @@
>   #
>   # Run a specific test from the test suite
>   #   sudo ./test_xsk.sh -t TEST_NAME
> +#
> +# Display the available command line options
> +#   sudo ./test_xsk.sh -h

any "help" / "list" commands (that do nothing but print) should be (able 
ot) execute/d without `sudo`.
Removing `sudo` part from the doc here would make it clear to reader too.

>   
>   . xsk_prereqs.sh
>   
>   ETH=""
>   
> -while getopts "vi:dm:lt:" flag
> +while getopts "vi:dm:lt:h" flag
>   do
>   	case "${flag}" in
>   		v) verbose=1;;
> @@ -93,6 +96,7 @@ do
>   		m) MODE=${OPTARG};;
>   		l) list=1;;
>   		t) TEST=${OPTARG};;
> +		h) help=1;;
>   	esac
>   done
>   
> @@ -140,6 +144,11 @@ setup_vethPairs() {
>   	ip link set ${VETH0} up
>   }
>   
> +if [[ $help -eq 1 ]]; then
> +	./${XSKOBJ}
> +        exit
> +fi
> +
>   if [ ! -z $ETH ]; then
>   	VETH0=${ETH}
>   	VETH1=${ETH}
Magnus Karlsson Aug. 10, 2023, 12:41 p.m. UTC | #2
On Thu, 10 Aug 2023 at 14:19, Przemek Kitszel
<przemyslaw.kitszel@intel.com> wrote:
>
> On 8/9/23 14:43, Magnus Karlsson wrote:
> > From: Magnus Karlsson <magnus.karlsson@intel.com>
> >
> > Add the -h option to display all available command line options
> > available for test_xsk.sh and xskxceiver.
> >
> > 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 94b4b86d5239..baaeb016d699 100755
> > --- a/tools/testing/selftests/bpf/test_xsk.sh
> > +++ b/tools/testing/selftests/bpf/test_xsk.sh
> > @@ -79,12 +79,15 @@
> >   #
> >   # Run a specific test from the test suite
> >   #   sudo ./test_xsk.sh -t TEST_NAME
> > +#
> > +# Display the available command line options
> > +#   sudo ./test_xsk.sh -h
>
> any "help" / "list" commands (that do nothing but print) should be (able
> ot) execute/d without `sudo`.
> Removing `sudo` part from the doc here would make it clear to reader too.

You are correct. Will remove the "sudo" here as it is not needed.
Would be nice if we could execute the list option (-l) without sudo
rights too since it does not involve creating any xsk sockets. Will
fix that in patch 6.

> >
> >   . xsk_prereqs.sh
> >
> >   ETH=""
> >
> > -while getopts "vi:dm:lt:" flag
> > +while getopts "vi:dm:lt:h" flag
> >   do
> >       case "${flag}" in
> >               v) verbose=1;;
> > @@ -93,6 +96,7 @@ do
> >               m) MODE=${OPTARG};;
> >               l) list=1;;
> >               t) TEST=${OPTARG};;
> > +             h) help=1;;
> >       esac
> >   done
> >
> > @@ -140,6 +144,11 @@ setup_vethPairs() {
> >       ip link set ${VETH0} up
> >   }
> >
> > +if [[ $help -eq 1 ]]; then
> > +     ./${XSKOBJ}
> > +        exit
> > +fi
> > +
> >   if [ ! -z $ETH ]; then
> >       VETH0=${ETH}
> >       VETH1=${ETH}
>
Maciej Fijalkowski Aug. 22, 2023, 1:02 p.m. UTC | #3
On Wed, Aug 09, 2023 at 02:43:43PM +0200, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Add the -h option to display all available command line options
> available for test_xsk.sh and xskxceiver.
> 
> 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 94b4b86d5239..baaeb016d699 100755
> --- a/tools/testing/selftests/bpf/test_xsk.sh
> +++ b/tools/testing/selftests/bpf/test_xsk.sh
> @@ -79,12 +79,15 @@
>  #
>  # Run a specific test from the test suite
>  #   sudo ./test_xsk.sh -t TEST_NAME
> +#
> +# Display the available command line options
> +#   sudo ./test_xsk.sh -h
>  
>  . xsk_prereqs.sh
>  
>  ETH=""
>  
> -while getopts "vi:dm:lt:" flag
> +while getopts "vi:dm:lt:h" flag
>  do
>  	case "${flag}" in
>  		v) verbose=1;;
> @@ -93,6 +96,7 @@ do
>  		m) MODE=${OPTARG};;
>  		l) list=1;;
>  		t) TEST=${OPTARG};;
> +		h) help=1;;
>  	esac
>  done
>  
> @@ -140,6 +144,11 @@ setup_vethPairs() {
>  	ip link set ${VETH0} up
>  }
>  
> +if [[ $help -eq 1 ]]; then
> +	./${XSKOBJ}
> +        exit
> +fi

is there anything that stops from having the list of test output before
all of the validation below (check that we are root, veth support etc) ?

I would like us to have a case 'h' within parse_command_line() though.

> +
>  if [ ! -z $ETH ]; then
>  	VETH0=${ETH}
>  	VETH1=${ETH}
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 94b4b86d5239..baaeb016d699 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -79,12 +79,15 @@ 
 #
 # Run a specific test from the test suite
 #   sudo ./test_xsk.sh -t TEST_NAME
+#
+# Display the available command line options
+#   sudo ./test_xsk.sh -h
 
 . xsk_prereqs.sh
 
 ETH=""
 
-while getopts "vi:dm:lt:" flag
+while getopts "vi:dm:lt:h" flag
 do
 	case "${flag}" in
 		v) verbose=1;;
@@ -93,6 +96,7 @@  do
 		m) MODE=${OPTARG};;
 		l) list=1;;
 		t) TEST=${OPTARG};;
+		h) help=1;;
 	esac
 done
 
@@ -140,6 +144,11 @@  setup_vethPairs() {
 	ip link set ${VETH0} up
 }
 
+if [[ $help -eq 1 ]]; then
+	./${XSKOBJ}
+        exit
+fi
+
 if [ ! -z $ETH ]; then
 	VETH0=${ETH}
 	VETH1=${ETH}