Skip to content

Commit

Permalink
mshv: fix before_case in mshvlog_is_active test
Browse files Browse the repository at this point in the history
This test checks if CONFIG_MSHV_DIAG is enabled. If enabled, the test
requires /dev/mshv_diag device to be present.

Signed-off-by: Praveen K Paladugu <[email protected]>
  • Loading branch information
praveen-pk committed Sep 18, 2024
1 parent ea0f2f1 commit 00288f3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions microsoft/testsuites/mshv/mshv_root_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
TestSuiteMetadata,
)
from lisa.testsuite import TestResult
from lisa.tools import Dmesg, Ls, Service
from lisa.util import SkippedException
from lisa.tools import Dmesg, KernelConfig, Ls, Service
from lisa.util import LisaException, SkippedException


@TestSuiteMetadata(
Expand All @@ -33,12 +33,13 @@ class MshvHostTestSuite(TestSuite):

def before_case(self, log: Logger, **kwargs: Any) -> None:
node = kwargs["node"]
if not node.tools[Ls].path_exists("/dev/mshv", sudo=True):
raise SkippedException("This suite is for MSHV root partition only")
if not node.tools[KernelConfig].is_enabled("CONFIG_MSHV_DIAG"):
raise SkippedException("MSHV_DIAG not enabled, skip")

if not node.tools[Ls].path_exists("/dev/mshv_diag", sudo=True):
raise SkippedException(
"mshv_diag module should be loaded on MSHV root parition."
raise LisaException(
"mshv_diag device should exist, when CONFIG_MSHV_DIAG is"
" enabled."
)

@TestCaseMetadata(
Expand All @@ -62,12 +63,14 @@ def verify_mshvlog_is_active(
self._save_dmesg_logs(node, log_path)
mshvlog_running = node.tools[Service].is_service_running("mshvlog")
if not mshvlog_running:
log.error("mshvlog service is not running on MSHV root partition.")
log.error("mshvlog service is not running on MSHV root"
" partition.")

assert_that(mshvlog_running).is_true()

dmesg_logs = node.tools[Dmesg].get_output()
mshvdiag_dmesg_logs = re.search(self.mshvdiag_dmesg_pattern, dmesg_logs)
mshvdiag_dmesg_logs = re.search(self.mshvdiag_dmesg_pattern,
dmesg_logs)
if mshvdiag_dmesg_logs is not None:
log.error(
f"mshv_diag module reported errors in dmesg: "
Expand Down

0 comments on commit 00288f3

Please sign in to comment.