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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/sh
set -e
if [ ! -x /usr/bin/python-coverage ]; then
echo "please install python-coverage"
exit 1
fi
if [ ! -x /usr/bin/xvfb-run ]; then
echo "please install xvfb"
exit 1
fi
if ! python -c 'import mock'; then
echo "please install python-mock"
exit 1
fi
if ! python -c 'import unittest2'; then
echo "please install python-unittest2"
exit 1
fi
if ! python -c 'import aptdaemon.test'; then
echo "please install python-aptdaemon.test"
exit 1
fi
if ! python -c 'import lxml'; then
echo "please install python-lxml"
exit 1
fi
if ! python -c 'import PyQt4'; then
echo "please install python-qt4"
exit 1
fi
# clear coverage data
# coverage erase will not erase the files from --parallel-mode
rm -f .coverage*
# run with xvfb and coverage
PYTHON="python-coverage run --parallel-mode"
#PYTHON="xvfb-run $PYTHON"
# and record failures here
OUTPUT="./output"
rm -rf $OUTPUT
FAILED=""
FILES=$(find . -name 'test_*.py')
for file in $FILES; do
if [ -f $file ]; then
echo -n "Testing $file"
mkdir -p ${OUTPUT}/$(dirname $file)
if ! $PYTHON $file >output/$file.out 2>&1 ; then
FAILED="$FAILED $file"
echo " FAIL"
else
echo " success"
rm -f ${OUTPUT}/$file.out;
fi
fi
done;
# gather the coverage data
./gen-coverage-report.sh
if [ -n "$FAILED" ]; then
echo "FAILED: $FAILED";
echo "Check ${OUTPUT}/ directory for the details";
exit 1;
fi
|