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:
Muminul Islam
2026-02-22 22:17:48 -08:00
committed by Rob Bradford
parent 60c6242bde
commit 45a5c7a04e
2 changed files with 9 additions and 1 deletions

View File

@@ -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)]