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.operating_system import CBLMariner, Ubuntu
from lisa.testsuite import TestResult from lisa.testsuite import TestResult
from lisa.tools import Lscpu, Modprobe from lisa.tools import Ls, Lscpu, Modprobe
from lisa.util import SkippedException from lisa.util import SkippedException
from microsoft.testsuites.cloud_hypervisor.ch_tests_tool import CloudHypervisorTests from microsoft.testsuites.cloud_hypervisor.ch_tests_tool import CloudHypervisorTests
@ -66,7 +66,10 @@ class CloudHypervisorTestSuite(TestSuite):
log_path: Path, log_path: Path,
result: TestResult, result: TestResult,
) -> None: ) -> 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( @TestCaseMetadata(
description=""" description="""
@ -88,11 +91,19 @@ class CloudHypervisorTestSuite(TestSuite):
log_path: Path, log_path: Path,
result: TestResult, result: TestResult,
) -> None: ) -> None:
hypervisor = self._get_hypervisor_param(node)
node.tools[CloudHypervisorTests].run_tests( node.tools[CloudHypervisorTests].run_tests(
result, environment, "integration-live-migration" result, environment, "integration-live-migration", hypervisor
) )
def _ensure_virtualization_enabled(self, node: Node) -> None: def _ensure_virtualization_enabled(self, node: Node) -> None:
virtualization_enabled = node.tools[Lscpu].is_virtualization_enabled() 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") 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, test_result: TestResult,
environment: Environment, environment: Environment,
test_type: str, test_type: str,
hypervisor: str,
skip: Optional[List[str]] = None, skip: Optional[List[str]] = None,
) -> None: ) -> None:
if skip is not None: if skip is not None:
@ -54,7 +55,8 @@ class CloudHypervisorTests(Tool):
skip_args = "" skip_args = ""
result = self.run( 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, timeout=self.TIME_OUT,
force_run=True, force_run=True,
cwd=self.repo_root, cwd=self.repo_root,