Skip to content

Commit

Permalink
tests: timer: Reuse the test timer to wait a bit more
Browse files Browse the repository at this point in the history
By reusing the test, we test the path of 'stop' and starting a new
timer.  This also gives some time for there to possibly be any stray
callbacks happening.

Signed-off-by: David Brown <[email protected]>
  • Loading branch information
d3zd3z committed Dec 17, 2024
1 parent 4c6002b commit 0d5c7db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/timer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ fn timer_test() {
printkln!("Atomics fired {} times", atomic_count);

printkln!("Period ticks: {}", count);

// Now that everything is done and cleaned up, allow a little time to pass to make sure there
// are no stray timers. We can re-use the total test timer.
let mut total_test = total_test.stop().start_simple(Duration::millis_at_least(1), NoWait);
total_test.read_count_wait();
}

/// Test a SimpleTimer.
Expand Down

0 comments on commit 0d5c7db

Please sign in to comment.