diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-11-17 14:38:54 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-11-17 14:38:54 +0100 |
commit | 64610c7453fc6bc0be7d3f9cb49058fb849be725 (patch) | |
tree | 0a905e2c3974825e687d12aed1b51900c0217de9 /server/tools/test | |
parent | 5a7b924ba441ad0fef77d9c312c23f53cdba5fe8 (diff) |
Move server-only tools to server tools folder.
Diffstat (limited to 'server/tools/test')
-rwxr-xr-x | server/tools/test | 55 |
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 |