Merge branch 'selftests-vsock-improve-vng-version-and-quirk-handling'

Bobby Eshleman says:

====================
selftests/vsock: improve vng version and quirk handling

As vng has continued updating, there have been two things in our
selftests that have been affected. One is that newer versions always
emit the vng version warning, and two is that we have a workaround that
is not needed in newer versions.

This series just updates the version handling to allow all newer
versions without warning and version-gates the workaround to only those
versions that don't have the commit that fixed the root cause.

Additionally, we add function for comparing major.minor versions which
is used in both patches.
-===================

Link: https://patch.msgid.link/20260612-vsock-test-update-v1-0-7d7eeed3ac8f@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-06-15 12:52:03 -07:00
commit 0399e68592

View File

@ -330,27 +330,34 @@ check_netns() {
return 0
}
check_vng() {
local tested_versions
local version
local ok
# Compare MAJOR.MINOR versions numerically. Returns 0 (true) if $1 < $2.
version_lt() {
local -a a=(${1//./ })
local -a b=(${2//./ })
tested_versions=("1.33" "1.36" "1.37")
version="$(vng --version)"
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
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 version
version="$(vng --version | awk '{print $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() {
@ -438,8 +445,14 @@ vng_dry_run() {
# stopped with SIGTTOU and hangs until kselftest's timer expires.
# setsid works around this by launching vng in a new session that has
# no controlling terminal, so tcsetattr() succeeds.
#
# Fixed in 1.41 (https://github.com/arighi/virtme-ng/pull/453).
setsid -w vng --run "$@" --dry-run &>/dev/null
if version_lt "$(vng --version | awk '{print $2}')" "1.41"; then
setsid -w vng --run "$@" --dry-run &>/dev/null
else
vng --run "$@" --dry-run &>/dev/null
fi
}
vm_start() {