From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 4/4] selftests: drv-net-hw: skip the tests that need a real interface
Date: Tue, 1 Sep 2026 01:50:54 +0300 [thread overview]
Message-ID: <20260831225137.1642608-4-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20260831225137.1642608-1-eva.kurchatova@virtuozzo.com>
ethtool, ethtool_extended_state, hw_stats_l3 and hw_stats_l3_gre need a
device that can set link speed and autonegotiation, report an extended
link state, or offload L3 statistics. Where none is configured, lib.sh
creates a veth pair instead, which supports none of that, so every case
fails on something the kernel correctly refuses.
Upstream answers this by keeping such tests in drivers/net/hw and not
running them on veth at all: commit 0c499a351777 ("selftests:
forwarding: Ditch skip_on_veth()") removed the equivalent check once the
directory was split out. This guard is therefore not for upstream, it
only stops a run that substitutes veth pairs from reporting failures.
Skip before sourcing lib.sh, because lib.sh makes the veth pair as it is
sourced. Exiting afterwards leaves the devices behind - vrf_cleanup()
removes them and a test that skips never gets there - and a later test
that adds a veth by one of those names then cannot. hw_stats_l3_gre
asks for six interfaces, so one run left veth0 to veth5 in the initial
namespace and the netfilter suite failed on it.
https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix vz selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../testing/selftests/drivers/net/hw/ethtool.sh | 16 ++++++++++++++++
.../drivers/net/hw/ethtool_extended_state.sh | 16 ++++++++++++++++
.../selftests/drivers/net/hw/hw_stats_l3.sh | 16 ++++++++++++++++
.../selftests/drivers/net/hw/hw_stats_l3_gre.sh | 16 ++++++++++++++++
4 files changed, 64 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/hw/ethtool.sh b/tools/testing/selftests/drivers/net/hw/ethtool.sh
index fa6953de6b6d..b1744758627c 100755
--- a/tools/testing/selftests/drivers/net/hw/ethtool.sh
+++ b/tools/testing/selftests/drivers/net/hw/ethtool.sh
@@ -11,6 +11,22 @@ ALL_TESTS="
"
NUM_NETIFS=2
lib_dir=$(dirname "$0")
+
+# The test needs a device capable of setting link speed and
+# autonegotiation. Where no real interfaces are configured, lib.sh makes
+# a veth pair instead, which cannot, and every case then fails on
+# something the kernel correctly refuses. Check this before sourcing
+# lib.sh: it creates that pair as it is sourced, so exiting afterwards
+# leaves the devices behind, and the next test that wants one of those
+# names cannot create it.
+
+: "${NETIF_CREATE:=yes}"
+: "${NETIF_TYPE:=veth}"
+if [[ "$NETIF_CREATE" = yes && "$NETIF_TYPE" = veth ]]; then
+ echo "SKIP: needs a real interface, set NETIFS in forwarding.config"
+ exit 4 # ksft_skip, lib.sh is not sourced yet
+fi
+
source "$lib_dir"/../../../net/forwarding/lib.sh
source ethtool_lib.sh
diff --git a/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh
index a7584448416e..c6c96117b1f1 100755
--- a/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh
+++ b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh
@@ -9,6 +9,22 @@ ALL_TESTS="
NUM_NETIFS=2
lib_dir=$(dirname "$0")
+
+# The test needs a device capable of reporting an extended link state.
+# Where no real interfaces are configured, lib.sh makes a veth pair
+# instead, which cannot, and every case then fails on something the
+# kernel correctly refuses. Check this before sourcing lib.sh: it
+# creates that pair as it is sourced, so exiting afterwards leaves the
+# devices behind, and the next test that wants one of those names cannot
+# create it.
+
+: "${NETIF_CREATE:=yes}"
+: "${NETIF_TYPE:=veth}"
+if [[ "$NETIF_CREATE" = yes && "$NETIF_TYPE" = veth ]]; then
+ echo "SKIP: needs a real interface, set NETIFS in forwarding.config"
+ exit 4 # ksft_skip, lib.sh is not sourced yet
+fi
+
source "$lib_dir"/../../../net/forwarding/lib.sh
source ethtool_lib.sh
diff --git a/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh
index 67fafefc80be..1776a4954601 100755
--- a/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh
+++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh
@@ -49,6 +49,22 @@ ALL_TESTS="
"
NUM_NETIFS=4
lib_dir=$(dirname "$0")
+
+# The test needs a device capable of offloading L3 statistics. Where no
+# real interfaces are configured, lib.sh makes a veth pair instead,
+# which cannot, and every case then fails on something the kernel
+# correctly refuses. Check this before sourcing lib.sh: it creates that
+# pair as it is sourced, so exiting afterwards leaves the devices
+# behind, and the next test that wants one of those names cannot create
+# it.
+
+: "${NETIF_CREATE:=yes}"
+: "${NETIF_TYPE:=veth}"
+if [[ "$NETIF_CREATE" = yes && "$NETIF_TYPE" = veth ]]; then
+ echo "SKIP: needs a real interface, set NETIFS in forwarding.config"
+ exit 4 # ksft_skip, lib.sh is not sourced yet
+fi
+
source "$lib_dir"/../../../net/forwarding/lib.sh
source "$lib_dir"/../../../net/forwarding/tc_common.sh
diff --git a/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh
index a94d92e1abce..2cbc2682f7b7 100755
--- a/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh
+++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh
@@ -13,6 +13,22 @@ ALL_TESTS="
"
NUM_NETIFS=6
lib_dir=$(dirname "$0")
+
+# The test needs a device capable of offloading L3 statistics. Where no
+# real interfaces are configured, lib.sh makes a veth pair instead,
+# which cannot, and every case then fails on something the kernel
+# correctly refuses. Check this before sourcing lib.sh: it creates that
+# pair as it is sourced, so exiting afterwards leaves the devices
+# behind, and the next test that wants one of those names cannot create
+# it.
+
+: "${NETIF_CREATE:=yes}"
+: "${NETIF_TYPE:=veth}"
+if [[ "$NETIF_CREATE" = yes && "$NETIF_TYPE" = veth ]]; then
+ echo "SKIP: needs a real interface, set NETIFS in forwarding.config"
+ exit 4 # ksft_skip, lib.sh is not sourced yet
+fi
+
source "$lib_dir"/../../../net/forwarding/lib.sh
source "$lib_dir"/../../../net/forwarding/ipip_lib.sh
source "$lib_dir"/../../../net/forwarding/tc_common.sh
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-08-31 22:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 22:50 [Devel] [PATCH vz10 1/4] ms/selftests: net: Add python context manager for netns entering Eva Kurchatova
2026-08-31 22:50 ` [Devel] [PATCH vz10 2/4] selftests: net: py: add the missing ksft_is() and ksft_not_in() helpers Eva Kurchatova
2026-08-31 22:50 ` [Devel] [PATCH vz10 3/4] selftests: net: py: report a refused environment as a skip Eva Kurchatova
2026-08-31 22:50 ` Eva Kurchatova [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831225137.1642608-4-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox