Skip to content

Commit

Permalink
[nextest-runner] pass stopwatch down to terminate_child
Browse files Browse the repository at this point in the history
If we receive a stop or continue signal during terminate_child, it's important
to account for that within the stopwatch.
  • Loading branch information
sunshowers committed Nov 29, 2024
1 parent ccd4e03 commit 45c9d48
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nextest-runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ impl<'a> TestRunnerInner<'a> {
&mut child,
&mut child_acc,
TerminateMode::Timeout,
stopwatch,
req_rx,
job.as_ref(),
slow_timeout.grace_period,
Expand Down Expand Up @@ -1112,6 +1113,7 @@ impl<'a> TestRunnerInner<'a> {
&mut child,
&mut child_acc,
TerminateMode::Timeout,
stopwatch,
req_rx,
job.as_ref(),
slow_timeout.grace_period,
Expand Down Expand Up @@ -1233,7 +1235,7 @@ async fn handle_signal_request(
child_acc: &mut ChildAccumulator,
req: SignalRequest,
// These annotations are needed to silence lints on non-Unix platforms.
#[allow(unused_variables)] stopwatch: &mut StopwatchStart,
stopwatch: &mut StopwatchStart,
#[allow(unused_mut, unused_variables)] mut interval_sleep: Pin<&mut PausableSleep>,
req_rx: &mut UnboundedReceiver<RunUnitRequest>,
job: Option<&imp::Job>,
Expand Down Expand Up @@ -1266,6 +1268,7 @@ async fn handle_signal_request(
child,
child_acc,
TerminateMode::Signal(event),
stopwatch,
req_rx,
job,
grace_period,
Expand Down Expand Up @@ -2548,6 +2551,7 @@ mod imp {
child: &mut Child,
_child_acc: &mut ChildAccumulator,
mode: TerminateMode,
_stopwatch: &mut StopwatchStart,
_req_rx: &mut UnboundedReceiver<RunUnitRequest>,
job: Option<&Job>,
_grace_period: Duration,
Expand Down Expand Up @@ -2636,6 +2640,7 @@ mod imp {
child: &mut Child,
child_acc: &mut ChildAccumulator,
mode: TerminateMode,
stopwatch: &mut StopwatchStart,
req_rx: &mut UnboundedReceiver<RunUnitRequest>,
_job: Option<&Job>,
grace_period: Duration,
Expand Down Expand Up @@ -2679,13 +2684,15 @@ mod imp {

match req {
RunUnitRequest::Signal(SignalRequest::Stop(sender)) => {
stopwatch.pause();
sleep.as_mut().pause();
imp::job_control_child(child, JobControlEvent::Stop);
let _ = sender.send(());
}
RunUnitRequest::Signal(SignalRequest::Continue) => {
// Possible to receive a Continue at the beginning of execution.
if !sleep.is_paused() {
stopwatch.resume();
sleep.as_mut().resume();
}
imp::job_control_child(child, JobControlEvent::Continue);
Expand Down

0 comments on commit 45c9d48

Please sign in to comment.