Skip to content

Commit e3893d3

Browse files
committed
ci(cross-kernel): use CPU templates functions
Re-use the logic that other tests use to get the list of templates. This starts testing T2A and T2CL templates when applicable. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 931a6ef commit e3893d3

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

tests/integration_tests/functional/test_snapshot_restore_cross_kernel.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import json
77
import logging
8+
import platform
89
from pathlib import Path
910

1011
import pytest
@@ -16,7 +17,7 @@
1617
guest_run_fio_iteration,
1718
populate_data_store,
1819
)
19-
from framework.utils_cpuid import CpuVendor, get_cpu_vendor
20+
from framework.utils_cpu_templates import get_supported_cpu_templates
2021
from framework.utils_vsock import check_vsock_device
2122
from integration_tests.functional.test_balloon import (
2223
get_stable_rss_mem_by_pid,
@@ -74,9 +75,10 @@ def get_snapshot_dirs():
7475
"""Get all the snapshot directories"""
7576
snapshot_root_name = "snapshot_artifacts"
7677
snapshot_root_dir = Path(FC_WORKSPACE_DIR) / snapshot_root_name
77-
cpu_templates = ["C3", "T2", "T2S", "None"]
78-
if get_cpu_vendor() != CpuVendor.INTEL:
78+
cpu_templates = []
79+
if platform.machine() == "x86_64":
7980
cpu_templates = ["None"]
81+
cpu_templates += get_supported_cpu_templates()
8082
for cpu_template in cpu_templates:
8183
for snapshot_dir in snapshot_root_dir.glob(f"*_{cpu_template}_guest_snapshot"):
8284
assert snapshot_dir.is_dir()

tools/create_snapshot_artifact/main.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import json
77
import os
8+
import platform
89
import re
910
import shutil
1011
import sys
@@ -21,10 +22,9 @@
2122
generate_mmds_get_request,
2223
generate_mmds_session_token,
2324
)
24-
from framework.utils_cpuid import CpuVendor, get_cpu_vendor
25+
from framework.utils_cpu_templates import get_supported_cpu_templates
2526
from host_tools.cargo_build import get_firecracker_binaries
2627

27-
2828
# pylint: enable=wrong-import-position
2929

3030
# Default IPv4 address to route MMDS requests.
@@ -78,8 +78,8 @@ def main():
7878
|
7979
-> vm.mem
8080
-> vm.vmstate
81-
-> ubuntu-18.04.id_rsa
82-
-> ubuntu-18.04.ext4
81+
-> ubuntu-22.04.id_rsa
82+
-> ubuntu-22.04.ext4
8383
-> <guest_kernel_supported_1>_<cpu_template>_guest_snapshot
8484
|
8585
...
@@ -90,9 +90,10 @@ def main():
9090
shutil.rmtree(SNAPSHOT_ARTIFACTS_ROOT_DIR, ignore_errors=True)
9191
vm_factory = MicroVMFactory(*get_firecracker_binaries())
9292

93-
cpu_templates = ["None"]
94-
if get_cpu_vendor() == CpuVendor.INTEL:
95-
cpu_templates.extend(["C3", "T2", "T2S"])
93+
cpu_templates = []
94+
if platform.machine() == "x86_64":
95+
cpu_templates = ["None"]
96+
cpu_templates += get_supported_cpu_templates()
9697

9798
for cpu_template in cpu_templates:
9899
for kernel in kernels(glob="vmlinux-*"):

0 commit comments

Comments
 (0)