[PATCH bpf] selftests/bpf: Reject unsupported -k option in vmtest.sh

Roman Kvasnytskyi posted 1 patch 1 week, 1 day ago
tools/testing/selftests/bpf/vmtest.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH bpf] selftests/bpf: Reject unsupported -k option in vmtest.sh
Posted by Roman Kvasnytskyi 1 week, 1 day ago
vmtest.sh does not document a -k option and does not handle it in the
getopts case statement. However, the getopts optstring includes k, which
causes the script to accept -k silently instead of reporting it as an
invalid option.

Remove k from the optstring so unsupported options are rejected through
the existing invalid-option path.

Fixes: c9709f52386d ("bpf: Helper script for running BPF presubmit tests")
Signed-off-by: Roman Kvasnytskyi <roman@kvasnytskyi.net>
---
 tools/testing/selftests/bpf/vmtest.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 2f869daf8a06..9ca802285393 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -382,7 +382,7 @@ main()
 	local exit_command="poweroff -f"
 	local debug_shell="no"
 
-	while getopts ':hskl:id:j:' opt; do
+	while getopts ':hsl:id:j:' opt; do
 		case ${opt} in
 		l)
 			LOCAL_ROOTFS_IMAGE="$OPTARG"

base-commit: a828abbb897657451d96ad7bf20f1893ac983bb9
-- 
2.54.0
Re: [PATCH bpf] selftests/bpf: Reject unsupported -k option in vmtest.sh
Posted by Paul Chaignon 6 days, 19 hours ago
On Sat, May 16, 2026 at 02:06:25PM +0200, Roman Kvasnytskyi wrote:
> vmtest.sh does not document a -k option and does not handle it in the
> getopts case statement. However, the getopts optstring includes k, which
> causes the script to accept -k silently instead of reporting it as an
> invalid option.
> 
> Remove k from the optstring so unsupported options are rejected through
> the existing invalid-option path.
> 
> Fixes: c9709f52386d ("bpf: Helper script for running BPF presubmit tests")
> Signed-off-by: Roman Kvasnytskyi <roman@kvasnytskyi.net>

I'm unsure this needs to go through the bpf tree, but it currently
applies cleanly to both bpf-next and bpf anyway.

Acked-by: Paul Chaignon <paul.chaignon@gmail.com>

> ---
>  tools/testing/selftests/bpf/vmtest.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
> index 2f869daf8a06..9ca802285393 100755
> --- a/tools/testing/selftests/bpf/vmtest.sh
> +++ b/tools/testing/selftests/bpf/vmtest.sh
> @@ -382,7 +382,7 @@ main()
>  	local exit_command="poweroff -f"
>  	local debug_shell="no"
>  
> -	while getopts ':hskl:id:j:' opt; do
> +	while getopts ':hsl:id:j:' opt; do
>  		case ${opt} in
>  		l)
>  			LOCAL_ROOTFS_IMAGE="$OPTARG"
> 
> base-commit: a828abbb897657451d96ad7bf20f1893ac983bb9
> -- 
> 2.54.0
> 
>