mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
arch: use hypervsisor::new in test cases
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
085d165f8a
commit
11ffc83365
@ -650,8 +650,7 @@ mod tests {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().unwrap();
|
let vm = hv.create_vm().unwrap();
|
||||||
let gic = create_gic(&vm, 1, false).unwrap();
|
let gic = create_gic(&vm, 1, false).unwrap();
|
||||||
assert!(create_fdt(
|
assert!(create_fdt(
|
||||||
|
@ -177,8 +177,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_create_gic() {
|
fn test_create_gic() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().unwrap();
|
let vm = hv.create_vm().unwrap();
|
||||||
|
|
||||||
assert!(create_gic(&vm, 1, false).is_ok());
|
assert!(create_gic(&vm, 1, false).is_ok());
|
||||||
|
@ -163,8 +163,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_setup_regs() {
|
fn test_setup_regs() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().unwrap();
|
let vm = hv.create_vm().unwrap();
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
let mut regions = Vec::new();
|
let mut regions = Vec::new();
|
||||||
@ -182,8 +181,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_read_mpidr() {
|
fn test_read_mpidr() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().unwrap();
|
let vm = hv.create_vm().unwrap();
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default();
|
let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default();
|
||||||
|
@ -121,8 +121,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_setlint() {
|
fn test_setlint() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().expect("new VM fd creation failed");
|
let vm = hv.create_vm().expect("new VM fd creation failed");
|
||||||
assert!(hv.check_capability(hypervisor::kvm::Cap::Irqchip));
|
assert!(hv.check_capability(hypervisor::kvm::Cap::Irqchip));
|
||||||
// Calling get_lapic will fail if there is no irqchip before hand.
|
// Calling get_lapic will fail if there is no irqchip before hand.
|
||||||
|
@ -365,8 +365,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_setup_fpu() {
|
fn test_setup_fpu() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().expect("new VM fd creation failed");
|
let vm = hv.create_vm().expect("new VM fd creation failed");
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
setup_fpu(&vcpu).unwrap();
|
setup_fpu(&vcpu).unwrap();
|
||||||
@ -391,8 +390,7 @@ mod tests {
|
|||||||
use hypervisor::arch::x86::msr_index;
|
use hypervisor::arch::x86::msr_index;
|
||||||
use hypervisor::x86_64::{MsrEntries, MsrEntry};
|
use hypervisor::x86_64::{MsrEntries, MsrEntry};
|
||||||
|
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().expect("new VM fd creation failed");
|
let vm = hv.create_vm().expect("new VM fd creation failed");
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
setup_msrs(&vcpu).unwrap();
|
setup_msrs(&vcpu).unwrap();
|
||||||
@ -418,8 +416,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_setup_regs() {
|
fn test_setup_regs() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().expect("new VM fd creation failed");
|
let vm = hv.create_vm().expect("new VM fd creation failed");
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
|
|
||||||
@ -447,8 +444,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_setup_sregs() {
|
fn test_setup_sregs() {
|
||||||
let kvm = hypervisor::kvm::KvmHypervisor::new().unwrap();
|
let hv = hypervisor::new().unwrap();
|
||||||
let hv: Arc<dyn hypervisor::Hypervisor> = Arc::new(kvm);
|
|
||||||
let vm = hv.create_vm().expect("new VM fd creation failed");
|
let vm = hv.create_vm().expect("new VM fd creation failed");
|
||||||
let vcpu = vm.create_vcpu(0).unwrap();
|
let vcpu = vm.create_vcpu(0).unwrap();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user