Skip to content

Commit

Permalink
fixup! tests: add tests to reproduce RIOT-OS#10881
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jan 30, 2019
1 parent 88af14b commit 55a51b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/thread_msg_block_race/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DEVELHELP := 1

include ../Makefile.tests_common

BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6
Expand Down
12 changes: 8 additions & 4 deletions tests/thread_msg_block_race/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static void *_thread(void *arg)
msg_t msg = { .type = 0U };

write(STDOUT_FILENO, ".", 1U);
msg_send(&msg, _pid_main);
msg_try_send(&msg, _pid_main);
thread_yield();
}

return NULL;
Expand All @@ -71,18 +72,21 @@ int main(void)

timer_init(TIMER_DEV(0), TIMER_FREQ, _timer, NULL);
random_init(timer_read(TIMER_DEV(0)));
puts("Test is \"successful\" if it runs forever without crashing");
puts("Test is \"successful\" if it runs forever without halting\n"
"on any of the assertion in this file");
_pid_main = sched_active_pid;
_sched_next();
pid = thread_create(_stack, sizeof(_stack), THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_STACKTEST, _thread, NULL, "nr2");
pid = thread_create(_stack, sizeof(_stack), THREAD_PRIORITY_MAIN + 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
_thread, NULL, "nr2");
assert(pid != KERNEL_PID_UNDEF);

while (1) {
msg_t msg = { .type = CANARY_TYPE };

msg_receive(&msg);
assert(msg.type != CANARY_TYPE);
write(STDOUT_FILENO, "\b", 1U);
}
return 0;
}

0 comments on commit 55a51b5

Please sign in to comment.