From fcf92d86b54d172ab5962b435d9c70223ccd989e Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 4 Dec 2019 14:01:46 +0000 Subject: [PATCH] tests: Add rebooting to the CPU hotplug test Check that the added vCPUs are still there after a reboot. Signed-off-by: Rob Bradford --- src/main.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main.rs b/src/main.rs index 85951eedf..09a1cce38 100755 --- a/src/main.rs +++ b/src/main.rs @@ -3259,6 +3259,31 @@ mod tests { u32::from(desired_vcpus) ); + let reboot_count = guest + .ssh_command("sudo journalctl | grep -c -- \"-- Reboot --\"") + .unwrap_or_default() + .trim() + .parse::() + .unwrap_or(1); + + aver_eq!(tb, reboot_count, 0); + guest.ssh_command("sudo reboot").unwrap_or_default(); + + thread::sleep(std::time::Duration::new(30, 0)); + let reboot_count = guest + .ssh_command("sudo journalctl | grep -c -- \"-- Reboot --\"") + .unwrap_or_default() + .trim() + .parse::() + .unwrap_or_default(); + aver_eq!(tb, reboot_count, 1); + + aver_eq!( + tb, + guest.get_cpu_count().unwrap_or_default(), + u32::from(desired_vcpus) + ); + guest.ssh_command("sudo shutdown -h now")?; thread::sleep(std::time::Duration::new(10, 0)); let _ = child.kill();