+ <xsl:param name="options"/>
+ <xsl:param name="guioptions"/>
+ERR=0
+cd tests || exit 0
+ulimit -c unlimited
+
+try()
+{
+ rm -f core
+ echo Running: "$@"
+ "$@" || ERR=$?
+
+ if [ -f core -a -x "`which gdb`" ]; then
+ echo Crashed, attempting to display backtrace:
+ gdb -batch -c core -ex 'set pagination off' -ex bt "$1"
+ fi
+
+ echo
+}
+
+try ./test <xsl:value-of select="normalize-space($options)"/>
+
+test -x test_gui || exit $ERR
+
+if [ -z "$DISPLAY" ]; then
+ echo '$DISPLAY is not set, skipping GUI tests.'
+ exit $ERR
+fi
+
+echo 'Checking window manager:'
+WINDOW_MANAGER=$(xprop -root 32x '\n$0\n' _NET_SUPPORTING_WM_CHECK | grep ^0x)
+
+if [ -z "$WINDOW_MANAGER" ]; then
+ echo 'Window manager not present, skipping GUI tests.'
+ exit $ERR
+fi
+
+xprop -id $WINDOW_MANAGER 8s _NET_WM_NAME
+echo
+
+try ./test_gui <xsl:value-of select="normalize-space($guioptions)"/>
+
+exit $ERR