run_tests: unbreak and let TESTS be overridden externally
[bertos.git] / bertos / run_tests.sh
1 #!/bin/bash
2 #
3 # Copyright 2005 Develer S.r.l. (http://www.develer.com/)
4 # All rights reserved.
5 #
6 # Author: Bernie Innocenti <bernie@codewiz.org>
7 #
8 # $Id$
9 #
10
11
12 VERBOSE=1
13
14 CC=gcc
15 CFLAGS="-W -Wall -Wextra -I. -Iemul -std=gnu99 -fno-builtin -D_DEBUG -D_TEST -DARCH=ARCH_EMUL"
16
17 CXX=g++
18 CXXFLAGS="$CFLAGS"
19
20 TESTS=${TESTS:-`find . -name "*_test.*"`}
21
22 for test in $TESTS; do
23         [ $VERBOSE -gt 0 ] && echo "Running $test..."
24         case "$test" in
25         *.cpp)
26                 $CXX $CXXFLAGS $test -o test || exit 1
27                 ./test || exit 1
28                 rm -f test
29         ;;
30         *.c)
31                 $CC $CFLAGS $test -o test || exit 1
32                 ./test || exit 1
33                 rm -f test
34         ;;
35         esac
36 done
37