summaryrefslogtreecommitdiff
path: root/client/test.sh
blob: 05f6372d1ed0ff63374a64a175962998a03afba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

TEST_PRO_IN=test.pro.in
TEST_PRO=test.pro
MAKEFILE=Makefile.test
TEST_APP=test_app

# Make sure that pracro.cc gets compiled again with the TESTING flags set.
rm -f pracro.o

if [ -z $1 ]
then
    TESTFILES=test/test*.cc
else
    TESTFILES=$1
fi

rm -f test.log

for TEST in $TESTFILES
do
    OUTPUT=$TEST.log

    echo -e "\033[0;2mTesting $TEST:"
    echo Testing $TEST: > $OUTPUT

    echo -n "* Compiling $TEST test"
    echo Compiling $TEST test: >> $OUTPUT
    echo ${COMPILE} >> $OUTPUT
    cpp -P -E -DTESTFILE=\"$TEST\" $TEST_PRO_IN -o $TEST_PRO
    qmake -makefile $TEST_PRO -o $MAKEFILE
    if make -f $MAKEFILE >> ${OUTPUT} 2>&1 ; then
	echo -e "\r\t\t\t\t\t\t[\033[1;32mSuccess\033[0;2m]"
	echo "[Success]" >> $OUTPUT
	
	echo -n "* Running   $TEST test"
	echo Running $TEST test: >> $OUTPUT
	cp -f $TEST_APP $TEST.bin
	if ./$TEST_APP >> $OUTPUT 2>&1 ; then
	    echo -e "\r\t\t\t\t\t\t[\033[1;32mSuccess\033[0;2m]"
	    echo "[Success]" >> $OUTPUT
	else
	    echo -e "\r\t\t\t\t\t\t[\033[1;31mFailure\033[0;2m]"
	    echo "[Failure]" >> $OUTPUT
	fi
    else
	echo -e "\r\t\t\t\t\t\t[\033[1;31mFailure\033[0;2m]"
	echo "[Failure]" >> $OUTPUT
    fi
		
    rm -f $MAKEFILE $TEST_PRO $TEST_APP
done

# Make sure that a 'normal' compile will compile pracro.cc
# without the TESTING flag set
rm -f pracro.o