Skip to content

Commit 33e39f8

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 b79306d commit 33e39f8

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

tests/integration_tests/functional/test_topology.py

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

3060
utils.check_guest_cpuid_output(
31-
test_microvm, "lscpu", None, ":", expected_cpu_topology
61+
test_microvm, "hwloc-info", None, ":", expected_hwloc_output
3262
)
3363

3464

@@ -115,9 +145,6 @@ def _check_cache_topology_arm(test_microvm, no_cpus):
115145
assert guest_dict == host_dict
116146

117147

118-
@pytest.mark.skipif(
119-
PLATFORM != "x86_64", reason="Firecracker supports CPU topology only on x86_64."
120-
)
121148
@pytest.mark.parametrize(
122149
"num_vcpus",
123150
[1, 2, 16],
@@ -132,6 +159,8 @@ def test_cpu_topology(test_microvm_with_api, network_config, num_vcpus, htt):
132159
133160
@type: functional
134161
"""
162+
if htt and PLATFORM == "aarch64":
163+
pytest.skip("SMT is configurable only on x86.")
135164
vm = test_microvm_with_api
136165
vm.spawn()
137166
vm.basic_config(vcpu_count=num_vcpus, smt=htt)

0 commit comments

Comments
 (0)