Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: rtnetlink: skip ifalias test if uuidgen is missing
@ 2026-10-08 18:37 Darío Hueso Gisbert
  2026-10-09  2:18 ` Hangbin Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Darío Hueso Gisbert @ 2026-10-08 18:37 UTC (permalink / raw)
  To: netdev
  Cc: Darío Hueso Gisbert, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
	linux-kselftest, linux-kernel

kci_test_ifalias() uses uuidgen to generate the alias names, but
uuidgen is not always installed on minimal systems. When it is
missing, the test fails with "uuidgen: command not found" instead of
being reported as skipped.

Check for uuidgen before running the test and return SKIP when it is
not available, as kci_test_promote_secondaries() already does for
ifconfig.

Assisted-by: LLM
Signed-off-by: Darío Hueso Gisbert <darihueso21@gmail.com>
---
The commit message and the added check were drafted with the help of
an LLM (Claude). I reviewed both and tested the script on a kernel
built from mainline, with uuidgen installed (unchanged behaviour) and
with it removed (the ifalias test now reports SKIP instead of FAIL).

On that kernel the unrelated ipsec_offload test fails with and without
this change.

 tools/testing/selftests/net/rtnetlink.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 4843d474538f..c758efb734da 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -412,6 +412,13 @@ kci_test_addrlabel()
 kci_test_ifalias()
 {
 	local ret=0
+
+	run_cmd uuidgen
+	if [ $ret -ne 0 ]; then
+		end_test "SKIP: uuidgen not installed"
+		return $ksft_skip
+	fi
+
 	namewant=$(uuidgen)
 	syspathname="/sys/class/net/$devdummy/ifalias"
 	run_cmd ip link set dev "$devdummy" alias "$namewant"
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: skip ifalias test if uuidgen is missing
  2026-10-08 18:37 [PATCH net-next] selftests: rtnetlink: skip ifalias test if uuidgen is missing Darío Hueso Gisbert
@ 2026-10-09  2:18 ` Hangbin Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Hangbin Liu @ 2026-10-09  2:18 UTC (permalink / raw)
  To: Darío Hueso Gisbert
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Shuah Khan, linux-kselftest,
	linux-kernel

Hi Darío,
On Thu, Oct 08, 2026 at 08:37:41PM +0200, Darío Hueso Gisbert wrote:
> kci_test_ifalias() uses uuidgen to generate the alias names, but
> uuidgen is not always installed on minimal systems. When it is
> missing, the test fails with "uuidgen: command not found" instead of
> being reported as skipped.
> 
> Check for uuidgen before running the test and return SKIP when it is
> not available, as kci_test_promote_secondaries() already does for
> ifconfig.
> 
> Assisted-by: LLM
> Signed-off-by: Darío Hueso Gisbert <darihueso21@gmail.com>
> ---
> The commit message and the added check were drafted with the help of
> an LLM (Claude). I reviewed both and tested the script on a kernel
> built from mainline, with uuidgen installed (unchanged behaviour) and
> with it removed (the ifalias test now reports SKIP instead of FAIL).
> 
> On that kernel the unrelated ipsec_offload test fails with and without
> this change.
> 
>  tools/testing/selftests/net/rtnetlink.sh | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index 4843d474538f..c758efb734da 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -412,6 +412,13 @@ kci_test_addrlabel()
>  kci_test_ifalias()
>  {
>  	local ret=0
> +
> +	run_cmd uuidgen
> +	if [ $ret -ne 0 ]; then
> +		end_test "SKIP: uuidgen not installed"
> +		return $ksft_skip
> +	fi

You can use check_command, which will log test and return correctly.

Thanks
Hangbin
> +
>  	namewant=$(uuidgen)
>  	syspathname="/sys/class/net/$devdummy/ifalias"
>  	run_cmd ip link set dev "$devdummy" alias "$namewant"
> -- 
> 2.53.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-09  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 18:37 [PATCH net-next] selftests: rtnetlink: skip ifalias test if uuidgen is missing Darío Hueso Gisbert
2026-10-09  2:18 ` Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox