Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/isr_yield_higher: adapt TEST_TIME to start-up time #12539

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions tests/isr_yield_higher/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);

(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) {}
while (xtimer_now_usec() < (TEST_TIME + start_time)) {}

puts("first thread done");

Expand Down