Thread (8 messages) flat view 8 messages, 2 authors, 2026-01-21
STALE237d

[PATCH 1/6] selftests: forwarding: lib: skip test if team driver is not supported

From: Aleksei Oladko <hidden>
Date: 2026-01-20 23:02:33
Also in: linux-kselftest, lkml
Subsystem: kernel selftest framework, networking [general], networking [ipv4/ipv6], the rest · Maintainers: Shuah Khan, Shuah Khan, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help