From c52105f69698866a3be4fb8e966c61fca5970fc2 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Tue, 22 Apr 2014 18:12:58 +0200 Subject: [PATCH] tests: add test_hwtimer_wait It contains the old test functionality of test_hwtimer_spin. --- tests/test_hwtimer_wait/Makefile | 6 +++++ tests/test_hwtimer_wait/main.c | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/test_hwtimer_wait/Makefile create mode 100644 tests/test_hwtimer_wait/main.c diff --git a/tests/test_hwtimer_wait/Makefile b/tests/test_hwtimer_wait/Makefile new file mode 100644 index 0000000000..35d1ec16fc --- /dev/null +++ b/tests/test_hwtimer_wait/Makefile @@ -0,0 +1,6 @@ +export PROJECT = test_hwtimer_wait +include ../Makefile.tests_common + +DISABLE_MODULE += auto_init + +include $(RIOTBASE)/Makefile.include diff --git a/tests/test_hwtimer_wait/main.c b/tests/test_hwtimer_wait/main.c new file mode 100644 index 0000000000..93d9d69214 --- /dev/null +++ b/tests/test_hwtimer_wait/main.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2014 Ludwig Ortmann + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Hwtimer test application + * + * @author Ludwig Ortmann + * + * @} + */ + +#include +#include +#include + +#include "board_uart0.h" +#include "posix_io.h" +#include "hwtimer.h" +#include "thread.h" + +int main(void) +{ + puts("This is a regression test for a race condition in hwtimer_wait."); + puts("When the race condition is hit, the timer will wait for a very very long time..."); + + while (1) { + for (unsigned long i = 256; i; i = i >> 1) { + printf("wait %lu\n", i); + hwtimer_wait(i); + } + } +}