summaryrefslogtreecommitdiff
path: root/tools/test
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-02-17 12:25:50 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-02-17 12:25:50 +0100
commit93890eace0b7a35cb597272e7449b1e0ee533a73 (patch)
treed8f11ea615e083fed1d12f1af6df12599a78f764 /tools/test
parent4278976501fb82771d42ac1fe7654e2e0a2f69a1 (diff)
Add tool files.
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/test b/tools/test
new file mode 100755
index 0000000..ec54e70
--- /dev/null
+++ b/tools/test
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+TEST=`echo -n $1 | cut -d'.' -f1`
+UPPER=`echo $TEST | tr 'a-z.' 'A-Z_'`
+OUTPUT=test_$TEST
+DEFINE=TEST_$UPPER
+
+SCRIPTDIR=`dirname $0`
+
+INFILE=$1
+shift
+OBJFILES=""
+for f in $TEST_DEPS
+do
+ of=`echo -n $f | cut -d'.' -f1`.o;
+ OBJFILES="$OBJFILES $of"
+done
+
+COMMON_FLAGS="-DHAVE_CONFIG_H -I$SCRIPTDIR -O0 -g -D$DEFINE $TEST_LIBS $TEST_CFLAGS"
+CLEAN="rm -f $OBJFILES"
+PRECOMPILE="g++ -c $TEST_DEPS $COMMON_FLAGS"
+COMPILE="g++ -fprofile-arcs -ftest-coverage -fno-elide-constructors -Wall -Werror $COMMON_FLAGS -o $OUTPUT $INFILE $OBJFILES"
+
+echo -e "\033[0;2mTesting $TEST:"
+echo Testing $TEST: > $OUTPUT.log
+
+echo -n "* Compiling $TEST test"
+echo Compiling $TEST test: > $OUTPUT.log
+
+echo ${CLEAN} >> $OUTPUT.log
+${CLEAN} >> ${OUTPUT}.log 2>&1
+echo ${PRECOMPILE} >> $OUTPUT.log
+${PRECOMPILE} >> ${OUTPUT}.log 2>&1
+echo ${COMPILE} >> $OUTPUT.log
+
+if ${COMPILE} >> ${OUTPUT}.log 2>&1; then
+ echo -e "\r\t\t\t\t\t\t[\033[1;32mSuccess\033[0;2m]"
+ echo "[Success]" >> $OUTPUT.log
+
+ echo -n "* Running $TEST test"
+ echo Running $TEST test: >> $OUTPUT.log
+ if ./$OUTPUT >> $OUTPUT.log 2>&1; then
+ echo -e "\r\t\t\t\t\t\t[\033[1;32mSuccess\033[0;2m]"
+ echo "[Success]" >> $OUTPUT.log
+ else
+ echo -e "\r\t\t\t\t\t\t[\033[1;31mFailure\033[0;2m]"
+ echo "[Failure]" >> $OUTPUT.log
+ rm -f $OUTPUT
+ fi
+else
+ echo -e "\r\t\t\t\t\t\t[\033[1;31mFailure\033[0;2m]"
+ echo "[Failure]" >> $OUTPUT.log
+fi
+
+echo \ No newline at end of file