[Devel] [PATCH RHEL10 COMMIT] ms/selftests: rtnetlink: skip tests if tools or feats are missing

Konstantin Khorenko khorenko at virtuozzo.com
Tue Dec 23 12:49:32 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.3.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.3.26.vz10
------>
commit a68ff07c5b273684830127a69782a982446aecfc
Author: Alessandro Ratti <alessandro at 0x65c.net>
Date:   Tue Dec 16 21:04:13 2025 +0000

    ms/selftests: rtnetlink: skip tests if tools or feats are missing
    
    Some rtnetlink selftests assume the presence of ifconfig and iproute2
    support for the `proto` keyword in `ip address` commands. These
    assumptions can cause test failures on modern systems (e.g. Debian
    Bookworm) where:
    
     - ifconfig is not installed by default
     - The iproute2 version lacks support for address protocol
    
    This patch improves test robustness by:
    
     - Skipping kci_test_promote_secondaries if ifconfig is missing
     - Skipping do_test_address_proto if ip address help does not mention
       proto
    
    These changes ensure the tests degrade gracefully by reporting SKIP
    instead of FAIL when prerequisites are not met, improving portability
    across systems.
    
    Reviewed-by: Hangbin Liu <liuhangbin at gmail.com>
    Signed-off-by: Alessandro Ratti <alessandro at 0x65c.net>
    Link: https://patch.msgid.link/20250822140633.891360-2-alessandro@0x65c.net
    Signed-off-by: Jakub Kicinski <kuba at kernel.org>
    
    https://virtuozzo.atlassian.net/browse/VSTOR-120995
    (cherry picked from commit e79012967b26134f507efe93ec4b4e6c13d92950)
    Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
    
    Feature: fix ms/selftests
---
 tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index b630532025240..e7a682183703b 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -311,6 +311,11 @@ kci_test_addrlft()
 
 kci_test_promote_secondaries()
 {
+	run_cmd ifconfig "$devdummy"
+	if [ $ret -ne 0 ]; then
+		end_test "SKIP: ifconfig not installed"
+		return $ksft_skip
+	fi
 	promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
 
 	sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1
@@ -1176,6 +1181,12 @@ do_test_address_proto()
 	local ret=0
 	local err
 
+	run_cmd_grep 'proto' ip address help
+	if [ $? -ne 0 ];then
+		end_test "SKIP: addr proto ${what}: iproute2 too old"
+		return $ksft_skip
+	fi
+
 	ip address add dev "$devdummy" "$addr3"
 	check_err $?
 	proto=$(address_get_proto "$addr3")


More information about the Devel mailing list