forked from eagafonov/supermake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntrial.sh
executable file
·50 lines (41 loc) · 946 Bytes
/
runtrial.sh
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
#!/bin/bash
P=''
F=''
PYTHON=python
PYTHONPATH=$PYTHONPATH:`pwd`/smpp.twisted:`pwd`/smpp.pdu
export PYTHONPATH
TRIAL=`which trial`
COVERAGE=`which python-coverage`
if [ ! -x "$COVERAGE" ]; then
echo "W: Coverate tool is not installed. Report will not be generated"
fi
TESTS=$@
if [ -z "$TESTS" ]; then
TESTS=`find tests -name 'test_*.py'`
fi
for tc in $TESTS; do
echo "I: Execute $tc"
if [ -x "$COVERAGE" ]; then
$COVERAGE run -p --source `dirname $0` $TRIAL $tc
else
$PYTHON $TRIAL $tc
fi
if (($?)); then
F="$F$tc\n"
else
P="$P$tc\n"
fi
done
echo '******************'
echo 'PASSED'
echo -e $P
echo "FAILED"
echo -e $F
if [ -x "$COVERAGE" ]; then
$COVERAGE combine
rm -Rf htmlcov
$COVERAGE html --omit="`pwd`/tests/test_*.py"
echo "Coveage HTMl report is stored in file://`pwd`/htmlcov/index.html"
else
echo "No coveage HTMl report is generated"
fi