Skip to content

Commit

Permalink
test: enable ARM CPU template tests
Browse files Browse the repository at this point in the history
This enables the tests that are not currently on CI.

We should enable them only in Linux 6.1 since they won't work in any
other kernel.

Fixes: c358311

Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o committed Jan 24, 2024
1 parent efc6921 commit 69d537c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 26 deletions.
15 changes: 5 additions & 10 deletions tests/framework/utils_cpu_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ def get_supported_cpu_templates():
match cpuid_utils.get_cpu_vendor():
case cpuid_utils.CpuVendor.INTEL:
# T2CL template is only supported on Cascade Lake and newer CPUs.

if global_props.cpu_codename == cpuid_utils.CpuModel.INTEL_SKYLAKE:
return sorted(set(INTEL_TEMPLATES) - set(["T2CL"]))
return INTEL_TEMPLATES
case cpuid_utils.CpuVendor.AMD:
return AMD_TEMPLATES
case cpuid_utils.CpuVendor.ARM:
if global_props.host_linux_tpl >= (6, 1):
return []
match global_props.cpu_model:
case cpuid_utils.CpuModel.ARM_NEOVERSE_N1:
return []
Expand All @@ -59,13 +60,14 @@ def get_supported_custom_cpu_templates():
match cpuid_utils.get_cpu_vendor():
case cpuid_utils.CpuVendor.INTEL:
# T2CL template is only supported on Cascade Lake and newer CPUs.
skylake_model = "Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz"
if global_props.cpu_model == skylake_model:
if global_props.cpu_codename == cpuid_utils.CpuModel.INTEL_SKYLAKE:
return set(INTEL_TEMPLATES) - {"T2CL"}
return INTEL_TEMPLATES
case cpuid_utils.CpuVendor.AMD:
return AMD_TEMPLATES
case cpuid_utils.CpuVendor.ARM:
if global_props.host_linux_tpl >= (6, 1):
return []
match global_props.cpu_model:
case cpuid_utils.CpuModel.ARM_NEOVERSE_N1:
return AARCH64_CUSTOM_CPU_TEMPLATES_G2
Expand All @@ -87,10 +89,3 @@ def static_cpu_templates_params():
"""Return Static CPU templates as pytest parameters"""
for name in sorted(get_supported_cpu_templates()):
yield pytest.param(name, id="static_" + name)


def nonci_on_arm(func):
"""Temporary decorator used to mark specific cpu template related tests as nonci on ARM platforms"""
if cpuid_utils.get_cpu_vendor() == cpuid_utils.CpuVendor.ARM:
return pytest.mark.nonci(func)
return func
2 changes: 0 additions & 2 deletions tests/integration_tests/functional/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import host_tools.network as net_tools
from framework import utils_cpuid
from framework.utils import get_firecracker_version_from_toml, is_io_uring_supported
from framework.utils_cpu_templates import nonci_on_arm

MEM_LIMIT = 1000000000

Expand Down Expand Up @@ -462,7 +461,6 @@ def test_negative_machine_config_api(test_microvm_with_api):
)


@nonci_on_arm
def test_api_cpu_config(test_microvm_with_api, custom_cpu_template):
"""
Test /cpu-config PUT scenarios.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pytest

import framework.utils_cpuid as cpuid_utils
from framework.utils_cpu_templates import nonci_on_arm
from framework.utils_cpuid import CpuModel

PLATFORM = platform.machine()
Expand Down Expand Up @@ -94,7 +93,6 @@ def test_default_cpu_features(microvm_factory, guest_kernel, rootfs_ubuntu_22):
PLATFORM != "aarch64",
reason="This is aarch64 specific test.",
)
@nonci_on_arm
def test_cpu_features_with_static_template(
microvm_factory, guest_kernel, rootfs_ubuntu_22, cpu_template
):
Expand All @@ -115,7 +113,6 @@ def test_cpu_features_with_static_template(
PLATFORM != "aarch64",
reason="This is aarch64 specific test.",
)
@nonci_on_arm
def test_cpu_features_with_custom_template(
microvm_factory, guest_kernel, rootfs_ubuntu_22, custom_cpu_template
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from framework import utils
from framework.defs import SUPPORTED_HOST_KERNELS
from framework.properties import global_props
from framework.utils_cpu_templates import nonci_on_arm
from framework.utils_cpuid import get_guest_cpuid
from host_tools import cargo_build

Expand Down Expand Up @@ -405,7 +404,6 @@ def test_guest_cpu_config_change(
)


@nonci_on_arm
def test_json_static_templates(
test_microvm_with_api, cpu_template_helper, tmp_path, custom_cpu_template
):
Expand Down
9 changes: 0 additions & 9 deletions tests/integration_tests/security/test_vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
)
from framework.properties import global_props
from framework.utils import CommandReturn
from framework.utils_cpu_templates import nonci_on_arm

CHECKER_URL = "https://meltdown.ovh"
CHECKER_FILENAME = "spectre-meltdown-checker.sh"
Expand Down Expand Up @@ -299,7 +298,6 @@ def test_spectre_meltdown_checker_on_restored_guest(
global_props.instance == "c7g.metal" and global_props.host_linux_version == "4.14",
reason="c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully.",
)
@nonci_on_arm
def test_spectre_meltdown_checker_on_guest_with_template(
spectre_meltdown_checker, build_microvm_with_template
):
Expand All @@ -320,7 +318,6 @@ def test_spectre_meltdown_checker_on_guest_with_template(
global_props.instance == "c7g.metal" and global_props.host_linux_version == "4.14",
reason="c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully.",
)
@nonci_on_arm
def test_spectre_meltdown_checker_on_guest_with_custom_template(
spectre_meltdown_checker, build_microvm_with_custom_template
):
Expand All @@ -340,7 +337,6 @@ def test_spectre_meltdown_checker_on_guest_with_custom_template(
global_props.instance == "c7g.metal" and global_props.host_linux_version == "4.14",
reason="c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully.",
)
@nonci_on_arm
def test_spectre_meltdown_checker_on_restored_guest_with_template(
spectre_meltdown_checker, build_microvm_with_template, microvm_factory
):
Expand All @@ -363,7 +359,6 @@ def test_spectre_meltdown_checker_on_restored_guest_with_template(
global_props.instance == "c7g.metal" and global_props.host_linux_version == "4.14",
reason="c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully.",
)
@nonci_on_arm
def test_spectre_meltdown_checker_on_restored_guest_with_custom_template(
spectre_meltdown_checker, build_microvm_with_custom_template, microvm_factory
):
Expand Down Expand Up @@ -501,15 +496,13 @@ def test_vulnerabilities_files_on_restored_guest(build_microvm, microvm_factory)
check_vulnerabilities_files_ab(with_restore(build_microvm, microvm_factory))


@nonci_on_arm
def test_vulnerabilities_files_on_guest_with_template(build_microvm_with_template):
"""
Test vulnerabilities files on guest with CPU template.
"""
check_vulnerabilities_files_ab(build_microvm_with_template)


@nonci_on_arm
def test_vulnerabilities_files_on_guest_with_custom_template(
build_microvm_with_custom_template,
):
Expand All @@ -519,7 +512,6 @@ def test_vulnerabilities_files_on_guest_with_custom_template(
check_vulnerabilities_files_ab(build_microvm_with_custom_template)


@nonci_on_arm
def test_vulnerabilities_files_on_restored_guest_with_template(
build_microvm_with_template, microvm_factory
):
Expand All @@ -531,7 +523,6 @@ def test_vulnerabilities_files_on_restored_guest_with_template(
)


@nonci_on_arm
def test_vulnerabilities_files_on_restored_guest_with_custom_template(
build_microvm_with_custom_template, microvm_factory
):
Expand Down

0 comments on commit 69d537c

Please sign in to comment.