mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: add integration test for PPTT cache topology
Add an integration test to verify the newly added code to expose cache topology information in PPTT. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
ec73733b21
commit
0b150ea560
@@ -12456,6 +12456,52 @@ mod aarch64_acpi {
|
||||
fn test_virtio_iommu() {
|
||||
_test_virtio_iommu(true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cache_topology() {
|
||||
let jammy = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string());
|
||||
|
||||
vec![Box::new(jammy)].drain(..).for_each(|disk_config| {
|
||||
let guest = Guest::new(disk_config);
|
||||
|
||||
let mut child = GuestCommand::new(&guest)
|
||||
.default_cpus()
|
||||
.default_memory()
|
||||
.args(["--kernel", edk2_path().to_str().unwrap()])
|
||||
.default_disks()
|
||||
.default_net()
|
||||
.args(["--serial", "tty", "--console", "off"])
|
||||
.capture_output()
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
let cache_levels = ["L1d", "L1i", "L2", "L3"];
|
||||
for level in cache_levels {
|
||||
let host_sz = exec_host_command_output(&format!(
|
||||
"lscpu -C=NAME,ONE-SIZE | grep \"{level}\" | awk '{{print $2}}'"
|
||||
));
|
||||
let guest_sz = guest
|
||||
.ssh_command(&format!(
|
||||
"lscpu -C=NAME,ONE-SIZE | grep \"{level}\" | awk '{{print $2}}'"
|
||||
))
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
String::from_utf8_lossy(&host_sz.stdout).trim(),
|
||||
guest_sz.trim(),
|
||||
"Cache size mismatch for {level}"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let _ = child.kill();
|
||||
let output = child.wait_with_output().unwrap();
|
||||
|
||||
handle_child_output(r, &output);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mod rate_limiter {
|
||||
|
||||
Reference in New Issue
Block a user