Skip to content

Commit 06afe55

Browse files
pabigotcarlescufi
authored andcommitted
tests: kernel: timer_api: compensate inaccurate conversion
When millisecond/tick conversion is not exact tick delta's are dependent on the initial tick value. In those cases exact comparisons need to also allow an adjacent value. Signed-off-by: Peter Bigot <[email protected]>
1 parent b22cef0 commit 06afe55

File tree

1 file changed

+5
-1
lines changed
  • tests/kernel/timer/timer_api/src

1 file changed

+5
-1
lines changed

tests/kernel/timer/timer_api/src/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,11 @@ void test_timeout_abs(void)
659659
cap2_ticks = k_uptime_ticks();
660660
k_timer_stop(&remain_timer);
661661
zassert_true((cap_ticks + rem_ticks + 1 == exp_ticks)
662-
|| (rem_ticks + cap2_ticks + 1 == exp_ticks),
662+
|| (rem_ticks + cap2_ticks + 1 == exp_ticks)
663+
|| (INEXACT_MS_CONVERT
664+
&& (cap_ticks + rem_ticks == exp_ticks))
665+
|| (INEXACT_MS_CONVERT
666+
&& (rem_ticks + cap2_ticks == exp_ticks)),
663667
NULL);
664668
#endif
665669
}

0 commit comments

Comments
 (0)