Skip to content

Commit

Permalink
Add verify_supports_nvme
Browse files Browse the repository at this point in the history
This test case checks whether the NVMe drivers are present such that the image can boot with DiskControllerType NVMe.
  • Loading branch information
kamalca committed Dec 27, 2023
1 parent 2c2c5c9 commit 529ffbb
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion microsoft/testsuites/core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@
from lisa.sut_orchestrator import AZURE
from lisa.sut_orchestrator.azure.features import AzureDiskOptionSettings, AzureFileShare
from lisa.sut_orchestrator.azure.tools import Waagent
from lisa.tools import Blkid, Cat, Dmesg, Echo, Lsblk, Mount, NFSClient, Swap, Sysctl
from lisa.tools import (
Blkid,
Cat,
Dmesg,
Echo,
Lsblk,
Lsinitrd,
Mount,
NFSClient,
Swap,
Sysctl,
)
from lisa.tools.blkid import PartitionInfo
from lisa.tools.journalctl import Journalctl
from lisa.tools.kernel_config import KernelConfig
Expand Down Expand Up @@ -270,6 +281,27 @@ def verify_scsi_disk_controller_type(self, node: RemoteNode) -> None:
def verify_nvme_disk_controller_type(self, node: RemoteNode) -> None:
self._verify_disk_controller_type(node, DiskControllerType.NVME)

@TestCaseMetadata(
description="""
This test verifies the nvme drivers are either built in or present in initramfs.
This test can be used to verify an image before it is tagged as NVMe capable.
""",
priority=1,
)
def verify_supports_nvme(self, node: RemoteNode) -> None:
_has_nvme_core = node.tools[KernelConfig].is_built_in("CONFIG_NVME_CORE") or (
node.tools[KernelConfig].is_built_as_module("CONFIG_NVME_CORE")
and node.tools[Lsinitrd].has_module("nvme-core.ko")
)
_has_nvme = node.tools[KernelConfig].is_built_in("CONFIG_BLK_DEV_NVME") or (
node.tools[KernelConfig].is_built_as_module("CONFIG_BLK_DEV_NVME")
and node.tools[Lsinitrd].has_module("nvme.ko")
)
assert _has_nvme_core and _has_nvme, (
"NVME drivers are not present. "
f"nvme-core: {_has_nvme_core}, nvme: {_has_nvme}"
)

@TestCaseMetadata(
description="""
This test will verify that identifier of root partition matches
Expand Down

0 comments on commit 529ffbb

Please sign in to comment.