From 8b2dc150dc5af10e87aeed3d3674c2d892ca25e3 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 3 Sep 2015 18:43:44 +0200 Subject: [PATCH] tests: remove hwtimer tests --- tests/hwtimer/Makefile | 6 --- tests/hwtimer/main.c | 78 ----------------------------- tests/hwtimer/tests/test_hwtimer.py | 31 ------------ tests/hwtimer_spin/Makefile | 6 --- tests/hwtimer_spin/main.c | 42 ---------------- tests/hwtimer_wait/Makefile | 6 --- tests/hwtimer_wait/main.c | 46 ----------------- 7 files changed, 215 deletions(-) delete mode 100644 tests/hwtimer/Makefile delete mode 100644 tests/hwtimer/main.c delete mode 100755 tests/hwtimer/tests/test_hwtimer.py delete mode 100644 tests/hwtimer_spin/Makefile delete mode 100644 tests/hwtimer_spin/main.c delete mode 100644 tests/hwtimer_wait/Makefile delete mode 100644 tests/hwtimer_wait/main.c diff --git a/tests/hwtimer/Makefile b/tests/hwtimer/Makefile deleted file mode 100644 index 718805bb85..0000000000 --- a/tests/hwtimer/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -APPLICATION = hwtimer -include ../Makefile.tests_common - -DISABLE_MODULE += auto_init - -include $(RIOTBASE)/Makefile.include diff --git a/tests/hwtimer/main.c b/tests/hwtimer/main.c deleted file mode 100644 index bfa52ce4d4..0000000000 --- a/tests/hwtimer/main.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2013 INRIA - * Copyright (C) 2014 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup tests - * @{ - * - * @file - * @brief Hwtimer test application - * - * @author Oliver Hahm - * @author Ludwig Ortmann - * - * @} - */ - -#include - -#include "hwtimer.h" - -#define BASE_DELAY (1000UL * 1000UL) -#define END_DELAY (BASE_DELAY + ((HWTIMER_MAXTIMERS - 1) * DELTA_DELAY)) -#define DELTA_DELAY (10UL * 1000UL) -#define MSGLEN (12) /* == strlen("callback %2i") */ - -char msg[MSGLEN * HWTIMER_MAXTIMERS]; /* == [callback 1\0callback 2\0...] */ - -void callback(void *ptr) -{ - puts((char *) ptr); -} - -int main(void) -{ - puts("hwtimer test application..."); - - puts(""); - puts(" Timers should print \"callback x\" once when they run out."); - printf(" The order for x is 1, n-1, n-2, ..., 2 where n is the number of available hardware timers (%u on this platform).\n", HWTIMER_MAXTIMERS); - puts(" In 1 second, one timer should fire every second/100 until all timers have run out."); - puts(" Additionally the message \"hwtimer set.\" should be printed once 1 second from now."); - puts(""); - puts("Setting timers:"); - puts(""); - - unsigned long delay = BASE_DELAY + ((HWTIMER_MAXTIMERS - 1) * DELTA_DELAY); - - /* make the first timer first to fire so timers do not run out linearly */ - char *msgn = msg; - snprintf(msgn, MSGLEN, "callback %2x", 1); - hwtimer_set(HWTIMER_TICKS(BASE_DELAY), callback, (void *) msgn); - printf("set %s\n", msgn); - - /* set up to HWTIMER_MAXTIMERS-1 because hwtimer_wait below also - * needs a timer */ - for (int i = 1; i < (HWTIMER_MAXTIMERS - 1); i++) { - msgn = msg + (i * MSGLEN); - delay -= DELTA_DELAY; - snprintf(msgn, MSGLEN, "callback %2x", i + 1); - hwtimer_set(HWTIMER_TICKS(delay), callback, (void *) msgn); - printf("set %s\n", msgn); - } - - puts(""); - puts("All timers set."); - puts(""); - - hwtimer_wait(HWTIMER_TICKS(END_DELAY)); - - puts("hwtimer set."); - return 0; -} diff --git a/tests/hwtimer/tests/test_hwtimer.py b/tests/hwtimer/tests/test_hwtimer.py deleted file mode 100755 index 93968d522a..0000000000 --- a/tests/hwtimer/tests/test_hwtimer.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -from pexpect import spawn, TIMEOUT - -DEFAULT_TIMEOUT=5 -hwtimers = 0 - -term = spawn("make term") - -term.expect(r"Setting timers:", timeout=DEFAULT_TIMEOUT) - -try: - while True: - term.expect(r"set callback\s+\d+", timeout=DEFAULT_TIMEOUT) - hwtimers += 1 -except TIMEOUT: - pass - -term.expect(r"All timers set.", timeout=DEFAULT_TIMEOUT) -term.expect(r"callback\s+1", timeout=DEFAULT_TIMEOUT) -print("Got callback 1") - -while hwtimers > 1: - term.expect(r"callback\s+{:d}".format(hwtimers), timeout=DEFAULT_TIMEOUT) - print("Got callback {:d}".format(hwtimers)) - hwtimers -= 1 - -# Setting timers: -# term.expect("OK") -if not term.terminate(): - term.terminate(force=True) diff --git a/tests/hwtimer_spin/Makefile b/tests/hwtimer_spin/Makefile deleted file mode 100644 index 45ec84be76..0000000000 --- a/tests/hwtimer_spin/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -APPLICATION = hwtimer_spin -include ../Makefile.tests_common - -DISABLE_MODULE += auto_init - -include $(RIOTBASE)/Makefile.include diff --git a/tests/hwtimer_spin/main.c b/tests/hwtimer_spin/main.c deleted file mode 100644 index dc0842b4ec..0000000000 --- a/tests/hwtimer_spin/main.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2014 Ludwig Ortmann - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup tests - * @{ - * - * @file - * @brief Hwtimer test application - * - * @author Ludwig Ortmann - * @author Hauke Petersen - * - * @} - */ - -#include - -#include "hwtimer.h" -#include "board.h" - -int main(void) -{ - puts("This is just a functionality test for hwtimer_spin."); - - puts("\nYou should see the message \"success\" after a while if" - " this test was successful."); - puts("If you do not see that message, something went wrong.\n"); - - for (unsigned long r = 1000; r > 0; r--) { - for (unsigned long i = HWTIMER_SPIN_BARRIER; i > 0; i--) { - hwtimer_wait(i); - } - } - puts("success"); - return 0; -} diff --git a/tests/hwtimer_wait/Makefile b/tests/hwtimer_wait/Makefile deleted file mode 100644 index 3ffd19ce83..0000000000 --- a/tests/hwtimer_wait/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -APPLICATION = hwtimer_wait -include ../Makefile.tests_common - -DISABLE_MODULE += auto_init - -include $(RIOTBASE)/Makefile.include diff --git a/tests/hwtimer_wait/main.c b/tests/hwtimer_wait/main.c deleted file mode 100644 index b6aad533eb..0000000000 --- a/tests/hwtimer_wait/main.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014 Ludwig Ortmann - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. 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 "hwtimer.h" -#include "board.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."); - - long iterations = 1000; - long start_duration = (HWTIMER_SPIN_BARRIER + 1) << 5; - long duration = iterations * start_duration * 2L; - - printf("The test should take about %li sec.\n", (HWTIMER_TICKS_TO_US(duration)/1000000)); - - for (unsigned long r = iterations; r > 0; r--) { - for (unsigned long i = start_duration; i > HWTIMER_SPIN_BARRIER; i = i >> 1) { - hwtimer_wait(i); - } - } - puts("success"); - - return 0; -}