tests: context: allow 2 ticks of slop

The hard-coded value of 10ms doesn't take the system configured
amount of ticks per second, nor does it account for an unlucky
tick advance which causes the test to fail very intermittently
in QEMU.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-06-05 12:52:07 -07:00 committed by Anas Nashif
commit 68e8813896

View file

@ -694,7 +694,7 @@ static void test_thread_sleep(void *delta, void *arg2, void *arg3)
timestamp = k_uptime_get() - timestamp; timestamp = k_uptime_get() - timestamp;
TC_PRINT(" thread back from sleep\n"); TC_PRINT(" thread back from sleep\n");
if (timestamp < timeout || timestamp > timeout + 10) { if (timestamp < timeout || timestamp > timeout + __ticks_to_ms(2)) {
TC_ERROR("timestamp out of range, got %d\n", (int)timestamp); TC_ERROR("timestamp out of range, got %d\n", (int)timestamp);
return; return;
} }