summaryrefslogtreecommitdiff
path: root/server/tools/test
diff options
context:
space:
mode:
authorsenator <elsenator@gmail.com>2011-11-23 15:07:01 +0100
committersenator <elsenator@gmail.com>2011-11-23 15:07:01 +0100
commit9989ea2f6bfa19bd349bbbdec8ec3f56c1427245 (patch)
tree91cab6be068ee7f99accb6e97dda5a7bda5879e0 /server/tools/test
parentc09fb0787c3af4d282ae3fac53c706665a91b0a7 (diff)
parent07244d0376e2e25eaeba913e684bd06122ded893 (diff)
Merge branch 'master' of http://git.aasimon.org/public/pracro
Diffstat (limited to 'server/tools/test')
-rwxr-xr-xserver/tools/test55
1 files changed, 55 insertions, 0 deletions
diff --git a/server/tools/test b/server/tools/test
new file mode 100755
index 0000000..ec54e70
--- /dev/null
+++ b/server/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