| 1 |
#! /bin/sh |
| 2 |
# gtk-engines - a collection of drawing engines for GTK+ |
| 3 |
# Copyright (C) 2007 Benjamin Berg <[email protected]> |
| 4 |
# |
| 5 |
# This library is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU Lesser General Public |
| 7 |
# License as published by the Free Software Foundation; either |
| 8 |
# version 2.1 of the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This library is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# Lesser General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU Lesser General Public |
| 16 |
# License along with this library; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
# |
| 19 |
# Project contact: <[email protected]> |
| 20 |
# |
| 21 |
|
| 22 |
|
| 23 |
ENGINE="`basename $0 | cut -d '_' -f 2`" |
| 24 |
|
| 25 |
# Do the test for every file starting with the prefix |
| 26 |
|
| 27 |
FAILED="0" |
| 28 |
|
| 29 |
for RC_FILE in $srcdir/gtkrcs/$ENGINE*; do |
| 30 |
test -f $RC_FILE || continue |
| 31 |
something_tested="1" |
| 32 |
|
| 33 |
export GTK2_RC_FILES=$RC_FILE |
| 34 |
RC_FILE_BASENAME="`basename $RC_FILE`" |
| 35 |
MY_EXEC_WRAPPER="`echo "$EXEC_WRAPPER" | sed s/THEME/$RC_FILE_BASENAME/`" |
| 36 |
|
| 37 |
$srcdir/runinx $MY_EXEC_WRAPPER ./torturetest 2>/dev/null >/dev/null |
| 38 |
|
| 39 |
|
| 40 |
if [ "$?" != "0" ]; then |
| 41 |
FAILED=1; |
| 42 |
if [ "x$DEBUG_ON_FAILURE" != "x" ] && [ "x$DEBUG_COMMAND" != "x" ]; then |
| 43 |
$srcdir/runinx $DEBUG_COMMAND $MY_EXEC_WRAPPER ./torturetest |
| 44 |
fi |
| 45 |
fi |
| 46 |
done |
| 47 |
|
| 48 |
if [ "x$something_tested" = "x" ]; then |
| 49 |
echo "Failed to run test for \"$ENGINE\" because no gtkrc files were found" |
| 50 |
exit 77; |
| 51 |
fi |
| 52 |
|
| 53 |
if [ "$FAILED" != "0" ]; then |
| 54 |
# This is pretty stupid, but I don't know of a better way to handle it |
| 55 |
# We need to make sure that if buildin failes, all other failures don't |
| 56 |
# cause an overall test failure (ie. exit 77). I know this is stupid ... |
| 57 |
# Otherwise "make check" will _always_ fail with a broken GTK+. |
| 58 |
if [ "$ENGINE" = "buildin" ]; then |
| 59 |
echo "WARNING: The GTK+ buildin theme failed the torture test!" |
| 60 |
echo "WARNING: " |
| 61 |
echo "WARNING: As the other engines may fall back to the buildin theme, other tests" |
| 62 |
echo "WARNING: may fail in the buildin theme that we don't control." |
| 63 |
echo "WARNING: The other tests will be run, but in case of failure SKIP instead of FAIL." |
| 64 |
echo "WARNING: This way 'make check' will not fail even with a broken GTK+." |
| 65 |
echo "WARNING:" |
| 66 |
echo "WARNING: It may also mean that there is just no X server to run the test on." |
| 67 |
echo "WARNING: (and starting an Xvfb server failed)" |
| 68 |
echo |
| 69 |
touch torture_buildin-failed |
| 70 |
exit 77 |
| 71 |
else |
| 72 |
# If buildin-failed, then exit with status 77 |
| 73 |
if [ -f torture_buildin-failed ]; then |
| 74 |
exit 77 |
| 75 |
else |
| 76 |
exit 1 |
| 77 |
fi |
| 78 |
fi |
| 79 |
else |
| 80 |
# Remove the torture_buildin-failed file on success |
| 81 |
if [ "$ENGINE" = "buildin" ]; then |
| 82 |
test -f torture_buildin-failed && rm -f torture_buildin-failed |
| 83 |
fi |
| 84 |
|
| 85 |
exit 0 |
| 86 |
fi |