Skip to contentSkip to conversation

selftests: rtnetlink: skip ifalias test if uuidgen is missing

PATCH In review Darío Hueso Gisbert 2 participants 2 messages Oct 8 – Oct 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: rtnetlink: skip ifalias test if uuidgen is missing

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

---
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(+)
tools/testing/selftests/net/rtnetlink.sh +7 -0
index 4843d474538f..c758efb734da 100755
@@ -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"
Signature · 1 line
2.53.0
#1 lore raw

Hi Darío,

Quoted 28 lines · Darío Hueso Gisbert

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

---
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(+)
tools/testing/selftests/net/rtnetlink.sh +0 -0
index 4843d474538f..c758efb734da 100755

tools/testing/selftests/net/rtnetlink.sh kci_test_addrlabel() · line 420

Quoted 9 lines
tools/testing/selftests/net/rtnetlink.sh +6 -0
@@ -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

Quoted 7 lines
tools/testing/selftests/net/rtnetlink.sh +1 -0
+
 	namewant=$(uuidgen)
 	syspathname="/sys/class/net/$devdummy/ifalias"
 	run_cmd ip link set dev "$devdummy" alias "$namewant"
Signature · 1 line
2.53.0