Skip to content

Commit

Permalink
mshv-ioctls: Add test_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 8, 2024
1 parent 78bb43f commit 811a024
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mshv-ioctls/src/ioctls/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,4 +1531,18 @@ 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 811a024

Please sign in to comment.