Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Alessandro Ratti <alessandro@0x65c.net>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, skhan@linuxfoundation.org,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	alessandro.ratti@gmail.com
Subject: Re: [PATCH] selftests: rtnetlink: add checks for ifconfig and iproute2
Date: Thu, 21 Aug 2025 08:25:32 +0000	[thread overview]
Message-ID: <aKbX_CzxSi7T9Bcp@fedora> (raw)
In-Reply-To: <20250821074552.682731-2-alessandro@0x65c.net>

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
> 

  reply	other threads:[~2025-08-21  8:25 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 [this message]
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

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=aKbX_CzxSi7T9Bcp@fedora \
    --to=liuhangbin@gmail.com \
    --cc=alessandro.ratti@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