mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: validate CPU count in the test infra
Instead of validating number of CPU in the test case itself, moving the checking of the CPU count to Guest struct with a new function as The Guest already has the Default CPU number. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
60c6242bde
commit
45a5c7a04e
@@ -2559,7 +2559,7 @@ fn _test_simple_launch(guest: &Guest) {
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
assert_eq!(guest.get_cpu_count().unwrap_or_default(), 1);
|
||||
guest.validate_cpu_count(None);
|
||||
assert!(guest.get_total_memory().unwrap_or_default() > 480_000);
|
||||
assert_eq!(guest.get_pci_bridge_class().unwrap_or_default(), "0x060000");
|
||||
assert!(check_sequential_events(
|
||||
|
||||
@@ -1385,6 +1385,14 @@ impl Guest {
|
||||
if self.nested { "" } else { ",nested=off" }
|
||||
)
|
||||
}
|
||||
|
||||
pub fn validate_cpu_count(&self, expected_cpu_count: Option<u32>) {
|
||||
let cpu = match expected_cpu_count {
|
||||
Some(count) => count,
|
||||
None => self.num_cpu,
|
||||
};
|
||||
assert_eq!(self.get_cpu_count().unwrap_or_default(), cpu);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
Reference in New Issue
Block a user