Skip to content
Permalink
Browse files

tests/kernel/common: Fix uptime delta test for fast ticks

The test for the k_uptime_delta utilities was calling it in a loop and
waiting for the uptime to advance.  But the code was specifically
wanting it to advance 5ms or more at one go, which clearly isn't going
to work for a tick rate above 200 Hz.

The weird thing is that the test knew this and even commented about
the limitation.  Which seems silly: it's perfectly fine for the clock
to advance just a single millisecond.  That's correct behavior too.
Let's test for that, and it will work everywhere.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information...
andyross authored and nashif committed Jun 12, 2019
1 parent e019dac commit 8bd8663bb316d48810df554f2aec059774b472e8
Showing with 2 additions and 4 deletions.
  1. +2 −4 tests/kernel/common/src/clock.c
@@ -61,17 +61,15 @@ void test_clock_uptime(void)

/**TESTPOINT: uptime delta*/
d64 = k_uptime_delta(&d64);
/* Note: this will stall if the systick period < 5ms */
while (k_uptime_delta(&d64) < 5) {
while (k_uptime_delta(&d64) == 0) {
#if defined(CONFIG_ARCH_POSIX)
k_busy_wait(50);
#endif
}

/**TESTPOINT: uptime delta lower 32-bit*/
k_uptime_delta_32(&d64);
/* Note: this will stall if the systick period < 5ms */
while (k_uptime_delta_32(&d64) < 5) {
while (k_uptime_delta_32(&d64) == 0) {
#if defined(CONFIG_ARCH_POSIX)
k_busy_wait(50);
#endif

0 comments on commit 8bd8663

Please sign in to comment.
You can’t perform that action at this time.