tests/kernel/context: Detect spurious wakes during timeout check
In 972a4d9f6f
the test was relaxed to allow a possible parallel thread
waking the CPU during the idle timeout checks.
How this was done though, a system timer driver
which wakes the kernel spuriously a bit before the
correct deadline would not be detected, even
though it should.
Let's fix this, ensuring the timer has been
called when we check the wake time in inside the
expected range.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
78a3aa7769
commit
22c83f0f97
1 changed files with 3 additions and 0 deletions
|
@ -245,6 +245,9 @@ static void _test_kernel_cpu_idle(int atomic)
|
|||
k_cpu_idle();
|
||||
}
|
||||
} while ((idle_loops++ < CONFIG_MAX_IDLE_WAKES) && (idle_timer_done == false));
|
||||
zassert_true(idle_timer_done,
|
||||
"The CPU was waken spuriously too many times (%d > %d)",
|
||||
idle_loops, CONFIG_MAX_IDLE_WAKES);
|
||||
dt = k_uptime_ticks() - t0;
|
||||
zassert_true(abs((int32_t) (dt - dur)) <= slop,
|
||||
"Inaccurate wakeup, idled for %d ticks, expected %d",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue