Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions lisa/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from lisa.testsuite import TestCaseRuntimeData
from lisa.util import LisaException, constants, hookspec, plugin_manager
from lisa.util.logger import enable_console_timestamp, get_logger
from lisa.util.os_resolver import infer_target_os
from lisa.util.perf_timer import create_timer

_get_init_logger = functools.partial(get_logger, "init")
Expand Down Expand Up @@ -75,12 +76,20 @@ def list_start(args: Namespace) -> int:
list_all = cast(Optional[bool], args.list_all)
log = _get_init_logger("list")
if args.type == constants.LIST_CASE:
# Resolve target OS from runbook variables so the listing reflects
# the same distro pre-filter the runner will apply.
case_variables = {name: entry.data for name, entry in builder.variables.items()}
gate = case_variables.get("enable_distro_pre_filtering")
if gate is not None and str(gate).lower() in ("false", "0", "no"):
target_os = None
else:
target_os = infer_target_os(case_variables)
Comment thread
LiliDeng marked this conversation as resolved.
if list_all:
cases: Iterable[TestCaseRuntimeData] = select_testcases()
cases: Iterable[TestCaseRuntimeData] = select_testcases(target_os=target_os)
else:
criteria_dict = builder.partial_resolve(constants.TESTCASE)
criteria = schema.load_by_type_many(schema.TestCase, criteria_dict)
cases = select_testcases(criteria)
cases = select_testcases(criteria, target_os=target_os)
for case_data in cases:
log.info(
f"case: {case_data.name}, suite: {case_data.metadata.suite.name}, "
Expand Down
2 changes: 2 additions & 0 deletions lisa/microsoft/testsuites/azure/net/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
simple_requirement,
)
from lisa.operating_system import CBLMariner
from lisa.tools import Conntrack, Ipset, Iptables, Ping
Expand All @@ -25,6 +26,7 @@
such as conntrack, ipset, and iptables. It ensures that connection tracking,
IP-based filtering, and custom rule management operate as expected
""",
requirement=simple_requirement(supported_os=[CBLMariner]),
)
class NetworkComponentTest(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
Expand Down
5 changes: 3 additions & 2 deletions lisa/microsoft/testsuites/cdrom/cdrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from assertpy import assert_that

from lisa import Node, SkippedException, TestCaseMetadata, TestSuite, TestSuiteMetadata
from lisa.operating_system import CBLMariner, Debian, Linux, Ubuntu
from lisa.operating_system import CBLMariner, Debian, Ubuntu
from lisa.sut_orchestrator import AZURE, HYPERV
from lisa.testsuite import simple_requirement
from lisa.tools import Gcc
Expand Down Expand Up @@ -34,7 +34,8 @@ class CdromSuite(TestSuite):
""",
priority=2,
requirement=simple_requirement(
supported_os=[Linux], supported_platform_type=[AZURE, HYPERV]
supported_os=[Debian, CBLMariner],
Comment thread
LiliDeng marked this conversation as resolved.
supported_platform_type=[AZURE, HYPERV],
),
)
def verify_cdrom_device_status_code(self, node: Node) -> None:
Expand Down
3 changes: 2 additions & 1 deletion lisa/microsoft/testsuites/cloud_hypervisor/ch_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
search_space,
)
from lisa.operating_system import CBLMariner, Ubuntu
from lisa.testsuite import TestResult
from lisa.testsuite import TestResult, simple_requirement
from lisa.tools import Dmesg, Journalctl, Ls, Lscpu, Modprobe, Usermod
from lisa.util import SkippedException

Expand All @@ -28,6 +28,7 @@
This test suite is for executing the tests maintained in the
upstream cloud-hypervisor repo.
""",
requirement=simple_requirement(supported_os=[CBLMariner, Ubuntu]),
)
class CloudHypervisorTestSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
Expand Down
29 changes: 22 additions & 7 deletions lisa/microsoft/testsuites/core/azure_image_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,10 @@ def verify_grub(self, node: Node) -> None:
network manager is not installed.
""",
priority=3,
requirement=simple_requirement(supported_platform_type=[AZURE, READY, HYPERV]),
requirement=simple_requirement(
supported_os=[Fedora],
supported_platform_type=[AZURE, READY, HYPERV],
),
)
def verify_network_manager_not_installed(self, node: Node) -> None:
if isinstance(node.os, Fedora):
Expand Down Expand Up @@ -465,7 +468,8 @@ def verify_network_manager_not_installed(self, node: Node) -> None:
""",
priority=1,
requirement=simple_requirement(
supported_platform_type=[AZURE, READY, HYPERV, QEMU]
supported_os=[Fedora, CBLMariner],
supported_platform_type=[AZURE, READY, HYPERV, QEMU],
),
)
def verify_network_file_configuration(self, node: Node) -> None:
Expand Down Expand Up @@ -541,7 +545,8 @@ def verify_network_file_configuration(self, node: Node) -> None:
""",
priority=1,
requirement=simple_requirement(
supported_platform_type=[AZURE, READY, HYPERV, QEMU]
supported_os=[Fedora],
supported_platform_type=[AZURE, READY, HYPERV, QEMU],
),
)
def verify_ifcfg_eth0(self, node: Node) -> None:
Expand Down Expand Up @@ -601,7 +606,8 @@ def verify_ifcfg_eth0(self, node: Node) -> None:
""",
priority=1,
requirement=simple_requirement(
supported_platform_type=[AZURE, READY, HYPERV, QEMU]
supported_os=[CoreOs, Fedora, CBLMariner],
supported_platform_type=[AZURE, READY, HYPERV, QEMU],
),
)
def verify_udev_rules_moved(self, node: Node) -> None:
Expand Down Expand Up @@ -639,7 +645,8 @@ def verify_udev_rules_moved(self, node: Node) -> None:
""",
priority=1,
requirement=simple_requirement(
supported_platform_type=[AZURE, READY, HYPERV, QEMU]
supported_os=[Suse, CBLMariner],
supported_platform_type=[AZURE, READY, HYPERV, QEMU],
),
)
def verify_dhcp_file_configuration(self, node: Node) -> None:
Expand Down Expand Up @@ -692,7 +699,10 @@ def verify_dhcp_file_configuration(self, node: Node) -> None:
present in the file.
""",
priority=2,
requirement=simple_requirement(supported_platform_type=[AZURE, READY, HYPERV]),
requirement=simple_requirement(
supported_os=[Fedora],
supported_platform_type=[AZURE, READY, HYPERV],
),
)
def verify_yum_conf(self, node: Node) -> None:
if isinstance(node.os, Fedora):
Expand Down Expand Up @@ -738,6 +748,7 @@ def verify_os_update(self, node: Node) -> None:
""",
priority=2,
requirement=simple_requirement(
supported_os=[Debian, CBLMariner],
supported_platform_type=[AZURE, READY, HYPERV],
supported_features=[HyperVHostType(), CvmDisabled()],
),
Expand Down Expand Up @@ -1255,7 +1266,10 @@ def verify_boot_error_fail_warnings(self, node: Node) -> None:
fail the case.
""",
priority=2,
requirement=simple_requirement(supported_platform_type=[AZURE, READY, HYPERV]),
requirement=simple_requirement(
supported_os=[CBLMariner],
supported_platform_type=[AZURE, READY, HYPERV],
),
)
def verify_cloud_init_error_status(self, node: Node) -> None:
cat = node.tools[Cat]
Expand Down Expand Up @@ -1789,6 +1803,7 @@ def verify_no_swap_on_osdisk(self, node: Node) -> None:
cifs.
""",
priority=1,
requirement=simple_requirement(supported_os=[Linux]),
)
def verify_essential_kernel_modules(self, node: Node) -> None:
if not isinstance(node.os, Linux):
Expand Down
4 changes: 3 additions & 1 deletion lisa/microsoft/testsuites/core/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ class Boot(TestSuite):
priority=3,
requirement=simple_requirement(
supported_features=[SerialConsole],
supported_os=[Redhat, CentOs],
),
)
def verify_boot_with_debug_kernel(
self, log: Logger, node: RemoteNode, log_path: Path
) -> None:
# 1. Skip testing if the distro is not redhat type.
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if not isinstance(node.os, Redhat) and not isinstance(node.os, CentOs):
raise SkippedException(
f"{node.os.name} not supported. "
Expand Down
4 changes: 2 additions & 2 deletions lisa/microsoft/testsuites/core/sched_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
TestSuiteMetadata,
simple_requirement,
)
from lisa.operating_system import CBLMariner, Linux
from lisa.operating_system import CBLMariner
from lisa.sut_orchestrator import AZURE, HYPERV, READY
from lisa.tools import Gcc, Rm
from lisa.tools.kernel_config import KernelConfig
Expand All @@ -40,7 +40,7 @@
""",
requirement=simple_requirement(
supported_platform_type=[AZURE, READY, HYPERV],
supported_os=[Linux],
supported_os=[CBLMariner],
),
)
class SchedCore(TestSuite):
Expand Down
1 change: 1 addition & 0 deletions lisa/microsoft/testsuites/cvm/cvm_attestation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
description="""
This test suite is for generating CVM attestation report only for azure cvms.
""",
requirement=simple_requirement(supported_os=[Ubuntu, CBLMariner]),
)
class AzureCVMAttestationTestSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
Expand Down
5 changes: 4 additions & 1 deletion lisa/microsoft/testsuites/cvm/cvm_azure_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
This test suite is for azure host vm pre-checks
for nested-cvm cases.
""",
requirement=simple_requirement(supported_os=[CBLMariner]),
)
class CVMAzureHostTestSuite(TestSuite):
__sev_enabled_pattern = re.compile(r"mshv: SEV-SNP is supported")
Expand All @@ -37,11 +38,13 @@ class CVMAzureHostTestSuite(TestSuite):

def before_case(self, log: Logger, **kwargs: Any) -> None:
node: Node = kwargs["node"]
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if not isinstance(node.os, (CBLMariner)):
Comment thread
LiliDeng marked this conversation as resolved.
raise SkippedException(
f"CVMAzureHostTestSuite is not implemented for {node.os.name}"
)
elif not is_mariner_dom0(node):
if not is_mariner_dom0(node):
raise SkippedException(
"CVMAzureHostTestSuite is supported only on Dom0-Mariner"
)
Expand Down
1 change: 1 addition & 0 deletions lisa/microsoft/testsuites/cvm/cvm_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
description="""This test suite covers some common scenarios related to
CVM boot on Azure.
""",
requirement=simple_requirement(supported_os=[CBLMariner]),
)
class CVMBootTestSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
Expand Down
4 changes: 4 additions & 0 deletions lisa/microsoft/testsuites/dpdk/dpdksuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
description="""
This test suite check DPDK functionality
""",
requirement=simple_requirement(unsupported_os=[BSD, Windows]),
)
class Dpdk(TestSuite):
# regex for parsing ring ping output for the final line,
Expand Down Expand Up @@ -594,11 +595,14 @@ def _check_rx_or_tx_pps(
min_nic_count=2,
network_interface=Sriov(),
unsupported_features=[Gpu, Infiniband],
unsupported_os=[CBLMariner],
),
)
def verify_dpdk_vpp(
self, node: Node, log: Logger, variables: Dict[str, Any]
) -> None:
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the unsupported_os gate.
if isinstance(node.os, CBLMariner):
raise SkippedException(
UnsupportedDistroException(
Expand Down
10 changes: 9 additions & 1 deletion lisa/microsoft/testsuites/firewalld/firewalldsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
import re
from typing import Any, List

from lisa import Logger, Node, TestCaseMetadata, TestSuite, TestSuiteMetadata
from lisa import (
Logger,
Node,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
simple_requirement,
)
from lisa.operating_system import CBLMariner
from lisa.testsuite import TestResult
from lisa.tools import Cat, KernelConfig, Ls
Expand Down Expand Up @@ -125,6 +132,7 @@ def _parse_test_result(
These tests interact with both iptables & nftables as backend.
The testsuite is provided by the firewalld-test rpm.
""",
requirement=simple_requirement(supported_os=[CBLMariner]),
)
class FirewalldSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
Expand Down
3 changes: 3 additions & 0 deletions lisa/microsoft/testsuites/gpu/gpusuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
description="""
This test suite runs the gpu test cases.
""",
requirement=simple_requirement(supported_os=[Linux]),
)
class GpuTestSuite(TestSuite):
TIMEOUT = 2000
Expand All @@ -59,6 +60,8 @@ class GpuTestSuite(TestSuite):

def before_case(self, log: Logger, **kwargs: Any) -> None:
node: Node = kwargs["node"]
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if isinstance(node.os, BSD) or isinstance(node.os, Windows):
raise SkippedException(f"{node.os} is not supported.")

Expand Down
6 changes: 5 additions & 1 deletion lisa/microsoft/testsuites/kdump/kdumpcrash.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
node_requirement,
schema,
search_space,
simple_requirement,
)
from lisa.features import SecurityProfile
from lisa.features.security_profile import SecurityProfileSettings, SecurityProfileType
from lisa.operating_system import BSD, Windows
from lisa.operating_system import BSD, Linux, Windows
from lisa.tools import KdumpCheck, Lscpu


Expand All @@ -37,10 +38,13 @@
6. crashkernel is set "auto"
7. crashkernel is set "auto" and VM has more than 2T memory
""",
requirement=simple_requirement(supported_os=[Linux]),
)
class KdumpCrash(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
node: Node = kwargs["node"]
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if isinstance(node.os, BSD) or isinstance(node.os, Windows):
raise SkippedException(f"{node.os} is not supported.")
# Skip kdump tests on CVMs (Confidential VMs) as they are not supported
Expand Down
6 changes: 5 additions & 1 deletion lisa/microsoft/testsuites/kvm/kvm_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from lisa import Logger, Node, TestCaseMetadata, TestSuite, TestSuiteMetadata
from lisa.operating_system import BSD, CBLMariner, Ubuntu, Windows
from lisa.testsuite import TestResult
from lisa.testsuite import TestResult, simple_requirement
from lisa.tools import Lscpu
from lisa.util import SkippedException

Expand All @@ -19,10 +19,13 @@
This test suite is for executing the community maintained KVM tests.
See: https://gitlab.com/kvm-unit-tests/kvm-unit-tests
""",
requirement=simple_requirement(supported_os=[CBLMariner, Ubuntu]),
)
class KvmUnitTestSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
node: Node = kwargs["node"]
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if isinstance(node.os, BSD) or isinstance(node.os, Windows):
raise SkippedException(f"{node.os} is not supported.")

Expand All @@ -42,6 +45,7 @@ def verify_kvm_unit_tests(
virtualization_enabled = node.tools[Lscpu].is_virtualization_enabled()
if not virtualization_enabled:
raise SkippedException("Virtualization is not enabled in hardware")
# Defense-in-depth: same rationale as the before_case check above.
if not isinstance(node.os, (CBLMariner, Ubuntu)):
raise SkippedException(
f"KVM unit tests are not implemented in LISA for {node.os.name}"
Expand Down
5 changes: 4 additions & 1 deletion lisa/microsoft/testsuites/libvirt/libvirt_tck.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from lisa import Logger, Node, TestCaseMetadata, TestSuite, TestSuiteMetadata
from lisa.operating_system import CBLMariner, Ubuntu
from lisa.testsuite import TestResult
from lisa.testsuite import TestResult, simple_requirement
from lisa.tools import Dmesg, Journalctl, Lscpu
from lisa.util import SkippedException

Expand All @@ -22,10 +22,13 @@

More info: https://gitlab.com/libvirt/libvirt-tck/-/blob/master/README.rst
""",
requirement=simple_requirement(supported_os=[Ubuntu, CBLMariner]),
)
class LibvirtTckSuite(TestSuite):
def before_case(self, log: Logger, **kwargs: Any) -> None:
node = kwargs["node"]
# Defense-in-depth: catches custom VHD/SIG images whose OS detection
# may misclassify the node and bypass the supported_os gate.
if not isinstance(node.os, (Ubuntu, CBLMariner)):
raise SkippedException(
f"Libvirt TCK suite is not implemented in LISA for {node.os.name}"
Expand Down
Loading
Loading