[LTP] [PATCH] lib: test: check systemd in tst_virt_hyperv() as tst_test.sh

Victor Cheng-Yen Yang cyyang772@andestech.com
Thu Aug 20 09:21:33 CEST 2026


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.

Signed-off-by: Victor Cheng-Yen Yang <cyyang772@andestech.com>
---
 testcases/lib/test.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index d26cf5df0..edae1313e 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -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
-- 
2.34.1



More information about the ltp mailing list