From: bernie Date: Sun, 17 Aug 2008 16:54:41 +0000 (+0000) Subject: Nicer testsuite runner X-Git-Tag: 2.0.0~280 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=070278ecb03b83bf3594953cc0dba189d8b77b0a;p=bertos.git Nicer testsuite runner git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1654 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/run_tests.sh b/bertos/run_tests.sh index 349dc9ef..22309eca 100755 --- a/bertos/run_tests.sh +++ b/bertos/run_tests.sh @@ -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