Skip to content

Commit 45fc21b

Browse files
committed
fix(test): do not drop Vm object before end of test
Dropping the VM object closes the VM FD, which can cause the test to hang. Signed-off-by: Patrick Roy <[email protected]>
1 parent 5ac1442 commit 45fc21b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/vmm/src/vstate/vcpu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ pub(crate) mod tests {
958958
entry_addr.kernel_load
959959
}
960960

961-
fn vcpu_configured_for_boot() -> (VcpuHandle, EventFd) {
961+
fn vcpu_configured_for_boot() -> (Vm, VcpuHandle, EventFd) {
962962
Vcpu::register_kick_signal_handler();
963963
// Need enough mem to boot linux.
964964
let mem_size = mib_to_bytes(64);
@@ -1013,7 +1013,7 @@ pub(crate) mod tests {
10131013
// Wait for vCPUs to initialize their TLS before moving forward.
10141014
barrier.wait();
10151015

1016-
(vcpu_handle, vcpu_exit_evt)
1016+
(vm, vcpu_handle, vcpu_exit_evt)
10171017
}
10181018

10191019
#[test]
@@ -1147,7 +1147,7 @@ pub(crate) mod tests {
11471147

11481148
#[test]
11491149
fn test_vcpu_pause_resume() {
1150-
let (vcpu_handle, vcpu_exit_evt) = vcpu_configured_for_boot();
1150+
let (_vm, vcpu_handle, vcpu_exit_evt) = vcpu_configured_for_boot();
11511151

11521152
// Queue a Resume event, expect a response.
11531153
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
@@ -1179,7 +1179,7 @@ pub(crate) mod tests {
11791179

11801180
#[test]
11811181
fn test_vcpu_save_state_events() {
1182-
let (vcpu_handle, _vcpu_exit_evt) = vcpu_configured_for_boot();
1182+
let (_vm, vcpu_handle, _vcpu_exit_evt) = vcpu_configured_for_boot();
11831183

11841184
// Queue a Resume event, expect a response.
11851185
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
@@ -1212,7 +1212,7 @@ pub(crate) mod tests {
12121212

12131213
#[test]
12141214
fn test_vcpu_dump_cpu_config() {
1215-
let (vcpu_handle, _) = vcpu_configured_for_boot();
1215+
let (_vm, vcpu_handle, _) = vcpu_configured_for_boot();
12161216

12171217
// Queue a DumpCpuConfig event, expect a DumpedCpuConfig response.
12181218
vcpu_handle

0 commit comments

Comments
 (0)