Nicer testsuite runner
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 17 Aug 2008 16:54:41 +0000 (16:54 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 17 Aug 2008 16:54:41 +0000 (16:54 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1654 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/run_tests.sh

index 349dc9ef4ea613098305fb3d3ac12e9847d2382d..22309ecadbe5c74346cb7747dc506144d414bfe2 100755 (executable)
@@ -16,21 +16,28 @@ CFLAGS="-W -Wall -Wextra -Ibertos -Ibertos/emul -std=gnu99 -fno-builtin -D_DEBUG
 CXX=g++
 CXXFLAGS="$CFLAGS"
 
-TESTS=${TESTS:-`find . -name "*_test.c*"`}
-
-for test in $TESTS; do
-       [ $VERBOSE -gt 0 ] && echo "Running $test..."
-       case "$test" in
-       *.cpp)
-               $CXX $CXXFLAGS $test -o images/testcase || exit 1
-               ./testcase || echo "FAILED: $test"
-               rm -f testcase
-       ;;
-       *.c)
-               $CC $CFLAGS $test -o testcase || exit 1
-               ./testcase || echo "FAILED: $test"
-               rm -f testcase
-       ;;
+TESTS=${TESTS:-`find . \
+       \( -name .svn -prune -o -name .git -prune -o -name .hg  -prune \) \
+       -o -name "*_test.c*" -print` }
+
+TESTOUT="testout"
+
+mkdir -p "$TESTOUT"
+
+for src in $TESTS; do
+       name="`basename $src | sed -e 's/\.cpp$//' -e 's/\.c$//'`"
+       exe="./$TESTOUT/$name"
+
+       case "$src" in
+       *.cpp) BUILDCMD="$CXX $CXXFLAGS $src -o $exe" ;;
+       *.c)   BUILDCMD="$CC  $CXXFLAGS $src -o $exe" ;;
        esac
+
+       [ $VERBOSE -gt 0 ] && echo "Building $name..."
+       $BUILDCMD 2>&1 | tee $name.build || echo "FAILED [BUILD]: $name"
+
+       [ $VERBOSE -gt 0 ] && echo "Running $name..."
+       $exe 2>&1 | tee $name.out || echo "FAILED [RUN]: $name"
+       #rm -f "$exe"
 done