linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Alessandro Ratti <alessandro@0x65c.net>
Cc: linux-kselftest@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, skhan@linuxfoundation.org
Subject: Re: [PATCH] selftests: rtnetlink: skip tests if tools or feats are missing
Date: Fri, 22 Aug 2025 01:09:13 +0000	[thread overview]
Message-ID: <aKfDOSx3C8NbMJsw@fedora> (raw)
In-Reply-To: <20250821142141.735075-2-alessandro@0x65c.net>

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>

  reply	other threads:[~2025-08-22  1:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKfDOSx3C8NbMJsw@fedora \
    --to=liuhangbin@gmail.com \
    --cc=alessandro@0x65c.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).