Skip to content

Commit 0343e2d

Browse files
committed
feat: updated cpu topology tests
- Enabled topology tests for aarch64 - Added hwloc topology tests Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent b7d041f commit 0343e2d

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

tests/integration_tests/functional/test_topology.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,47 @@
1717
def _check_cpu_topology(
1818
test_microvm, expected_cpu_count, expected_threads_per_core, expected_cpus_list
1919
):
20-
expected_cpu_topology = {
21-
"CPU(s)": str(expected_cpu_count),
22-
"On-line CPU(s) list": expected_cpus_list,
23-
"Thread(s) per core": str(expected_threads_per_core),
24-
"Core(s) per socket": str(int(expected_cpu_count / expected_threads_per_core)),
25-
"Socket(s)": "1",
26-
"NUMA node(s)": "1",
20+
expected_lscpu_output = {}
21+
if PLATFORM == "x86_64":
22+
expected_lscpu_output = {
23+
"CPU(s)": str(expected_cpu_count),
24+
"On-line CPU(s) list": expected_cpus_list,
25+
"Thread(s) per core": str(expected_threads_per_core),
26+
"Core(s) per socket": str(
27+
int(expected_cpu_count / expected_threads_per_core)
28+
),
29+
"Socket(s)": "1",
30+
"NUMA node(s)": "1",
31+
}
32+
else:
33+
expected_lscpu_output = {
34+
"CPU(s)": str(expected_cpu_count),
35+
"On-line CPU(s) list": expected_cpus_list,
36+
"Thread(s) per core": "1",
37+
"Core(s) per cluster": str(
38+
int(expected_cpu_count / expected_threads_per_core)
39+
),
40+
"Cluster(s)": "1",
41+
"NUMA node(s)": "1",
42+
}
43+
44+
utils.check_guest_cpuid_output(
45+
test_microvm, "lscpu", None, ":", expected_lscpu_output
46+
)
47+
48+
expected_hwloc_output = {
49+
"depth0": "1 Machine (type #0)",
50+
"depth1": "1 Package (type #1)",
51+
"depth2": "1 L3Cache (type #6)",
52+
"depth3": f"{expected_cpu_count} L2Cache (type #5)",
53+
"depth4": f"{expected_cpu_count} L1dCache (type #4)",
54+
"depth5": f"{expected_cpu_count} L1iCache (type #9)",
55+
"depth6": f"{expected_cpu_count} Core (type #2)",
56+
"depth7": f"{expected_cpu_count} PU (type #3)",
2757
}
2858

2959
utils.check_guest_cpuid_output(
30-
test_microvm, "lscpu", None, ":", expected_cpu_topology
60+
test_microvm, "hwloc-info", None, ":", expected_hwloc_output
3161
)
3262

3363

@@ -148,15 +178,14 @@ def _check_cache_topology_arm(test_microvm, no_cpus, kernel_version_tpl):
148178
assert guest_slice == host_slice
149179

150180

151-
@pytest.mark.skipif(
152-
PLATFORM != "x86_64", reason="Firecracker supports CPU topology only on x86_64."
153-
)
154181
@pytest.mark.parametrize("num_vcpus", [1, 2, 16])
155182
@pytest.mark.parametrize("htt", [True, False])
156183
def test_cpu_topology(uvm_plain_any, num_vcpus, htt):
157184
"""
158185
Check the CPU topology for a microvm with the specified config.
159186
"""
187+
if htt and PLATFORM == "aarch64":
188+
pytest.skip("SMT is configurable only on x86.")
160189
vm = uvm_plain_any
161190
vm.spawn()
162191
vm.basic_config(vcpu_count=num_vcpus, smt=htt)

0 commit comments

Comments
 (0)