* [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 @ 2025-08-21 7:43 Alessandro Ratti 2025-08-21 7:43 ` Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-21 7:43 UTC (permalink / raw) To: davem, edumazet, kuba, pabeni, skhan Cc: netdev, linux-kselftest, alessandro.ratti Hi, This patch improves portability of the rtnetlink selftests in two ways: 1. It wraps a call to ifconfig in a presence check to avoid test failures on systems where ifconfig is not installed — such as default Debian Bookworm and newer distributions where iproute2 is the norm. 2. It skips the do_test_address_proto test if the installed version of iproute2 does not support the proto in ip address commands. Without this check, the test fails unconditionally on older iproute2 versions, even though the kernel functionality under test is not the culprit. Both changes ensure that the test suite degrades gracefully by reporting SKIP instead of FAIL on incompatible systems. Tested on Debian Bookworm with iproute2 6.1.0 and without ifconfig. Thanks for your time and consideration. Best regards, Alessandro Ratti ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 2025-08-21 7:43 [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 Alessandro Ratti @ 2025-08-21 7:43 ` Alessandro Ratti 2025-08-21 8:25 ` Hangbin Liu 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-21 7:43 UTC (permalink / raw) To: davem, edumazet, kuba, pabeni, skhan Cc: netdev, linux-kselftest, alessandro.ratti, Alessandro Ratti On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check. Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported. These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools. Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> --- tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ kci_test_promote_secondaries() for i in $(seq 2 254);do IP="10.23.11.$i" ip -f inet addr add $IP/16 brd + dev "$devdummy" - ifconfig "$devdummy" $IP netmask 255.255.0.0 + if command -v ifconfig >/dev/null 2>&1; then + ifconfig "$devdummy" $IP netmask 255.255.0.0 + fi done ip addr flush dev "$devdummy" @@ -1201,6 +1203,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") -- 2.39.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 2025-08-21 7:43 ` Alessandro Ratti @ 2025-08-21 8:25 ` Hangbin Liu 2025-08-21 8:45 ` Alessandro 0 siblings, 1 reply; 16+ messages in thread From: Hangbin Liu @ 2025-08-21 8:25 UTC (permalink / raw) To: Alessandro Ratti Cc: davem, edumazet, kuba, pabeni, skhan, netdev, linux-kselftest, alessandro.ratti On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote: > On systems where `ifconfig` is not available (e.g., modern Debian), the > `kci_test_promote_secondaries` test fails. Wrap the call in a check. > > Additionally, `do_test_address_proto` fails on iproute2 versions that > lack support for `proto` in `ip address` commands. Add a minimal feature > check and skip the test with a proper message if unsupported. > > These changes allow the tests to run and report SKIP instead of FAIL on > platforms with older tools. > > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > --- > tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh > index d6c00efeb664..9bff620ef595 100755 > --- a/tools/testing/selftests/net/rtnetlink.sh > +++ b/tools/testing/selftests/net/rtnetlink.sh > @@ -330,7 +330,9 @@ kci_test_promote_secondaries() > for i in $(seq 2 254);do > IP="10.23.11.$i" > ip -f inet addr add $IP/16 brd + dev "$devdummy" > - ifconfig "$devdummy" $IP netmask 255.255.0.0 > + if command -v ifconfig >/dev/null 2>&1; then > + ifconfig "$devdummy" $IP netmask 255.255.0.0 > + fi Maybe just skip the promote_secondaries test if ifconfig is not available? Hangbin > done > > ip addr flush dev "$devdummy" > @@ -1201,6 +1203,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") > -- > 2.39.5 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 2025-08-21 8:25 ` Hangbin Liu @ 2025-08-21 8:45 ` Alessandro 2025-08-21 8:58 ` Hangbin Liu 0 siblings, 1 reply; 16+ messages in thread From: Alessandro @ 2025-08-21 8:45 UTC (permalink / raw) To: Hangbin Liu Cc: Alessandro Ratti, davem, edumazet, kuba, pabeni, skhan, netdev, linux-kselftest On Thu, 21 Aug 2025 at 10:25, Hangbin Liu <liuhangbin@gmail.com> wrote: > > On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote: > > On systems where `ifconfig` is not available (e.g., modern Debian), the > > `kci_test_promote_secondaries` test fails. Wrap the call in a check. > > > > Additionally, `do_test_address_proto` fails on iproute2 versions that > > lack support for `proto` in `ip address` commands. Add a minimal feature > > check and skip the test with a proper message if unsupported. > > > > These changes allow the tests to run and report SKIP instead of FAIL on > > platforms with older tools. > > > > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > > --- > > tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh > > index d6c00efeb664..9bff620ef595 100755 > > --- a/tools/testing/selftests/net/rtnetlink.sh > > +++ b/tools/testing/selftests/net/rtnetlink.sh > > @@ -330,7 +330,9 @@ kci_test_promote_secondaries() > > for i in $(seq 2 254);do > > IP="10.23.11.$i" > > ip -f inet addr add $IP/16 brd + dev "$devdummy" > > - ifconfig "$devdummy" $IP netmask 255.255.0.0 > > + if command -v ifconfig >/dev/null 2>&1; then > > + ifconfig "$devdummy" $IP netmask 255.255.0.0 > > + fi > > Maybe just skip the promote_secondaries test if ifconfig is not available? > Thank you for your review and comment. My takeaway here is that the test works because the IP addresses are set on the $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant. Also, considering we are testing netlink, I was baffled to see ifconfig there that, if I'm not mistaken, uses ioctl(); but I might be missing something obvious here, considering I'm looking at these tests for the first time, so bear with me :) If it's better to skip the test altogether when ifconfig is missing, I'll submit another patch to do so. Thank you Best regards, Alessandro ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 2025-08-21 8:45 ` Alessandro @ 2025-08-21 8:58 ` Hangbin Liu 2025-08-21 9:43 ` Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Hangbin Liu @ 2025-08-21 8:58 UTC (permalink / raw) To: Alessandro; +Cc: davem, edumazet, kuba, pabeni, skhan, netdev, linux-kselftest On Thu, Aug 21, 2025 at 10:45:19AM +0200, Alessandro wrote: > On Thu, 21 Aug 2025 at 10:25, Hangbin Liu <liuhangbin@gmail.com> wrote: > > > > On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote: > > > On systems where `ifconfig` is not available (e.g., modern Debian), the > > > `kci_test_promote_secondaries` test fails. Wrap the call in a check. > > > > > > Additionally, `do_test_address_proto` fails on iproute2 versions that > > > lack support for `proto` in `ip address` commands. Add a minimal feature > > > check and skip the test with a proper message if unsupported. > > > > > > These changes allow the tests to run and report SKIP instead of FAIL on > > > platforms with older tools. > > > > > > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > > > --- > > > tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- > > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh > > > index d6c00efeb664..9bff620ef595 100755 > > > --- a/tools/testing/selftests/net/rtnetlink.sh > > > +++ b/tools/testing/selftests/net/rtnetlink.sh > > > @@ -330,7 +330,9 @@ kci_test_promote_secondaries() > > > for i in $(seq 2 254);do > > > IP="10.23.11.$i" > > > ip -f inet addr add $IP/16 brd + dev "$devdummy" > > > - ifconfig "$devdummy" $IP netmask 255.255.0.0 > > > + if command -v ifconfig >/dev/null 2>&1; then > > > + ifconfig "$devdummy" $IP netmask 255.255.0.0 > > > + fi > > > > Maybe just skip the promote_secondaries test if ifconfig is not available? > > > > Thank you for your review and comment. > > My takeaway here is that the test works because the IP addresses are set on the > $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant. No, please check the git log to see why we use ifconfig here. Thanks Hangbin > > Also, considering we are testing netlink, I was baffled to see ifconfig there > that, if I'm not mistaken, uses ioctl(); but I might be missing > something obvious > here, considering I'm looking at these tests for the first time, so bear with > me :) > > If it's better to skip the test altogether when ifconfig is missing, I'll > submit another patch to do so. > > Thank you > > Best regards, > Alessandro ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 2025-08-21 8:58 ` Hangbin Liu @ 2025-08-21 9:43 ` Alessandro Ratti 2025-08-21 14:16 ` [PATCH v2] selftests: rtnetlink: skip tests if tools or feats are missing Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-21 9:43 UTC (permalink / raw) To: Hangbin Liu Cc: Alessandro, davem, edumazet, kuba, pabeni, skhan, netdev, linux-kselftest On Thu, 21 Aug 2025 at 10:59, Hangbin Liu <liuhangbin@gmail.com> wrote: > > On Thu, Aug 21, 2025 at 10:45:19AM +0200, Alessandro wrote: > > On Thu, 21 Aug 2025 at 10:25, Hangbin Liu <liuhangbin@gmail.com> wrote: > > > > > > On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote: > > > > On systems where `ifconfig` is not available (e.g., modern Debian), the > > > > `kci_test_promote_secondaries` test fails. Wrap the call in a check. > > > > > > > > Additionally, `do_test_address_proto` fails on iproute2 versions that > > > > lack support for `proto` in `ip address` commands. Add a minimal feature > > > > check and skip the test with a proper message if unsupported. > > > > > > > > These changes allow the tests to run and report SKIP instead of FAIL on > > > > platforms with older tools. > > > > > > > > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > > > > --- > > > > tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- > > > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh > > > > index d6c00efeb664..9bff620ef595 100755 > > > > --- a/tools/testing/selftests/net/rtnetlink.sh > > > > +++ b/tools/testing/selftests/net/rtnetlink.sh > > > > @@ -330,7 +330,9 @@ kci_test_promote_secondaries() > > > > for i in $(seq 2 254);do > > > > IP="10.23.11.$i" > > > > ip -f inet addr add $IP/16 brd + dev "$devdummy" > > > > - ifconfig "$devdummy" $IP netmask 255.255.0.0 > > > > + if command -v ifconfig >/dev/null 2>&1; then > > > > + ifconfig "$devdummy" $IP netmask 255.255.0.0 > > > > + fi > > > > > > Maybe just skip the promote_secondaries test if ifconfig is not available? > > > > > > > Thank you for your review and comment. > > > > My takeaway here is that the test works because the IP addresses are set on the > > $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant. > > No, please check the git log to see why we use ifconfig here. > Ah! I see your point now. That said, yes, better skip the test if ifconfig isn't installed. I'll send out a new patch. Thank you Alessandro ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-21 9:43 ` Alessandro Ratti @ 2025-08-21 14:16 ` Alessandro Ratti 2025-08-21 14:16 ` [PATCH] " Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-21 14:16 UTC (permalink / raw) To: alessandro, linux-kselftest, liuhangbin Cc: davem, edumazet, kuba, netdev, pabeni, skhan Hi, Following up on Hangbin's comment, here is the updated patch with adjustments to skip tests gracefully when missing tools and iproute2 capabilities. Thanks for your time and consideration. Best regards, Alessandro Ratti ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-21 14:16 ` [PATCH v2] selftests: rtnetlink: skip tests if tools or feats are missing Alessandro Ratti @ 2025-08-21 14:16 ` Alessandro Ratti 2025-08-22 1:09 ` Hangbin Liu 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-21 14:16 UTC (permalink / raw) To: alessandro, linux-kselftest, liuhangbin Cc: davem, edumazet, kuba, netdev, pabeni, skhan 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. Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> --- 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 d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,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 @@ -1201,6 +1206,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") -- 2.39.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-21 14:16 ` [PATCH] " Alessandro Ratti @ 2025-08-22 1:09 ` Hangbin Liu 2025-08-22 12:08 ` [PATCH net-next v2] " Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Hangbin Liu @ 2025-08-22 1:09 UTC (permalink / raw) To: Alessandro Ratti Cc: linux-kselftest, davem, edumazet, kuba, netdev, pabeni, skhan On Thu, Aug 21, 2025 at 04:16:51PM +0200, Alessandro Ratti wrote: > 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. > > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > --- > 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 d6c00efeb664..c2a0e7f37391 100755 > --- a/tools/testing/selftests/net/rtnetlink.sh > +++ b/tools/testing/selftests/net/rtnetlink.sh > @@ -323,6 +323,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 > @@ -1201,6 +1206,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") > -- > 2.39.5 > Hi Alessandro, Next time, please add the version tag and target branch in the subject. e.g. [PATCHv2 net-next] your subject I'm not sure if the lack of a version number will have an impact on the patch work. The change looks good to me. Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v2] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 1:09 ` Hangbin Liu @ 2025-08-22 12:08 ` Alessandro Ratti 2025-08-22 12:08 ` Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-22 12:08 UTC (permalink / raw) To: liuhangbin Cc: alessandro, davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan On Fri, 22 Aug 2025 at 03:09, Hangbin Liu <liuhangbin@gmail.com> wrote: > > Hi Alessandro, > > Next time, please add the version tag and target branch in the subject. > e.g. [PATCHv2 net-next] your subject > > I'm not sure if the lack of a version number will have an impact on the > patch work. > > The change looks good to me. > > Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> > Hi Hangbin, Thank you again for the review and for pointing out the correct subject format. Apologies for the oversight — I’ve updated the patch accordingly and am re-sending it with the correct subject line and the Reviewed-by tag. Lesson learned for next time :) Best regards, Alessandro ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v2] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 12:08 ` [PATCH net-next v2] " Alessandro Ratti @ 2025-08-22 12:08 ` Alessandro Ratti 2025-08-22 13:03 ` Hangbin Liu 0 siblings, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-22 12:08 UTC (permalink / raw) To: liuhangbin Cc: alessandro, davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan 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. Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> --- v2: - Updated the patch based on review from Hangbin Liu - Changed subject and commit message to better reflect updated behavior - Added Reviewed-by tag Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> --- 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 d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,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 @@ -1201,6 +1206,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") -- 2.39.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 12:08 ` Alessandro Ratti @ 2025-08-22 13:03 ` Hangbin Liu 2025-08-22 14:03 ` [PATCH net-next v3] " Alessandro Ratti 0 siblings, 1 reply; 16+ messages in thread From: Hangbin Liu @ 2025-08-22 13:03 UTC (permalink / raw) To: Alessandro Ratti Cc: davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan On Fri, Aug 22, 2025 at 02:08:42PM +0200, Alessandro Ratti wrote: > 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. > The Reviewed-by tag should be here Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> > > --- > v2: > - Updated the patch based on review from Hangbin Liu > - Changed subject and commit message to better reflect updated behavior > - Added Reviewed-by tag > > Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> > --- > 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 d6c00efeb664..c2a0e7f37391 100755 > --- a/tools/testing/selftests/net/rtnetlink.sh > +++ b/tools/testing/selftests/net/rtnetlink.sh > @@ -323,6 +323,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 > @@ -1201,6 +1206,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") > -- > 2.39.5 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v3] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 13:03 ` Hangbin Liu @ 2025-08-22 14:03 ` Alessandro Ratti 2025-08-22 14:03 ` Alessandro Ratti 2025-08-22 14:27 ` Jakub Kicinski 0 siblings, 2 replies; 16+ messages in thread From: Alessandro Ratti @ 2025-08-22 14:03 UTC (permalink / raw) To: liuhangbin Cc: alessandro, davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan On Fri, 22 Aug 2025 at 15:03, Hangbin Liu <liuhangbin@gmail.com> wrote: > > The Reviewed-by tag should be here > > Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> Thanks again for your feedback on the previous version. This is v3 of the patch, with the `Reviewed-by:` tag now correctly placed above the `Signed-off-by:` line as per your suggestion. Changelog: v3: - Moved Reviewed-by tag above Signed-off-by tag Best regards, Alessandro ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v3] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 14:03 ` [PATCH net-next v3] " Alessandro Ratti @ 2025-08-22 14:03 ` Alessandro Ratti 2025-08-25 23:10 ` patchwork-bot+netdevbpf 2025-08-22 14:27 ` Jakub Kicinski 1 sibling, 1 reply; 16+ messages in thread From: Alessandro Ratti @ 2025-08-22 14:03 UTC (permalink / raw) To: liuhangbin Cc: alessandro, davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan 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@gmail.com> Signed-off-by: Alessandro Ratti <alessandro@0x65c.net> --- v2: - Updated the patch based on review from Hangbin Liu - Changed subject and commit message to better reflect updated behavior - Added Reviewed-by tag v3: - Amend Reviewed-by tag position --- 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 d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,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 @@ -1201,6 +1206,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") -- 2.39.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v3] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 14:03 ` Alessandro Ratti @ 2025-08-25 23:10 ` patchwork-bot+netdevbpf 0 siblings, 0 replies; 16+ messages in thread From: patchwork-bot+netdevbpf @ 2025-08-25 23:10 UTC (permalink / raw) To: Alessandro Ratti Cc: liuhangbin, davem, edumazet, kuba, linux-kselftest, netdev, pabeni, skhan Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Fri, 22 Aug 2025 16:03:40 +0200 you wrote: > 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 > > [...] Here is the summary with links: - [net-next,v3] selftests: rtnetlink: skip tests if tools or feats are missing https://git.kernel.org/netdev/net-next/c/e79012967b26 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v3] selftests: rtnetlink: skip tests if tools or feats are missing 2025-08-22 14:03 ` [PATCH net-next v3] " Alessandro Ratti 2025-08-22 14:03 ` Alessandro Ratti @ 2025-08-22 14:27 ` Jakub Kicinski 1 sibling, 0 replies; 16+ messages in thread From: Jakub Kicinski @ 2025-08-22 14:27 UTC (permalink / raw) To: Alessandro Ratti Cc: liuhangbin, davem, edumazet, linux-kselftest, netdev, pabeni, skhan On Fri, 22 Aug 2025 16:03:39 +0200 Alessandro Ratti wrote: > Thanks again for your feedback on the previous version. > > This is v3 of the patch, with the `Reviewed-by:` tag now correctly > placed above the `Signed-off-by:` line as per your suggestion. Do me a favor and read this please: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-08-25 23:10 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-21 7:43 [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2 Alessandro Ratti 2025-08-21 7:43 ` Alessandro Ratti 2025-08-21 8:25 ` Hangbin Liu 2025-08-21 8:45 ` Alessandro 2025-08-21 8:58 ` Hangbin Liu 2025-08-21 9:43 ` Alessandro Ratti 2025-08-21 14:16 ` [PATCH v2] selftests: rtnetlink: skip tests if tools or feats are missing Alessandro Ratti 2025-08-21 14:16 ` [PATCH] " Alessandro Ratti 2025-08-22 1:09 ` Hangbin Liu 2025-08-22 12:08 ` [PATCH net-next v2] " Alessandro Ratti 2025-08-22 12:08 ` Alessandro Ratti 2025-08-22 13:03 ` Hangbin Liu 2025-08-22 14:03 ` [PATCH net-next v3] " Alessandro Ratti 2025-08-22 14:03 ` Alessandro Ratti 2025-08-25 23:10 ` patchwork-bot+netdevbpf 2025-08-22 14:27 ` Jakub Kicinski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).