]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/vsock: accept vng 1.33 or >= 1.36
authorBobby Eshleman <bobbyeshleman@meta.com>
Fri, 12 Jun 2026 19:08:41 +0000 (12:08 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 15 Jun 2026 19:52:01 +0000 (12:52 -0700)
The current vng version check uses a discrete allowlist of "1.33",
"1.36", and "1.37", which forces a script update on every new release
even though all post-1.36 releases work.

Replace the discrete list with: "1.33", or any version >= 1.36. 1.34
and 1.35 are skipped because they were not tested. Add a version_lt()
helper that compares MAJOR.MINOR numerically, so the check reads as a
straightforward version comparison.

Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20260612-vsock-test-update-v1-1-7d7eeed3ac8f@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/vsock/vmtest.sh

index d97913a6bdc70179ea554efd048c5651134c9e56..ee69ac9dd3dc6e16ae47389bc8a332c8cf12b8e7 100755 (executable)
@@ -330,27 +330,34 @@ check_netns() {
        return 0
 }
 
+# Compare MAJOR.MINOR versions numerically. Returns 0 (true) if $1 < $2.
+version_lt() {
+       local -a a=(${1//./ })
+       local -a b=(${2//./ })
+
+       if [[ "${a[0]}" -lt "${b[0]}" ]]; then
+               return 0
+       elif [[ "${a[0]}" -gt "${b[0]}" ]]; then
+               return 1
+       elif [[ "${a[1]}" -lt "${b[1]}" ]]; then
+               return 0
+       fi
+
+       return 1
+}
+
 check_vng() {
-       local tested_versions
        local version
-       local ok
 
-       tested_versions=("1.33" "1.36" "1.37")
-       version="$(vng --version)"
+       version="$(vng --version | awk '{print $2}')"
 
-       ok=0
-       for tv in "${tested_versions[@]}"; do
-               if [[ "${version}" == *"${tv}"* ]]; then
-                       ok=1
-                       break
-               fi
-       done
-
-       if [[ ! "${ok}" -eq 1 ]]; then
-               printf "warning: vng version '%s' has not been tested and may " "${version}" >&2
-               printf "not function properly.\n\tThe following versions have been tested: " >&2
-               echo "${tested_versions[@]}" >&2
+       # Supported: 1.33, or any version >= 1.36. 1.34 and 1.35 are untested.
+       if [[ "${version}" == "1.33" ]] || ! version_lt "${version}" "1.36"; then
+               return
        fi
+
+       printf "warning: vng version '%s' has not been tested and may " "${version}" >&2
+       printf "not function properly.\n\tSupported: 1.33 or >= 1.36\n" >&2
 }
 
 check_socat() {