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 <[email protected]>
  • Loading branch information
russell-islam committed Apr 9, 2024
1 parent cfbd253 commit 8a70cbf
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 @@ -1532,4 +1532,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 8a70cbf

Please sign in to comment.