Skip to content

Commit 425aefd

Browse files
committed
[nextest-runner] pass stopwatch down to terminate_child
If we receive a stop or continue signal during terminate_child, it's important to account for that within the stopwatch.
1 parent bf6c1e7 commit 425aefd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nextest-runner/src/runner.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ impl<'a> TestRunnerInner<'a> {
888888
&mut child,
889889
&mut child_acc,
890890
TerminateMode::Timeout,
891+
stopwatch,
891892
req_rx,
892893
job.as_ref(),
893894
slow_timeout.grace_period,
@@ -1112,6 +1113,7 @@ impl<'a> TestRunnerInner<'a> {
11121113
&mut child,
11131114
&mut child_acc,
11141115
TerminateMode::Timeout,
1116+
stopwatch,
11151117
req_rx,
11161118
job.as_ref(),
11171119
slow_timeout.grace_period,
@@ -1237,7 +1239,7 @@ async fn handle_signal_request(
12371239
child_acc: &mut ChildAccumulator,
12381240
req: SignalRequest,
12391241
// These annotations are needed to silence lints on non-Unix platforms.
1240-
#[allow(unused_variables)] stopwatch: &mut StopwatchStart,
1242+
stopwatch: &mut StopwatchStart,
12411243
#[allow(unused_mut, unused_variables)] mut interval_sleep: Pin<&mut PausableSleep>,
12421244
req_rx: &mut UnboundedReceiver<RunUnitRequest>,
12431245
job: Option<&imp::Job>,
@@ -1270,6 +1272,7 @@ async fn handle_signal_request(
12701272
child,
12711273
child_acc,
12721274
TerminateMode::Signal(event),
1275+
stopwatch,
12731276
req_rx,
12741277
job,
12751278
grace_period,
@@ -2552,6 +2555,7 @@ mod imp {
25522555
child: &mut Child,
25532556
_child_acc: &mut ChildAccumulator,
25542557
mode: TerminateMode,
2558+
_stopwatch: &mut StopwatchStart,
25552559
_req_rx: &mut UnboundedReceiver<RunUnitRequest>,
25562560
job: Option<&Job>,
25572561
_grace_period: Duration,
@@ -2640,6 +2644,7 @@ mod imp {
26402644
child: &mut Child,
26412645
child_acc: &mut ChildAccumulator,
26422646
mode: TerminateMode,
2647+
stopwatch: &mut StopwatchStart,
26432648
req_rx: &mut UnboundedReceiver<RunUnitRequest>,
26442649
_job: Option<&Job>,
26452650
grace_period: Duration,
@@ -2683,13 +2688,15 @@ mod imp {
26832688

26842689
match req {
26852690
RunUnitRequest::Signal(SignalRequest::Stop(sender)) => {
2691+
stopwatch.pause();
26862692
sleep.as_mut().pause();
26872693
imp::job_control_child(child, JobControlEvent::Stop);
26882694
let _ = sender.send(());
26892695
}
26902696
RunUnitRequest::Signal(SignalRequest::Continue) => {
26912697
// Possible to receive a Continue at the beginning of execution.
26922698
if !sleep.is_paused() {
2699+
stopwatch.resume();
26932700
sleep.as_mut().resume();
26942701
}
26952702
imp::job_control_child(child, JobControlEvent::Continue);

0 commit comments

Comments
 (0)