public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing
@ 2026-01-20 23:02 Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported Aleksei Oladko
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

Hi,

Several forwarding selftests currently assume that certain kernel
features or tc/ip capabilities are always present. When this is no the
case (e.g. kernel built without specific CONFIG options or older
iproute2).

This series adds explicit feature probing and conditional skips to
avoid false negatives.

Summary of changes:
1. forwarding/lib: skip tests that require LAG devices when the team
   driver is not supported (CONFIG_NET_TEAM disabled)
2. forwarding/sch_ets: skip tests if the cls_basic module is not
   available (CONFIG_NET_CLS_BASIC disabled)
3. forwarding/lib introduce run_cmd_grep helper to probe userspace
   feature support by matching keywords in command help output
4. forwarding/tc_flower_cfm: skip test when tc does not support cfm
5. forwarding/tc_flower_l2_miss: skip test when tc does not support
   l2_miss
6. forwarding/router_mpath_seed: skip tests then ip does not support
   hw_stats

Aleksei Oladko (6):
  selftests: forwarding: lib: skip test if team driver is not supported
  selftests: forwarding: sch_ets: skip test if cls_basic module is
    missing
  selftests: forwarding: lib: add run_cmd_grep helper for feature
    probing
  selftests: forwarding: tc_flower_cfm: skip tests if tools or feats are
    missing
  selftests: forwarding: tc_flower_l2_miss: skip tests if tools or feats
    are missing
  selftests: forwarding: router_mpath_seed: skip tests if tools or feats
    are missing

 tools/testing/selftests/net/forwarding/lib.sh | 33 ++++++++++++++++++-
 .../net/forwarding/router_mpath_seed.sh       |  2 ++
 .../selftests/net/forwarding/sch_ets_core.sh  |  1 +
 .../selftests/net/forwarding/tc_flower_cfm.sh |  2 ++
 .../net/forwarding/tc_flower_l2_miss.sh       |  2 ++
 5 files changed, 39 insertions(+), 1 deletion(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 2/6] selftests: forwarding: sch_ets: skip test if cls_basic module is missing Aleksei Oladko
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

Some kselftests rely on teamd to create LAG devices. If the kernel is
built without CONFIG_NET_TEAM, the teamd command fails with:
Failed: Operation not supported

Currently, the exit code of teamd is not properly checked, causing
the test to proceed and eventually fail instead of being skipped.

Add a check for the teamd exit code, mark the test as skipped
to avoid self-positive failures.

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index a9034f0bb58b..0a474b02371d 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -771,9 +771,21 @@ team_create()
 {
 	local if_name=$1; shift
 	local mode=$1; shift
+	local output
+	local status
 
 	require_command $TEAMD
-	$TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}'
+	output=$($TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}' 2>&1)
+	status=$?
+
+	if [ $status -ne 0 ]; then
+		if echo "$output" | grep -q "Operation not supported"; then
+			exit $ksft_skip
+		else
+			exit 1
+		fi
+	fi
+
 	for slave in "$@"; do
 		ip link set dev $slave down
 		ip link set dev $slave master $if_name
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] selftests: forwarding: sch_ets: skip test if cls_basic module is missing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 3/6] selftests: forwarding: lib: add run_cmd_grep helper for feature probing Aleksei Oladko
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

The sch_ets.sh test requires the cls_basic kernel module to function
properly. If the kernel is compiled without CONFIG_NET_CLS_BASIC,
the test fails instead of being gracefully skipped.

Add a check to attempt loading the cls_basic module. If modprobe fails,
the test will be skipped.

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/sch_ets_core.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/forwarding/sch_ets_core.sh b/tools/testing/selftests/net/forwarding/sch_ets_core.sh
index 0453210271dc..ff3ac3e43c33 100644
--- a/tools/testing/selftests/net/forwarding/sch_ets_core.sh
+++ b/tools/testing/selftests/net/forwarding/sch_ets_core.sh
@@ -98,6 +98,7 @@ classifier_mode()
 {
 	echo "Running in classifier mode"
 	ets_delete_qdisc
+	modprobe cls_basic || exit $ksft_skip
 	ETS_CHANGE_QDISC=ets_change_qdisc_classifier
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] selftests: forwarding: lib: add run_cmd_grep helper for feature probing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 2/6] selftests: forwarding: sch_ets: skip test if cls_basic module is missing Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 4/6] selftests: forwarding: tc_flower_cfm: skip tests if tools or feats are missing Aleksei Oladko
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

In some forwarding tests, it is necessary to check for features or
specific keywords in command output before proceeding.

Introduce the run_cmd_grep helper in lib.sh. This helper executes a
command and searches for a specific pattern in its output.

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 0a474b02371d..dcf17c19ad77 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -2163,3 +2163,22 @@ has_unicast_flt()
 
 	[[ $promisc == 1 ]] && echo "no" || echo "yes"
 }
+
+run_cmd_grep_common()
+{
+	local find="$1"; shift
+	local cmd="$*"
+
+	if [ "$VERBOSE" = "1" ]; then
+		echo "COMMAND: ${cmd} 2>&1 | grep -q '${find}'"
+	fi
+	$cmd 2>&1 | grep -q "${find}"
+	return $?
+}
+
+run_cmd_grep() {
+	run_cmd_grep_common "$@"
+	rc=$?
+	check_err $rc
+	return $rc
+}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] selftests: forwarding: tc_flower_cfm: skip tests if tools or feats are missing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
                   ` (2 preceding siblings ...)
  2026-01-20 23:02 ` [PATCH 3/6] selftests: forwarding: lib: add run_cmd_grep helper for feature probing Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 5/6] selftests: forwarding: tc_flower_l2_miss: " Aleksei Oladko
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

The tc_flower_cfm.sh selftest assume the presence of iproute2
support for the `cfm` keyword in `tc filter` commands. These
assumptions can cause test failures.

This patch improves test robustness by skipping the test if
tc filter help does not mention CFM

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/tc_flower_cfm.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/tc_flower_cfm.sh b/tools/testing/selftests/net/forwarding/tc_flower_cfm.sh
index 3ca20df952eb..65f95fe88b38 100755
--- a/tools/testing/selftests/net/forwarding/tc_flower_cfm.sh
+++ b/tools/testing/selftests/net/forwarding/tc_flower_cfm.sh
@@ -196,6 +196,8 @@ cleanup()
 	vrf_cleanup
 }
 
+run_cmd_grep 'CFM' tc filter add dev lo ingress flower help || exit $ksft_skip
+
 trap cleanup EXIT
 
 setup_prepare
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] selftests: forwarding: tc_flower_l2_miss: skip tests if tools or feats are missing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
                   ` (3 preceding siblings ...)
  2026-01-20 23:02 ` [PATCH 4/6] selftests: forwarding: tc_flower_cfm: skip tests if tools or feats are missing Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-20 23:02 ` [PATCH 6/6] selftests: forwarding: router_mpath_seed: " Aleksei Oladko
  2026-01-21 12:24 ` [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Ido Schimmel
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

The tc_flower_l2_miss.sh selftest assume the presence of iproute2
support for the `l2_miss` keyword in `tc filter` commands. These
assumptions can cause test failures.

This patch improves test robustness by skipping the test if
tc filter help does not mention l2 miss

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh b/tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh
index c2420bb72c12..c28569b8948f 100755
--- a/tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh
+++ b/tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh
@@ -347,6 +347,8 @@ cleanup()
 	vrf_cleanup
 }
 
+run_cmd_grep 'l2_miss' tc filter add dev lo ingress flower help || exit $ksft_skip
+
 trap cleanup EXIT
 
 setup_prepare
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] selftests: forwarding: router_mpath_seed: skip tests if tools or feats are missing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
                   ` (4 preceding siblings ...)
  2026-01-20 23:02 ` [PATCH 5/6] selftests: forwarding: tc_flower_l2_miss: " Aleksei Oladko
@ 2026-01-20 23:02 ` Aleksei Oladko
  2026-01-21 12:24 ` [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Ido Schimmel
  6 siblings, 0 replies; 8+ messages in thread
From: Aleksei Oladko @ 2026-01-20 23:02 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

The router_mpath_seed.sh selftest assume the presence of iproute2
support for the `hw_stats` keyword in `ip nexthop` commands. These
assumptions can cause test failures.

This patch improves test robustness by skipping the test if
ip nexthop add help does not mention hw_stats

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
 tools/testing/selftests/net/forwarding/router_mpath_seed.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/router_mpath_seed.sh b/tools/testing/selftests/net/forwarding/router_mpath_seed.sh
index 314cb906c1eb..d9dc5d3a10d5 100755
--- a/tools/testing/selftests/net/forwarding/router_mpath_seed.sh
+++ b/tools/testing/selftests/net/forwarding/router_mpath_seed.sh
@@ -322,6 +322,8 @@ test_mpath_seed_stability_ipv6()
 			-p 64 -d 0 -c 10 -t udp
 }
 
+run_cmd_grep 'hw_stats' ip nexthop add help || exit $ksft_skip
+
 trap cleanup EXIT
 
 setup_prepare
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing
  2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
                   ` (5 preceding siblings ...)
  2026-01-20 23:02 ` [PATCH 6/6] selftests: forwarding: router_mpath_seed: " Aleksei Oladko
@ 2026-01-21 12:24 ` Ido Schimmel
  6 siblings, 0 replies; 8+ messages in thread
From: Ido Schimmel @ 2026-01-21 12:24 UTC (permalink / raw)
  To: Aleksei Oladko
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nikolay Aleksandrov,
	netdev, linux-kselftest, linux-kernel

On Tue, Jan 20, 2026 at 11:02:02PM +0000, Aleksei Oladko wrote:
> Hi,
> 
> Several forwarding selftests currently assume that certain kernel
> features or tc/ip capabilities are always present. When this is no the
> case (e.g. kernel built without specific CONFIG options or older
> iproute2).
> 
> This series adds explicit feature probing and conditional skips to
> avoid false negatives.
> 
> Summary of changes:
> 1. forwarding/lib: skip tests that require LAG devices when the team
>    driver is not supported (CONFIG_NET_TEAM disabled)
> 2. forwarding/sch_ets: skip tests if the cls_basic module is not
>    available (CONFIG_NET_CLS_BASIC disabled)

Both are mentioned in tools/testing/selftests/net/forwarding/config

> 3. forwarding/lib introduce run_cmd_grep helper to probe userspace
>    feature support by matching keywords in command help output
> 4. forwarding/tc_flower_cfm: skip test when tc does not support cfm
> 5. forwarding/tc_flower_l2_miss: skip test when tc does not support
>    l2_miss

Both are present in iproute2 v6.5 (September 2023).

> 6. forwarding/router_mpath_seed: skip tests then ip does not support
>    hw_stats

Present in iproute2 v6.10 (July 2024).

Latest version is v6.18.

I don't see the point in running netdev selftests with such old
versions. Especially when it should be relatively easy to put a new
version in PATH

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-21 12:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 23:02 [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Aleksei Oladko
2026-01-20 23:02 ` [PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported Aleksei Oladko
2026-01-20 23:02 ` [PATCH 2/6] selftests: forwarding: sch_ets: skip test if cls_basic module is missing Aleksei Oladko
2026-01-20 23:02 ` [PATCH 3/6] selftests: forwarding: lib: add run_cmd_grep helper for feature probing Aleksei Oladko
2026-01-20 23:02 ` [PATCH 4/6] selftests: forwarding: tc_flower_cfm: skip tests if tools or feats are missing Aleksei Oladko
2026-01-20 23:02 ` [PATCH 5/6] selftests: forwarding: tc_flower_l2_miss: " Aleksei Oladko
2026-01-20 23:02 ` [PATCH 6/6] selftests: forwarding: router_mpath_seed: " Aleksei Oladko
2026-01-21 12:24 ` [PATCH 0/6] selftests: forwarding: skip tests when kernel or userspace support is missing Ido Schimmel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox