Enable CH community tests to run on Linux dom0

This commit is contained in:
Purna Pavan Chandra Aekkaladevi 2022-09-15 08:50:17 +05:30 коммит произвёл Chi Song
Родитель e56f3d65a0
Коммит 07c55585a6
2 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -16,7 +16,7 @@ from lisa import (
)
from lisa.operating_system import CBLMariner, Ubuntu
from lisa.testsuite import TestResult
from lisa.tools import Lscpu, Modprobe
from lisa.tools import Ls, Lscpu, Modprobe
from lisa.util import SkippedException
from microsoft.testsuites.cloud_hypervisor.ch_tests_tool import CloudHypervisorTests
@ -66,7 +66,10 @@ class CloudHypervisorTestSuite(TestSuite):
log_path: Path,
result: TestResult,
) -> None:
node.tools[CloudHypervisorTests].run_tests(result, environment, "integration")
hypervisor = self._get_hypervisor_param(node)
node.tools[CloudHypervisorTests].run_tests(
result, environment, "integration", hypervisor
)
@TestCaseMetadata(
description="""
@ -88,11 +91,19 @@ class CloudHypervisorTestSuite(TestSuite):
log_path: Path,
result: TestResult,
) -> None:
hypervisor = self._get_hypervisor_param(node)
node.tools[CloudHypervisorTests].run_tests(
result, environment, "integration-live-migration"
result, environment, "integration-live-migration", hypervisor
)
def _ensure_virtualization_enabled(self, node: Node) -> None:
virtualization_enabled = node.tools[Lscpu].is_virtualization_enabled()
if not virtualization_enabled:
mshv_exists = node.tools[Ls].path_exists(path="/dev/mshv", sudo=True)
if not virtualization_enabled and not mshv_exists:
raise SkippedException("Virtualization is not enabled in hardware")
def _get_hypervisor_param(self, node: Node) -> str:
mshv_exists = node.tools[Ls].path_exists(path="/dev/mshv", sudo=True)
if mshv_exists:
return "mshv"
return "kvm"

Просмотреть файл

@ -46,6 +46,7 @@ class CloudHypervisorTests(Tool):
test_result: TestResult,
environment: Environment,
test_type: str,
hypervisor: str,
skip: Optional[List[str]] = None,
) -> None:
if skip is not None:
@ -54,7 +55,8 @@ class CloudHypervisorTests(Tool):
skip_args = ""
result = self.run(
f"tests --{test_type} -- -- {skip_args} -Z unstable-options --format json",
f"tests --hypervisor {hypervisor} --{test_type} -- -- {skip_args}"
" -Z unstable-options --format json",
timeout=self.TIME_OUT,
force_run=True,
cwd=self.repo_root,