[Devel] [PATCH hci-8.1 v4 1/1] selftests: drv-net-hw: skip the tests that need a real interface

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 22 20:23:36 MSK 2026


> +# lib.sh reads NETIF_FIND_DRIVER before forwarding.config: the environment only
> +find_driver=${NETIF_FIND_DRIVER-}

True for lib.sh alone, not with this helper ahead of it: the helper
sources forwarding.config into the same shell, so lib.sh then sees a
NETIF_FIND_DRIVER set there and picks the ports by driver. The helper
ignores it, takes veth0 and skips a test lib.sh would run on hardware.

The reverse is off too. lib.sh sources forwarding.config after
netif_find_driver(), and NETIFS=(...) there replaces what the driver
found. The early return below trusts the driver and hands lib.sh a
config full of veths.

lib.sh's order is command line, config NETIFS, driver, veth defaults.
Follow it:

diff --git a/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh b/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh
--- a/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh
+++ b/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh
@@ -5,9 +5,6 @@
 
 forwarding_dir="$lib_dir"/../../../net/forwarding
 
-# lib.sh reads NETIF_FIND_DRIVER before forwarding.config: the environment only
-find_driver=${NETIF_FIND_DRIVER-}
-
 # forwarding.config assigns by name into the array lib.sh declares
 declare -A NETIFS
 
@@ -23,14 +20,13 @@ fi
 # found the way lib.sh finds it: keep in step with lib.sh.
 skip_on_veth()
 {
-	# lib.sh takes the interfaces from the command line ahead of anything
-	local p1=${1:-}
+	# lib.sh takes the command line, then forwarding.config, then the driver
+	local p1=${1:-${NETIFS[p1]-}}
 	local kind
 
-	# Otherwise with NETIF_FIND_DRIVER it takes those of that driver, and
-	# skips by itself when it finds none
-	[[ -z $p1 && -n $find_driver ]] && return
-	p1=${p1:-${NETIFS[p1]-veth0}}
+	# lib.sh skips by itself when the driver has no interfaces
+	[[ -z $p1 && -n $NETIF_FIND_DRIVER ]] && return
+	p1=${p1:-veth0}
 	if ip link show dev "$p1" &> /dev/null; then
 		kind=$(ip -j -d link show dev "$p1" | jq -r '.[].linkinfo.info_kind')
 	elif [[ $NETIF_CREATE == yes && $NETIF_TYPE == veth ]]; then

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list