@@ -50,21 +50,6 @@ assert () # If condition false,
fi
}
-# Detect whether running under hypervisor: Microsoft Hyper-V
-# Return 0: running under Hyper-V
-# Return 1: not running under Hyper-V (bare metal, other hypervisor or
-# failure of detection)
-tst_virt_hyperv()
-{
- local v="$(systemd-detect-virt)"
- # TODO: once converted to newlib, use tst_cmd_available
-
- [ $? -eq 0 ] || return 1
- [ "$v" = "microsoft" ] || return 1
-
- return 0
-}
-
############################################################
## Process management ##
############################################################
@@ -321,6 +321,22 @@ tst_mkfs()
ROD_SILENT mkfs.$fs_type $fs_opts $device
}
+# Detect whether running under hypervisor: Microsoft Hyper-V
+# Return 0: running under Hyper-V
+# Return 1: not running under Hyper-V (bare metal, other hypervisor or
+# failure of detection)
+tst_virt_hyperv()
+{
+ local v
+
+ v="$(systemd-detect-virt)"
+
+ [ $? -eq 0 ] || return 1
+ [ "$v" = "microsoft" ] || return 1
+
+ return 0
+}
+
tst_umount()
{
local device="$1"
@@ -326,6 +326,24 @@ tst_mkfs()
ROD_SILENT mkfs.$fs_type $fs_opts $device
}
+# Detect whether running under hypervisor: Microsoft Hyper-V
+# Return 0: running under Hyper-V
+# Return 1: not running under Hyper-V (bare metal, other hypervisor or
+# failure of detection)
+tst_virt_hyperv()
+{
+ local v
+
+ tst_cmd_available systemd-detect-virt || return 1
+
+ v="$(systemd-detect-virt)"
+
+ [ $? -eq 0 ] || return 1
+ [ "$v" = "microsoft" ] || return 1
+
+ return 0
+}
+
tst_cmd_available()
{
if type command > /dev/null 2>&1; then
Move the Microsoft Hyper-V detection to lib/ so it can be reused in further tests. Add it also to the newlib. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- Changes since v1: 1. New patch. --- .../include/cpuhotplug_testsuite.sh | 15 --------------- testcases/lib/test.sh | 16 ++++++++++++++++ testcases/lib/tst_test.sh | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 15 deletions(-)