Skip to content
Draft
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
51 changes: 40 additions & 11 deletions tests/integration_tests/functional/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,47 @@
def _check_cpu_topology(
test_microvm, expected_cpu_count, expected_threads_per_core, expected_cpus_list
):
expected_cpu_topology = {
"CPU(s)": str(expected_cpu_count),
"On-line CPU(s) list": expected_cpus_list,
"Thread(s) per core": str(expected_threads_per_core),
"Core(s) per socket": str(int(expected_cpu_count / expected_threads_per_core)),
"Socket(s)": "1",
"NUMA node(s)": "1",
expected_lscpu_output = {}
if PLATFORM == "x86_64":
expected_lscpu_output = {
"CPU(s)": str(expected_cpu_count),
"On-line CPU(s) list": expected_cpus_list,
"Thread(s) per core": str(expected_threads_per_core),
"Core(s) per socket": str(
int(expected_cpu_count / expected_threads_per_core)
),
"Socket(s)": "1",
"NUMA node(s)": "1",
}
else:
expected_lscpu_output = {
"CPU(s)": str(expected_cpu_count),
"On-line CPU(s) list": expected_cpus_list,
"Thread(s) per core": "1",
"Core(s) per cluster": str(
int(expected_cpu_count / expected_threads_per_core)
),
"Cluster(s)": "1",
"NUMA node(s)": "1",
}

utils.check_guest_cpuid_output(
test_microvm, "lscpu", None, ":", expected_lscpu_output
)

expected_hwloc_output = {
"depth0:": "1 Machine(type#0)",
"depth1:": "1 Package(type#1)",
"depth2:": "1 L3Cache(type#6)",
"depth3:": f"{expected_cpu_count}L2Cache(type#5)",
"depth4:": f"{expected_cpu_count}L1dCache(type#4)",
"depth5:": f"{expected_cpu_count}L1iCache(type#9)",
"depth6:": f"{expected_cpu_count}Core(type#2)",
"depth7:": f"{expected_cpu_count}PU(type#3)",
}

utils.check_guest_cpuid_output(
test_microvm, "lscpu", None, ":", expected_cpu_topology
test_microvm, "hwloc-info", None, ":", expected_hwloc_output
)


Expand Down Expand Up @@ -115,9 +145,6 @@ def _check_cache_topology_arm(test_microvm, no_cpus):
assert guest_dict == host_dict


@pytest.mark.skipif(
PLATFORM != "x86_64", reason="Firecracker supports CPU topology only on x86_64."
)
@pytest.mark.parametrize(
"num_vcpus",
[1, 2, 16],
Expand All @@ -132,6 +159,8 @@ def test_cpu_topology(test_microvm_with_api, network_config, num_vcpus, htt):

@type: functional
"""
if htt and PLATFORM == "aarch64":
pytest.skip("SMT is configurable only on x86.")
vm = test_microvm_with_api
vm.spawn()
vm.basic_config(vcpu_count=num_vcpus, smt=htt)
Expand Down