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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/bin/bash
#
# Copyright 2012 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>
################################################################################
_CMD=""
_TARGET=$1
_TESTFILE=$2
_MINIMAL=$3
_XML="../../test_$_TARGET_$_TESTFILE.xml"
_ARGS="-p -o -p $_XML,xunitxml -p -o -p -,txt"
set +e
function create_test_cmd {
_CMD="dbus-test-runner --task ./$_TARGET -n $_TESTFILE -m 300"
if [ "$_MINIMAL" = "minimal" ]; then
_CMD="$_CMD -p -platform -p minimal"
fi
if [ $_TARGET != $_TESTFILE ]; then
_CMD="$_CMD -p -input -p $_TESTFILE"
fi
_CMD="$_CMD -p -maxwarnings -p 40"
}
function execute_test_cmd {
echo "Executing $_CMD $_ARGS"
if [ ! -x $_TARGET ]; then
echo "Error: $_TARGET wasn't built!"
RESULT=2
elif [ $DISPLAY ]; then
# https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
# https://bugreports.qt-project.org/browse/QTBUG-36243
QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \
ALARM_BACKEND=memory \
$_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
# Note: Get first command before the pipe, $? would be ambiguous
RESULT=${PIPESTATUS[0]}
WARNINGS=$(grep -c qwarn $_XML)
EXCEPTIONS='tst_components_benchmark \
tst_tabbar.qml \
tst_datepicker.qml \
tst_qquick_image_extension \
tst_page.qml \
tst_toolbar.qml \
tst_tabs.qml \
'
if [ $WARNINGS -ne 0 ]; then
if [[ $EXCEPTIONS == *$_TARGET_$_TESTFILE* ]]; then
echo "FIXME: $WARNINGS warnings - Known problematic test"
else
echo "Error: $WARNINGS warnings in $_TARGET_$_TESTFILE"
RESULT=666
fi
elif [[ $EXCEPTIONS == *$_TARGET_$_TESTFILE* ]]; then
echo Woot! Known problematic test did pass afterall!
echo Consider removing $_TARGET_$_TESTFILE from EXCEPTIONS in $0
fi
else
echo "Skipped because no DISPLAY available"
RESULT=0
fi
# segfault
if [ $RESULT -eq 139 ]; then
RESULT=2
fi
# abort
if [ $RESULT -eq 134 ]; then
RESULT=2
fi
echo "$_TARGET_$_TESTFILE exited with $RESULT"
return $RESULT
}
create_test_cmd
execute_test_cmd
RESULT=$?
exit $RESULT
|