7
dpkg-checkbuilddeps -d 'python-coverage, xvfb, python-mock, python-unittest2,
8
python3-aptdaemon.test, python-lxml, python-qt4'
10
if [ ! -e /var/lib/apt-xapian-index/index ]; then
11
echo "please run sudo update-apt-xapian-index"
15
# check if basic http access works
16
HTTP_URL=http://software-center.ubuntu.com
17
if ! curl -s $HTTP_URL >/dev/null; then
18
echo "NEED curl and http access to $HTTP_URL"
23
# coverage erase will not erase the files from --parallel-mode
24
rm -f $TESTS_DIR/.coverage*
26
# run with xvfb and coverage
30
# mvo 2012-11-05: disabled as this causes hangs in raring
31
#XVFB=$(which xvfb-run)
35
XVFB_CMDLINE="$XVFB -a"
39
COVERAGE=$(which python-coverage)
40
if [ $COVERAGE ]; then
41
# If you are measuring coverage in a multi-process program, or across a
42
# number of machines, you’ll want the --parallel-mode switch to keep the
43
# data separate during measurement. See Combining data files below.
44
##COVERAGE_CMDLINE="$COVERAGE run --parallel-mode"
45
echo "No coverage for now."
48
PYTHON="$XVFB_CMDLINE $COVERAGE_CMDLINE python -m unittest"
50
# and record failures here
51
OUTPUT=$TESTS_DIR"/output"
55
for i in $(find $1 -maxdepth 1 -name 'test_*.py'); do
56
TEST_NAME=$(basename $i | cut -d '.' -f 1)
57
TEST_PREFIX=$(echo `dirname $i` | sed -e s'/\//./g')
58
printf '%-50s' "Testing $TEST_NAME..."
59
if ! $PYTHON -v -c -b $TEST_PREFIX.$TEST_NAME > $OUTPUT/$TEST_NAME.out 2>&1; then
60
FAILED="$FAILED $TEST_NAME"
62
# add .FAIL symlink to make finding the broken ones trivial
63
(cd $OUTPUT ; ln -s $TEST_NAME.out $TEST_NAME.out.FAIL)
66
rm -f ${OUTPUT}/$file.out;
71
if [ "$1" = "--sso-gtk" ]; then
72
# Run the SSO GTK+ suite
73
$PYTHON discover -s softwarecenter/sso/
74
elif [ $# -gt 0 ]; then
75
# run the requested tests if arguments were given,
76
# otherwise run the whole suite
77
# example of custom params (discover all the tests under the tests/gtk3 dir):
79
# ./run-tests.sh discover -v -s tests/gtk3/
81
# See http://docs.python.org/library/unittest.html#test-discovery
83
RUN_TESTS="$PYTHON $@"
84
echo "Running the command: $RUN_TESTS"
87
# 2012-05-30, nessita: Ideally, we should be able to run the whole suite
88
# using discovery, but there is too much interference between tests in
89
# order to do so, so we need a new python process per test file.
90
##RUN_TESTS="$PYTHON discover -v -c -b"
93
run_tests_for_dir "$TESTS_DIR/gtk3"
94
run_tests_for_dir $TESTS_DIR
96
# gather the coverage data
97
##./gen-coverage-report.sh
99
if [ -n "$FAILED" ]; then
100
echo "FAILED: $FAILED"
101
echo "Check ${OUTPUT}/ directory for the details"