Skip to content

Commit

Permalink
Fix bug that causes rackscale tests to hang for some types of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hunhoffe committed Jul 21, 2023
1 parent 0d57402 commit 1988504
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions kernel/testutils/src/rackscale_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ impl<T: Clone + Send + 'static> RackscaleRun<T> {
// Wait for signal from each client that it is done
let rx = controller_rx.lock().expect("Failed to get rx lock");
let _ = wait_for_termination::<()>(&rx);
} else {
// Notify each client it's okay to shutdown
let tx = controller_tx.lock().expect("Failed to get tx lock");
notify_of_termination(&tx);
}
}

Expand All @@ -236,6 +232,14 @@ impl<T: Clone + Send + 'static> RackscaleRun<T> {
};
let ret = qemu_run();

if !state.wait_for_client {
let tx = controller_tx.lock().expect("Failed to get tx lock");
for _ in 0..state.num_clients {
// Notify each client it's okay to shutdown
notify_of_termination(&tx);
}
}

controller_output_array
.lock()
.expect("Failed to get mutex to output array")
Expand Down Expand Up @@ -302,10 +306,7 @@ impl<T: Clone + Send + 'static> RackscaleRun<T> {
)?;

// Wait for controller to terminate
if state.wait_for_client {
let tx = client_tx.lock().expect("Failed to get rx lock");
notify_of_termination(&tx);
} else {
if !state.wait_for_client {
let rx = client_rx.lock().expect("Failed to get rx lock");
let _ = wait_for_termination::<()>(&rx);
}
Expand All @@ -314,9 +315,15 @@ impl<T: Clone + Send + 'static> RackscaleRun<T> {
output += p.exp_eof()?.as_str();
ret
};

// Could exit with 'success' or from sigterm, depending on number of clients.
let ret = qemu_run();

if state.wait_for_client {
let tx = client_tx.lock().expect("Failed to get rx lock");
notify_of_termination(&tx);
}

client_output_array
.lock()
.expect("Failed to get mutex to output array")
Expand Down

0 comments on commit 1988504

Please sign in to comment.