Skip to content

Commit

Permalink
mshv-ioctls: unit tests for synthetic state components
Browse files Browse the repository at this point in the history
Add unit tests for the get/set APIs of the synthetic
state components.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
  • Loading branch information
russell-islam committed Mar 27, 2024
1 parent ffed391 commit 77de36b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions mshv-ioctls/src/ioctls/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1557,4 +1557,37 @@ mod tests {
let max_function = res[0];
assert!(max_function >= 1);
}

#[test]
fn test_get_set_synic_timers() {
let hv = Mshv::new().unwrap();
let vm = hv.create_vm().unwrap();
let vcpu = vm.create_vcpu(0).unwrap();

let state = vcpu.get_synic_timers().unwrap();

vcpu.set_synic_timers(&state).unwrap();
}

#[test]
fn test_get_set_simp() {
let hv = Mshv::new().unwrap();
let vm = hv.create_vm().unwrap();
let vcpu = vm.create_vcpu(0).unwrap();

let state = vcpu.get_synic_message_page().unwrap();

vcpu.set_synic_message_page(&state).unwrap();
}

#[test]
fn test_get_set_sief() {
let hv = Mshv::new().unwrap();
let vm = hv.create_vm().unwrap();
let vcpu = vm.create_vcpu(0).unwrap();

let state = vcpu.get_synic_event_flags_page().unwrap();

vcpu.set_synic_event_flags_page(&state).unwrap();
}
}

0 comments on commit 77de36b

Please sign in to comment.