From 8369156806104c11c23ccfe57f5f53e0e381fa7a Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Wed, 27 Mar 2024 13:59:36 -0700 Subject: [PATCH] mshv-ioctls: unit tests for synthetic state components Add unit tests for the get/set APIs of the synthetic state components. Signed-off-by: Muminul Islam --- mshv-ioctls/src/ioctls/vcpu.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/mshv-ioctls/src/ioctls/vcpu.rs b/mshv-ioctls/src/ioctls/vcpu.rs index c5744173..f70eb15b 100644 --- a/mshv-ioctls/src/ioctls/vcpu.rs +++ b/mshv-ioctls/src/ioctls/vcpu.rs @@ -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(); + } }