mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: config: Add unit test for CPU parsing
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9e7231cd69
commit
9e6a2825ba
@ -1296,4 +1296,26 @@ mod tests {
|
||||
assert!(parser.is_set("size"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cpu_parsing() -> Result<()> {
|
||||
assert_eq!(CpusConfig::parse("")?, CpusConfig::default());
|
||||
|
||||
assert_eq!(
|
||||
CpusConfig::parse("boot=1")?,
|
||||
CpusConfig {
|
||||
boot_vcpus: 1,
|
||||
max_vcpus: 1
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
CpusConfig::parse("boot=1,max=2")?,
|
||||
CpusConfig {
|
||||
boot_vcpus: 1,
|
||||
max_vcpus: 2,
|
||||
}
|
||||
);
|
||||
assert!(CpusConfig::parse("boot=2,max=1").is_err());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user