From 8d9569d8b0900eddd64900abc7261fe3f36d40a1 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 5 Jun 2014 12:43:16 +0200 Subject: [PATCH] tests: test_vtimer_msg_diff: use array for timers, change first to 1s --- tests/test_vtimer_msg_diff/main.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/tests/test_vtimer_msg_diff/main.c b/tests/test_vtimer_msg_diff/main.c index d42991955..4a2012427 100644 --- a/tests/test_vtimer_msg_diff/main.c +++ b/tests/test_vtimer_msg_diff/main.c @@ -31,7 +31,7 @@ #define MAXCOUNT 20 #define MAXDIFF 500 -char timer_stack[KERNEL_CONF_STACKSIZE_PRINTF]; +char timer_stack[KERNEL_CONF_STACKSIZE_PRINTF*4]; struct timer_msg { vtimer_t timer; @@ -43,9 +43,10 @@ struct timer_msg { timex_t now; -struct timer_msg msg_a = { .interval = { .seconds = 2, .microseconds = 0}, .msg = "T1", .start={0}, .count=0 }; -struct timer_msg msg_b = { .interval = { .seconds = 3, .microseconds = 0}, .msg = "T2", .start={0}, .count=0 }; -struct timer_msg msg_c = { .interval = { .seconds = 5, .microseconds = 0}, .msg = "T3", .start={0}, .count=0 }; +struct timer_msg timer_msgs[] = { { .interval = { .seconds = 1, .microseconds = 0}, .msg = "T1", .start={0}, .count=0 }, + { .interval = { .seconds = 3, .microseconds = 0}, .msg = "T2", .start={0}, .count=0 }, + { .interval = { .seconds = 5, .microseconds = 0}, .msg = "T3", .start={0}, .count=0 }, +}; void timer_thread(void) { @@ -104,17 +105,11 @@ int main(void) timer_thread, "timer"); - puts("sending 1st msg"); - m.content.ptr = (char *) &msg_a; - msg_send(&m, pid, false); - - puts("sending 2nd msg"); - m.content.ptr = (char *) &msg_b; - msg_send(&m, pid, false); - - puts("sending 3nd msg"); - m.content.ptr = (char *) &msg_c; - msg_send(&m, pid, false); + for (unsigned i = 0; i < sizeof(timer_msgs)/sizeof(struct timer_msg); i++) { + printf("Sending timer msg %d...\n", i); + m.content.ptr = (char *) &timer_msgs[i]; + msg_send(&m, pid, false); + } return 0; }