Skip to contentSkip to conversation

lib: test: check systemd in tst_virt_hyperv() as tst_test.sh

PATCH In review Victor Cheng-Yen Yang via ltp 3 participants 3 messages Aug 20 – Aug 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: test: check systemd in tst_virt_hyperv() as tst_test.sh

Guard tst_virt_hyperv() in the old shell API with a command lookup, as the tst_test.sh version already does. Without systemd installed every test calling it printed "systemd-detect-virt: not found" to stderr.

---
 testcases/lib/test.sh | 2 ++
 1 file changed, 2 insertions(+)
testcases/lib/test.sh +2 -0
index d26cf5df0..edae1313e 100644
@@ -331,6 +331,8 @@ tst_virt_hyperv()
 {
 	local v
 
+	command -v systemd-detect-virt > /dev/null 2>&1 || return 1
+
 	v="$(systemd-detect-virt)"
 
 	[ $? -eq 0 ] || return 1
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Victor,

Quoted 1 line · Victor Cheng-Yen Yang

lib: test: check systemd in tst_virt_hyperv() as tst_test.sh

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Victor Cheng-Yen Yang via ltp

Hi Victor,

Quoted 3 lines

Guard tst_virt_hyperv() in the old shell API with a command lookup, as the tst_test.sh version already does. Without systemd installed every test calling it printed "systemd-detect-virt: not found" to stderr.

Thanks for your fix, merged.

FYI I send a follow up

https://patchwork.kernel.org/project/ltp/patch/[email protected]/
https://lore.kernel.org/ltp/[email protected]/T/#u

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp