Skip to contentSkip to conversation

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

PATCH Applied Roman Kvasnytskyi 3 participants 3 messages May 16 – May 19

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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")
---
 tools/testing/selftests/bpf/vmtest.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/vmtest.sh +1 -1
index 2f869daf8a06..9ca802285393 100755
@@ -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

Signature · 1 line
2.54.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Roman Kvasnytskyi

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")

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

Quoted 23 lines
---
 tools/testing/selftests/bpf/vmtest.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/vmtest.sh +1 -1
index 2f869daf8a06..9ca802285393 100755
@@ -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

Signature · 1 line
2.54.0
#2 lore raw
In reply to Roman Kvasnytskyi
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 9 lines · On Sat, 16 May 2026 14:06:25 +0200 you 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.

[...]

Here is the summary with links:
- [bpf] selftests/bpf: Reject unsupported -k option in vmtest.sh

    https://git.kernel.org/bpf/bpf-next/c/6df582112aa9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html