From 78eea60c48fd902dd469654a69b1dcf5abb93f0c Mon Sep 17 00:00:00 2001 From: bernie Date: Wed, 13 Aug 2008 12:06:56 +0000 Subject: [PATCH] Fix timer test git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1638 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/drv/timer.c | 3 +-- bertos/emul/timer_posix.c | 16 ++++++++++++---- bertos/rules.mk | 2 +- bertos/run_tests.sh | 14 +++++++------- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index f49f6a86..333d6cd8 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -27,8 +27,7 @@ * the GNU General Public License. * * Copyright 2003, 2004, 2005, 2006 Develer S.r.l. (http://www.develer.com/) - * Copyright 2000 Bernie Innocenti - * + * Copyright 2000, 2008 Bernie Innocenti * --> * * \brief Hardware independent timer driver (implementation) diff --git a/bertos/emul/timer_posix.c b/bertos/emul/timer_posix.c index b8348057..c372bae1 100644 --- a/bertos/emul/timer_posix.c +++ b/bertos/emul/timer_posix.c @@ -26,14 +26,12 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2005,2008 Develer S.r.l. (http://www.develer.com/) - * + * Copyright 2005, 2008 Develer S.r.l. (http://www.develer.com/) * --> * * \version $Id$ * * \author Bernie Innocenti - * * \brief Low-level timer module for Qt emulator (implementation). */ #include // hptime.t @@ -61,7 +59,7 @@ static void timer_hw_init(void) sigaction(SIGALRM, &sa, NULL); // Setup POSIX realtime timer to interrupt every 1/TIMER_TICKS_PER_SEC. - static struct itimerval itv = + static const struct itimerval itv = { { 0, 1000000 / TIMER_TICKS_PER_SEC }, /* it_interval */ { 0, 1000000 / TIMER_TICKS_PER_SEC } /* it_value */ @@ -69,6 +67,16 @@ static void timer_hw_init(void) setitimer(ITIMER_REAL, &itv, NULL); } +static void timer_hw_cleanup(void) +{ + static const struct itimerval itv = + { + { 0, 0 }, /* it_interval */ + { 0, 0 } /* it_value */ + }; + setitimer(ITIMER_REAL, &itv, NULL); +} + INLINE hptime_t timer_hw_hpread(void) { return hptime_get(); diff --git a/bertos/rules.mk b/bertos/rules.mk index beb8f047..f898fcd9 100644 --- a/bertos/rules.mk +++ b/bertos/rules.mk @@ -63,7 +63,7 @@ tags: .PHONY: check check: $L "Running testsuite" - $Q ./run_tests.sh + $Q bertos/run_tests.sh define build_target diff --git a/bertos/run_tests.sh b/bertos/run_tests.sh index 77689f48..349dc9ef 100755 --- a/bertos/run_tests.sh +++ b/bertos/run_tests.sh @@ -11,7 +11,7 @@ VERBOSE=1 CC=gcc -CFLAGS="-W -Wall -Wextra -I. -Iemul -std=gnu99 -fno-builtin -D_DEBUG -D_TEST -DARCH=ARCH_EMUL" +CFLAGS="-W -Wall -Wextra -Ibertos -Ibertos/emul -std=gnu99 -fno-builtin -D_DEBUG -D_TEST -DARCH=ARCH_EMUL" CXX=g++ CXXFLAGS="$CFLAGS" @@ -22,14 +22,14 @@ for test in $TESTS; do [ $VERBOSE -gt 0 ] && echo "Running $test..." case "$test" in *.cpp) - $CXX $CXXFLAGS $test -o test || exit 1 - ./test || exit 1 - rm -f test + $CXX $CXXFLAGS $test -o images/testcase || exit 1 + ./testcase || echo "FAILED: $test" + rm -f testcase ;; *.c) - $CC $CFLAGS $test -o test || exit 1 - ./test || exit 1 - rm -f test + $CC $CFLAGS $test -o testcase || exit 1 + ./testcase || echo "FAILED: $test" + rm -f testcase ;; esac done -- 2.25.1