mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 16:31:16 +00:00
tests: Add a test to check that the boot vs max cpus work
The easiest way to detect if the kernel is willing to accept hotplug vCPUs is to check the dmesg output. Switch the test to bionic as the Clear Cloud image lacks "dmesg." Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
1bbe48b24c
commit
ea19bb026f
14
src/main.rs
14
src/main.rs
@ -1119,10 +1119,10 @@ mod tests {
|
|||||||
#[cfg_attr(not(feature = "mmio"), test)]
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
fn test_multi_cpu() {
|
fn test_multi_cpu() {
|
||||||
test_block!(tb, "", {
|
test_block!(tb, "", {
|
||||||
let mut clear = ClearDiskConfig::new();
|
let mut bionic = UbuntuDiskConfig::new(BIONIC_IMAGE_NAME.to_string());
|
||||||
let guest = Guest::new(&mut clear);
|
let guest = Guest::new(&mut bionic);
|
||||||
let mut child = Command::new("target/release/cloud-hypervisor")
|
let mut child = Command::new("target/release/cloud-hypervisor")
|
||||||
.args(&["--cpus", "boot=2"])
|
.args(&["--cpus", "boot=2,max=4"])
|
||||||
.args(&["--memory", "size=512M"])
|
.args(&["--memory", "size=512M"])
|
||||||
.args(&["--kernel", guest.fw_path.as_str()])
|
.args(&["--kernel", guest.fw_path.as_str()])
|
||||||
.args(&[
|
.args(&[
|
||||||
@ -1146,6 +1146,14 @@ mod tests {
|
|||||||
|
|
||||||
aver_eq!(tb, guest.get_cpu_count().unwrap_or_default(), 2);
|
aver_eq!(tb, guest.get_cpu_count().unwrap_or_default(), 2);
|
||||||
|
|
||||||
|
aver_eq!(
|
||||||
|
tb,
|
||||||
|
guest
|
||||||
|
.ssh_command(r#"dmesg | grep "smpboot: Allowing" | sed "s/\[\ *[0-9.]*\] //""#)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim(),
|
||||||
|
"smpboot: Allowing 4 CPUs, 2 hotplug CPUs"
|
||||||
|
);
|
||||||
guest.ssh_command("sudo shutdown -h now")?;
|
guest.ssh_command("sudo shutdown -h now")?;
|
||||||
thread::sleep(std::time::Duration::new(10, 0));
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
let _ = child.kill();
|
let _ = child.kill();
|
||||||
|
Loading…
Reference in New Issue
Block a user