1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

tests/isr_yield_higher: adapt TEST_TIME to start-up time

This commit is contained in:
Francisco Molina 2019-10-14 17:34:03 +02:00
parent 04712dbcfc
commit 0d91e61dbb

View File

@ -27,11 +27,12 @@
#define TEST_TIME (200000U)
static char t2_stack[THREAD_STACKSIZE_MAIN];
static uint32_t start_time;
static void *second_thread(void *arg)
{
(void) arg;
if (xtimer_now_usec() < TEST_TIME) {
(void)arg;
if (xtimer_now_usec() < (TEST_TIME + start_time)) {
puts("TEST FAILED");
}
else {
@ -49,19 +50,21 @@ static void _cb(void *arg)
int main(void)
{
(void) thread_create(
t2_stack, sizeof(t2_stack),
THREAD_PRIORITY_MAIN,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
second_thread, NULL, "nr2");
puts("first thread started");
start_time = xtimer_now_usec();
xtimer_t timer;
timer.callback = _cb;
xtimer_set(&timer, TEST_TIME/2);
xtimer_set(&timer, TEST_TIME / 2);
while(xtimer_now_usec() < TEST_TIME) {}
(void)thread_create(
t2_stack, sizeof(t2_stack),
THREAD_PRIORITY_MAIN,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
second_thread, NULL, "nr2");
while (xtimer_now_usec() < (TEST_TIME + start_time)) {}
puts("first thread done");