Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mshv: fix before_case in mshvlog_is_active test #3423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 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,16 @@ 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."
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly a formatting change. Flake8 reported a failure as the line was longer.


assert_that(mshvlog_running).is_true()

dmesg_logs = node.tools[Dmesg].get_output()
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
Loading