Skip to content

Commit 231913e

Browse files
committed
Add test for ta_wakes_up_on_or_before fix
1 parent 21b8332 commit 231913e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/pico_time_test/pico_time_test.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ int issue_195_test(void);
7676
int issue_1812_test(void);
7777
int issue_1953_test(void);
7878
int issue_2118_test(void);
79+
int issue_2186_test(void);
7980

8081
int main() {
8182
setup_default_uart();
@@ -250,6 +251,8 @@ int main() {
250251

251252
issue_2118_test();
252253

254+
issue_2186_test();
255+
253256
PICOTEST_END_TEST();
254257
}
255258

@@ -311,8 +314,8 @@ int issue_1953_test(void) {
311314
repeating_timer_t timer1;
312315
repeating_timer_t timer2;
313316

314-
assert(add_repeating_timer_us(10, timer_callback_issue_1953, NULL, &timer1));
315-
assert(add_repeating_timer_us(100, timer_callback_issue_1953, NULL, &timer2));
317+
hard_assert(add_repeating_timer_us(10, timer_callback_issue_1953, NULL, &timer1));
318+
hard_assert(add_repeating_timer_us(100, timer_callback_issue_1953, NULL, &timer2));
316319

317320
int iterations = 0;
318321
while(iterations < 100) {
@@ -364,3 +367,13 @@ int issue_2118_test(void) {
364367
PICOTEST_END_SECTION();
365368
return 0;
366369
}
370+
371+
int issue_2186_test(void) {
372+
PICOTEST_START_SECTION("Issue #2186 defect - ta_wakes_up_on_or_before");
373+
374+
hard_assert(best_effort_wfe_or_timeout(get_absolute_time() - 1));
375+
hard_assert(best_effort_wfe_or_timeout(get_absolute_time() - 1)); // this will lockup without the fix - wfe which never happens
376+
377+
PICOTEST_END_SECTION();
378+
return 0;
379+
}

0 commit comments

Comments
 (0)