Move run_test script to a more suitable place.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 Nov 2008 10:36:51 +0000 (10:36 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 Nov 2008 10:36:51 +0000 (10:36 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1938 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/run_tests.sh [deleted file]
test/run_tests.sh [new file with mode: 0755]

diff --git a/bertos/run_tests.sh b/bertos/run_tests.sh
deleted file mode 100755 (executable)
index c9c4906..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2005 Develer S.r.l. (http://www.develer.com/)
-# Copyright 2008 Bernie Innocenti <bernie@codewiz.org>
-#
-# Version: $Id$
-# Author:  Bernie Innocenti <bernie@codewiz.org>
-#
-
-# Testsuite output level:
-#  0 - quiet
-#  1 - progress output
-#  2 - build warnings
-#  3 - execution output
-#  4 - build commands
-VERBOSE=${VERBOSE:-1}
-
-CC=gcc
-#FIXME: -Ibertos/emul should not be needed
-CFLAGS="-W -Wall -Wextra -Ibertos -Ibertos/emul -std=gnu99 -fno-builtin -D_DEBUG -DARCH=(ARCH_EMUL|ARCH_UNITTEST)"
-
-CXX=g++
-CXXFLAGS="$CFLAGS"
-
-TESTS=${TESTS:-`find . \
-       \( -name .svn -prune -o -name .git -prune -o -name .hg  -prune \) \
-       -o -name "*_test.c*" -print` }
-
-TESTOUT="testout"
-
-buildout='/dev/null'
-runout='/dev/null'
-[ "$VERBOSE" -ge 2 ] && buildout='/dev/stdout'
-[ "$VERBOSE" -ge 3 ] && runout='/dev/stdout'
-
-# Needed to get build/exec result code rather than tee's
-set -o pipefail
-
-rm -rf "${TESTOUT}.old"
-mv -f "${TESTOUT}" "$TESTOUT.old"
-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..."
-       [ $VERBOSE -gt 4 ] && echo " $BUILDCMD"
-       if $BUILDCMD 2>&1 | tee >$buildout $TESTOUT/$name.build; then
-               [ $VERBOSE -gt 0 ] && echo "Running $name..."
-               if ! $exe 2>&1 | tee >$runout $TESTOUT/$name.out; then
-                       echo "FAILED [RUN]: $name"
-               fi
-       else
-               echo "FAILED [BUILD]: $name"
-       fi
-done
-
diff --git a/test/run_tests.sh b/test/run_tests.sh
new file mode 100755 (executable)
index 0000000..c9c4906
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Copyright 2005 Develer S.r.l. (http://www.develer.com/)
+# Copyright 2008 Bernie Innocenti <bernie@codewiz.org>
+#
+# Version: $Id$
+# Author:  Bernie Innocenti <bernie@codewiz.org>
+#
+
+# Testsuite output level:
+#  0 - quiet
+#  1 - progress output
+#  2 - build warnings
+#  3 - execution output
+#  4 - build commands
+VERBOSE=${VERBOSE:-1}
+
+CC=gcc
+#FIXME: -Ibertos/emul should not be needed
+CFLAGS="-W -Wall -Wextra -Ibertos -Ibertos/emul -std=gnu99 -fno-builtin -D_DEBUG -DARCH=(ARCH_EMUL|ARCH_UNITTEST)"
+
+CXX=g++
+CXXFLAGS="$CFLAGS"
+
+TESTS=${TESTS:-`find . \
+       \( -name .svn -prune -o -name .git -prune -o -name .hg  -prune \) \
+       -o -name "*_test.c*" -print` }
+
+TESTOUT="testout"
+
+buildout='/dev/null'
+runout='/dev/null'
+[ "$VERBOSE" -ge 2 ] && buildout='/dev/stdout'
+[ "$VERBOSE" -ge 3 ] && runout='/dev/stdout'
+
+# Needed to get build/exec result code rather than tee's
+set -o pipefail
+
+rm -rf "${TESTOUT}.old"
+mv -f "${TESTOUT}" "$TESTOUT.old"
+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..."
+       [ $VERBOSE -gt 4 ] && echo " $BUILDCMD"
+       if $BUILDCMD 2>&1 | tee >$buildout $TESTOUT/$name.build; then
+               [ $VERBOSE -gt 0 ] && echo "Running $name..."
+               if ! $exe 2>&1 | tee >$runout $TESTOUT/$name.out; then
+                       echo "FAILED [RUN]: $name"
+               fi
+       else
+               echo "FAILED [BUILD]: $name"
+       fi
+done
+