Skip to content

Commit

Permalink
mshv-ioctls: Add unit test for get/set vp state components
Browse files Browse the repository at this point in the history
Signed-off-by: Muminul Islam <muislam@microsoft.com>
  • Loading branch information
russell-islam committed Apr 8, 2024
1 parent ef72952 commit f1ac961
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mshv-ioctls/src/ioctls/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,4 +1531,19 @@ mod tests {
let max_function = res[0];
assert!(max_function >= 1);
}

#[test]
fn test_get_set_vp_state_components() {
let hv = Mshv::new().unwrap();
let vm = hv.create_vm().unwrap();
let vcpu = vm.create_vcpu(0).unwrap();
let mut states = vcpu.get_all_vp_state_components().unwrap();
vcpu.set_all_vp_state_components(&mut states).unwrap();
let ret_states = vcpu.get_all_vp_state_components().unwrap();
assert!(states
.buffer
.iter()
.zip(ret_states.buffer)
.all(|(a, b)| *a == b));
}
}

0 comments on commit f1ac961

Please sign in to comment.