[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKfDOSx3C8NbMJsw@fedora>
Date: Fri, 22 Aug 2025 01:09:13 +0000
From: Hangbin Liu <liuhangbin@...il.com>
To: Alessandro Ratti <alessandro@...5c.net>
Cc: linux-kselftest@...r.kernel.org, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, netdev@...r.kernel.org,
pabeni@...hat.com, skhan@...uxfoundation.org
Subject: Re: [PATCH] selftests: rtnetlink: skip tests if tools or feats are
missing
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@...5c.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@...il.com>
Powered by blists - more mailing lists