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
Address Kaspar's comments
  • Loading branch information
miri64 committed Mar 28, 2019
1 parent 13b613a commit 7007969
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions tests/thread_msg_block_race/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ 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 halting\n"
"on any of the assertion in this file");
"on any of the assertion in this file\n");
_pid_main = sched_active_pid;

/* try to trigger an interrupt at random intervals.
* When an interrupt is fired while ISR is disable in the
* `thread_yield_higher()` function some platform-specific implementations
* used to not call `sched_run()` which was the cause of the bug tested
* here */
puts("I will try to trigger an interrupt at random intervals. When an\n"
"interrupt is fired while ISR is disable in the thread_yield_higher()\n"
"function some platform-specific implementations used to not call\n"
"sched_run() which was the cause of the bug tested here");
_sched_next();
pid = thread_create(_stack, sizeof(_stack), THREAD_PRIORITY_MAIN + 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
Expand All @@ -105,7 +104,10 @@ int main(void)
msg_receive(&msg);
/* check msg_receive() returned without blocking (i.e. the sending
* thread did not get a chance to copy the message over) */
assert(msg.type != CANARY_TYPE);
if (msg.type == CANARY_TYPE) {
puts("Message was not written");
return 1;
}
write(STDOUT_FILENO, "\b", 1U);
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/thread_msg_block_race/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def testfunc(child):
res = child.expect([TIMEOUT, "FAILED ASSERTION."])
res = child.expect([TIMEOUT, "Message was not written"])
# we actually want the timeout here. The application runs into an assertion
# pretty quickly when failing and runs forever on success
assert(res == 0)
Expand Down

0 comments on commit 7007969

Please sign in to comment.