@@ -267,12 +267,15 @@ class TestTimerCancelBehavior : public ::testing::Test
267
267
268
268
void TearDown ()
269
269
{
270
- node. reset ();
270
+ executor. cancel ();
271
271
272
272
// Clean up thread object
273
273
if (standalone_thread.joinable ()) {
274
274
standalone_thread.join ();
275
275
}
276
+
277
+ node.reset ();
278
+ sim_clock_node.reset ();
276
279
}
277
280
278
281
std::shared_ptr<TimerNode> node;
@@ -310,7 +313,6 @@ TYPED_TEST(TestTimerCancelBehavior, testTimer1CancelledWithExecutorSpin) {
310
313
this ->sim_clock_node ->sleep_for (50ms);
311
314
this ->node ->CancelTimer1 ();
312
315
this ->sim_clock_node ->sleep_for (150ms);
313
- this ->executor .cancel ();
314
316
315
317
int t1_runs = this ->node ->GetTimer1Cnt ();
316
318
int t2_runs = this ->node ->GetTimer2Cnt ();
@@ -328,7 +330,6 @@ TYPED_TEST(TestTimerCancelBehavior, testTimer2CancelledWithExecutorSpin) {
328
330
this ->sim_clock_node ->sleep_for (50ms);
329
331
this ->node ->CancelTimer2 ();
330
332
this ->sim_clock_node ->sleep_for (150ms);
331
- this ->executor .cancel ();
332
333
333
334
int t1_runs = this ->node ->GetTimer1Cnt ();
334
335
int t2_runs = this ->node ->GetTimer2Cnt ();
@@ -355,8 +356,6 @@ TYPED_TEST(TestTimerCancelBehavior, testHeadTimerCancelThenResetBehavior) {
355
356
int t1_runs_final = this ->node ->GetTimer1Cnt ();
356
357
int t2_runs_final = this ->node ->GetTimer2Cnt ();
357
358
358
- this ->executor .cancel ();
359
-
360
359
// T1 should have been restarted, and execute about 15 additional times.
361
360
// Check 10 greater than initial, to account for some timing jitter.
362
361
EXPECT_LT (t1_runs_initial + 50 , t1_runs_final);
@@ -384,8 +383,6 @@ TYPED_TEST(TestTimerCancelBehavior, testBackTimerCancelThenResetBehavior) {
384
383
int t1_runs_final = this ->node ->GetTimer1Cnt ();
385
384
int t2_runs_final = this ->node ->GetTimer2Cnt ();
386
385
387
- this ->executor .cancel ();
388
-
389
386
// T2 should have been restarted, and execute about 15 additional times.
390
387
// Check 10 greater than initial, to account for some timing jitter.
391
388
EXPECT_LT (t2_runs_initial + 50 , t2_runs_final);
@@ -419,8 +416,6 @@ TYPED_TEST(TestTimerCancelBehavior, testBothTimerCancelThenResetT1Behavior) {
419
416
int t1_runs_final = this ->node ->GetTimer1Cnt ();
420
417
int t2_runs_final = this ->node ->GetTimer2Cnt ();
421
418
422
- this ->executor .cancel ();
423
-
424
419
// T1 and T2 should have the same initial count.
425
420
EXPECT_LE (std::abs (t1_runs_initial - t2_runs_initial), 1 );
426
421
@@ -458,8 +453,6 @@ TYPED_TEST(TestTimerCancelBehavior, testBothTimerCancelThenResetT2Behavior) {
458
453
int t1_runs_final = this ->node ->GetTimer1Cnt ();
459
454
int t2_runs_final = this ->node ->GetTimer2Cnt ();
460
455
461
- this ->executor .cancel ();
462
-
463
456
// T1 and T2 should have the same initial count.
464
457
EXPECT_LE (std::abs (t1_runs_initial - t2_runs_initial), 1 );
465
458
0 commit comments