[Devel] [PATCH vz10 3/4] selftests: net: rtnetlink: skip erspan test if device type is unsupported

Aleksei Oladko aleksey.oladko at virtuozzo.com
Sun Jan 4 04:50:27 MSK 2026


The net kselftest rtnetlink.sh tries to create an erspan device using:

  ip link add dev erspan00 type erspan...

On kernels built without erspan support this fails with:

  Error: Unknown device type.

and causes the entire test to fail.

Skip the test when erspan devices cannot be created.

https://virtuozzo.atlassian.net/browse/VSTOR-121804

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

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index e7a682183703..94f71f39b3dc 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -65,6 +65,9 @@ run_cmd_common()
 	fi
 	out=$($cmd 2>&1)
 	rc=$?
+	if [[ "$out" == *"Error: Unknown device type"* ]]; then
+		skip_test=1
+	fi
 	if [ "$VERBOSE" = "1" -a -n "$out" ]; then
 		echo "    $out"
 	fi
@@ -934,6 +937,7 @@ kci_test_erspan()
 {
 	DEV_NS=erspan00
 	local ret=0
+	local skip_test=0
 	run_cmd_grep "^Usage:" ip link help erspan
 	if [ $? -ne 0 ];then
 		end_test "SKIP: erspan: iproute2 too old"
@@ -949,6 +953,11 @@ kci_test_erspan()
 	run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
 		key 102 local 172.16.1.100 remote 172.16.1.200 \
 		erspan_ver 1 erspan 488
+	if [ $skip_test -ne 0 ]; then
+		end_test "SKIP: erspan tests: not supported"
+		ip netns del "$testns"
+		return $ksft_skip
+	fi
 
 
 	run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
-- 
2.43.0



More information about the Devel mailing list