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

Victor Cheng-Yen Yang via ltp <[email protected]>
Newsgroups it.linux.lists.ltp
Message-ID <[email protected]>
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 <[email protected]>
---
 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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.