From 8da6543e74d5e037f08ed4cc49f89ad63963c3dc Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Fri, 2 Mar 2018 10:12:30 -0800 Subject: [PATCH] kvm: add tests for get_supported_cpuid() and get_emulated_cpuid() TEST=cargo test -p kvm BUG=None Change-Id: I2af245cb94d68faf091bf6788842c1932240df3d Signed-off-by: Dmitry Torokhov Reviewed-on: https://chromium-review.googlesource.com/947320 Reviewed-by: Zach Reizner --- kvm/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kvm/src/lib.rs b/kvm/src/lib.rs index 2ab3a97484..970452f737 100644 --- a/kvm/src/lib.rs +++ b/kvm/src/lib.rs @@ -1095,6 +1095,20 @@ mod tests { assert!(!vm.check_extension(Cap::S390UserSigp)); } + #[test] + fn get_supported_cpuid() { + let kvm = Kvm::new().unwrap(); + let mut cpuid = kvm.get_supported_cpuid().unwrap(); + let cpuid_entries = cpuid.mut_entries_slice(); + assert!(cpuid_entries.len() > 0); + } + + #[test] + fn get_emulated_cpuid() { + let kvm = Kvm::new().unwrap(); + kvm.get_emulated_cpuid().unwrap(); + } + #[test] fn add_memory() { let kvm = Kvm::new().unwrap();