d/tests, d/run-tests.sh: Copy run-with-display from gtk4
This should make the build-time tests a bit more robust, by using the -noreset option to avoid a race condition (see #981201).
This commit is contained in:
parent
75292bb0de
commit
dfa31ce3c1
2
debian/README.source
vendored
2
debian/README.source
vendored
@ -12,7 +12,7 @@ srcdir=${srcdir}/testsuite/reftests
|
||||
builddir=${builddir}/testsuite/reftests
|
||||
|
||||
cd "${builddir}"
|
||||
xvfb-run -a \
|
||||
debian/tests/run-with-display x11 \
|
||||
dbus-run-session -- \
|
||||
env \
|
||||
-u XDG_RUNTIME_DIR \
|
||||
|
17
debian/copyright
vendored
17
debian/copyright
vendored
@ -92,6 +92,9 @@ Copyright: Copyright (C) 1986, 1987, 1998 The Open Group
|
||||
Copyright 2012 Intel Corporation
|
||||
License: LGPL-2+ and LGPL-2.1+ and Expat
|
||||
|
||||
Files: debian/tests/run-with-display
|
||||
Copyright: 2021 Marco Trevisan
|
||||
License: GPL-3+
|
||||
|
||||
Files: po/*
|
||||
po-properties/*
|
||||
@ -973,6 +976,20 @@ License: Expat
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
License: GPL-3+
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
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 General Public License for more details.
|
||||
Comment:
|
||||
On Debian systems, a copy of the GNU General Public License version 3
|
||||
can be found in /usr/share/common-licenses/GPL-3.
|
||||
|
||||
License: LGPL-2+
|
||||
This library 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
|
||||
|
2
debian/run-tests.sh
vendored
2
debian/run-tests.sh
vendored
@ -43,7 +43,7 @@ for BACKEND in x11; do
|
||||
GIO_USE_VFS=local \
|
||||
GIO_USE_VOLUME_MONITOR=unix \
|
||||
dbus-run-session -- \
|
||||
xvfb-run -a \
|
||||
debian/tests/run-with-display x11 \
|
||||
dh_auto_test --builddirectory="$BUILDDIR" -- \
|
||||
"$@" \
|
||||
|| touch "$test_data/tests-failed"
|
||||
|
4
debian/tests/build
vendored
4
debian/tests/build
vendored
@ -9,6 +9,7 @@ set -u
|
||||
set -x
|
||||
|
||||
export NO_AT_BRIDGE=1
|
||||
srcdir="$(pwd)"
|
||||
|
||||
# Workaround for #1025312
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
@ -58,6 +59,7 @@ EOF
|
||||
"${CROSS_COMPILE}gcc" -o gtktest gtktest.c $("${CROSS_COMPILE}pkg-config" --cflags --libs gtk+-3.0)
|
||||
echo "build: OK"
|
||||
[ -x gtktest ]
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
"${srcdir}"/debian/tests/run-with-display x11 \
|
||||
dbus-run-session -- \
|
||||
./gtktest
|
||||
echo "run: OK"
|
||||
|
5
debian/tests/installed-tests
vendored
5
debian/tests/installed-tests
vendored
@ -19,8 +19,9 @@ tests=$(gnome-desktop-testing-runner -l gtk+ |
|
||||
grep -v '^gtk./a11ystate.test$' |
|
||||
grep -v '^gtk./reftests')
|
||||
|
||||
exec dbus-run-session -- \
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
exec \
|
||||
debian/tests/run-with-display x11 \
|
||||
dbus-run-session -- \
|
||||
gnome-desktop-testing-runner \
|
||||
--report-directory="$AUTOPKGTEST_ARTIFACTS" \
|
||||
--tap \
|
||||
|
4
debian/tests/python3-gi
vendored
4
debian/tests/python3-gi
vendored
@ -5,7 +5,9 @@ export NO_AT_BRIDGE=1
|
||||
# Workaround for #1025312
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
exec \
|
||||
debian/tests/run-with-display x11 \
|
||||
dbus-run-session -- \
|
||||
python3 <<EOF
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
|
67
debian/tests/run-with-display
vendored
Executable file
67
debian/tests/run-with-display
vendored
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
# vim:set sw=4 sts=4 et:
|
||||
#
|
||||
# Run a wrapped command in a fake display environment
|
||||
#
|
||||
# Copyright 2021 Marco Trevisan <marco@ubuntu.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Assume a Debian Policy §10.4-compatible shell like dash or bash (with the
|
||||
# 'local' builtin)
|
||||
# shellcheck disable=SC2039
|
||||
|
||||
set -e
|
||||
|
||||
me="$(basename "$0")"
|
||||
|
||||
usage () {
|
||||
local status="${1-2}"
|
||||
|
||||
if [ "$status" -ne 0 ]; then
|
||||
exec >&2
|
||||
fi
|
||||
|
||||
echo "Usage: $me [wayland|x11] COMMAND [ARGS...]"
|
||||
exit "$status"
|
||||
}
|
||||
|
||||
display="$1"
|
||||
|
||||
case "$display" in
|
||||
wayland)
|
||||
shift
|
||||
if [ -z "$XDG_RUNTIME_DIR" ]; then
|
||||
our_xrd="$(mktemp -d -t xdg-runtime-XXXXXXXX)"
|
||||
export XDG_RUNTIME_DIR="$our_xrd"
|
||||
fi
|
||||
if ! command -v weston > /dev/null; then
|
||||
echo "No weston available"
|
||||
exit 1
|
||||
fi
|
||||
socket="wayland-$(od -vAn -N1 -tu1 < /dev/urandom | tr -d '[:space:]')"
|
||||
weston --backend=headless-backend.so --socket="$socket" --idle-time=0 2>&1 &
|
||||
weston_pid=$!
|
||||
trap 'kill $weston_pid; [ -n $our_xrd ] && rm -rfv $our_xrd' EXIT INT
|
||||
while [ ! -S "$XDG_RUNTIME_DIR/$socket" ]; do
|
||||
echo "Waiting for socket..."
|
||||
sleep 1
|
||||
done
|
||||
env -u DISPLAY WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$socket" "$@"
|
||||
exit $?
|
||||
;;
|
||||
x11)
|
||||
shift
|
||||
if ! command -v xvfb-run > /dev/null; then
|
||||
echo "No xvfb-run available"
|
||||
exit 1
|
||||
fi
|
||||
exec env -u WAYLAND_DISPLAY xvfb-run -a -s "-screen 0 1024x768x24 -noreset" "$@"
|
||||
;;
|
||||
-h|--help|help)
|
||||
usage 0
|
||||
;;
|
||||
*)
|
||||
usage 2
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user