aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/vmtest.sh
diff options
context:
space:
mode:
authorDaniel Xu <dxu@dxuuu.xyz>2022-08-09 11:11:10 -0600
committerDaniel Borkmann <daniel@iogearbox.net>2022-08-09 22:30:02 +0200
commita7be0ab1eb1949f3564739784b4360e1233305f6 (patch)
treea8252bf36a7094a49740be11a6e6ec7a59b6ac5b /tools/testing/selftests/bpf/vmtest.sh
parentselftests/bpf: Fix vmtest.sh -h to not require root (diff)
downloadlinux-dev-a7be0ab1eb1949f3564739784b4360e1233305f6.tar.xz
linux-dev-a7be0ab1eb1949f3564739784b4360e1233305f6.zip
selftests/bpf: Fix vmtest.sh getopts optstring
Before, you could see the following errors: $ ./vmtest.sh -j ./vmtest.sh: option requires an argument -- j ./vmtest.sh: line 357: OPTARG: unbound variable $ ./vmtest.sh -z ./vmtest.sh: illegal option -- z ./vmtest.sh: line 357: OPTARG: unbound variable Fix by adding ':' as first character of optstring. Reason is that getopts requires ':' as the first character for OPTARG to be set in the `?` and `:` error cases. Note that the ':' as the first character of the optstring switches getopts to silent mode. The desire to run in this mode seems to have been there all along, as the script takes care of reporting errors. Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Daniel Müller <deso@posteo.net> Link: https://lore.kernel.org/bpf/0f93b56198328b6b4da7b4cf4662d05c3edb5fd2.1660064925.git.dxu@dxuuu.xyz
Diffstat (limited to 'tools/testing/selftests/bpf/vmtest.sh')
-rwxr-xr-xtools/testing/selftests/bpf/vmtest.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 976ef7585b33..a29aa05ebb3e 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -333,7 +333,7 @@ main()
local exit_command="poweroff -f"
local debug_shell="no"
- while getopts 'hskid:j:' opt; do
+ while getopts ':hskid:j:' opt; do
case ${opt} in
i)
update_image="yes"