[neon/backports-focal/xdg-desktop-portal/Neon/unstable] debian: Add patches to make installed-tests work better

Simon McVittie null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit 49401ce3c7827035f96c2a98cca9824d7bd23262 by Simon McVittie.
Committed on 05/08/2020 at 10:03.
Pushed by ash into branch 'Neon/unstable'.

Add patches to make installed-tests work better

A  +22   -0    debian/patches/Install-session.conf.in-to-expected-path-for-installed-te.patch
M  +4    -0    debian/patches/series
A  +32   -0    debian/patches/tests-Only-run-xdg-document-portal-in-foreground-when-uni.patch
A  +39   -0    debian/patches/tests-call-test-document-fuse.py-directly.patch
A  +31   -0    debian/patches/tests-use-kill-from-PATH.patch
M  +1    -0    debian/rules

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/49401ce3c7827035f96c2a98cca9824d7bd23262

diff --git a/debian/patches/Install-session.conf.in-to-expected-path-for-installed-te.patch b/debian/patches/Install-session.conf.in-to-expected-path-for-installed-te.patch
new file mode 100644
index 0000000..c91c14d
--- /dev/null
+++ b/debian/patches/Install-session.conf.in-to-expected-path-for-installed-te.patch
@@ -0,0 +1,22 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 5 Aug 2020 11:00:01 +0100
+Subject: Install session.conf.in to expected path for installed-tests
+
+Signed-off-by: Simon McVittie <smcv at debian.org>
+---
+ tests/Makefile.am.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc
+index 981c8d5..e873bae 100644
+--- a/tests/Makefile.am.inc
++++ b/tests/Makefile.am.inc
+@@ -108,7 +108,7 @@ dist_installed_test_dbs_DATA = tests/dbs/no_tables
+ dist_installed_test_portals_DATA = tests/portals/test.portal
+ endif
+ 
+-dist_installed_test_data = \
++dist_installed_test_DATA = \
+ 	tests/session.conf.in \
+ 	$(NULL)
+ 
diff --git a/debian/patches/series b/debian/patches/series
index a8f1fdb..9f515ad 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,7 @@ tests-Always-produce-verbose-output-from-subprocesses.patch
 Revert-Stop-building-the-icon-validator.patch
 validate-icon-Add-a-define-for-bwrap.patch
 Replace-the-icon-validator-with-the-one-from-Flatpak-1.8..patch
+tests-use-kill-from-PATH.patch
+tests-call-test-document-fuse.py-directly.patch
+tests-Only-run-xdg-document-portal-in-foreground-when-uni.patch
+Install-session.conf.in-to-expected-path-for-installed-te.patch
diff --git a/debian/patches/tests-Only-run-xdg-document-portal-in-foreground-when-uni.patch b/debian/patches/tests-Only-run-xdg-document-portal-in-foreground-when-uni.patch
new file mode 100644
index 0000000..e7ff6ef
--- /dev/null
+++ b/debian/patches/tests-Only-run-xdg-document-portal-in-foreground-when-uni.patch
@@ -0,0 +1,32 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 5 Aug 2020 10:58:17 +0100
+Subject: tests: Only run xdg-document-portal in foreground when uninstalled
+
+During build-time testing, we need to take special steps to run the
+just-built version of the portal. However, during "as-installed"
+testing we want to assert that it was installed correctly, and in
+particular that D-Bus .service file was installed correctly to make it
+activatable.
+
+Signed-off-by: Simon McVittie <smcv at debian.org>
+---
+ tests/test-document-fuse.sh | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-document-fuse.sh b/tests/test-document-fuse.sh
+index 7868c91..da0aa47 100755
+--- a/tests/test-document-fuse.sh
++++ b/tests/test-document-fuse.sh
+@@ -68,7 +68,11 @@ fi
+ 
+ # Run portal manually so that we get any segfault our assert output
+ # Add -v here to get debug output from fuse
+-./xdg-document-portal -r &
++# Only do this when running uninstalled; when running as an installed-test,
++# we rely on D-Bus activation.
++if [ -n "${XDP_UNINSTALLED:-}" ]; then
++    ./xdg-document-portal -r &
++fi
+ 
+ # First run a basic single-thread test
+ echo Testing single-threaded
diff --git a/debian/patches/tests-call-test-document-fuse.py-directly.patch b/debian/patches/tests-call-test-document-fuse.py-directly.patch
new file mode 100644
index 0000000..ebe4648
--- /dev/null
+++ b/debian/patches/tests-call-test-document-fuse.py-directly.patch
@@ -0,0 +1,39 @@
+From: Jan Tojnar <jtojnar at gmail.com>
+Date: Sun, 21 Jun 2020 17:59:23 +0200
+Subject: tests: call test-document-fuse.py directly
+
+It has a shebang so no need to pass it to python3 in the tests.
+
+It also makes it easier for downstreams to wrap the python file for setting extra environment variables.
+
+[smcv: chmod the script +x]
+---
+ tests/test-document-fuse.py | 0
+ tests/test-document-fuse.sh | 4 ++--
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+ mode change 100644 => 100755 tests/test-document-fuse.py
+
+diff --git a/tests/test-document-fuse.py b/tests/test-document-fuse.py
+old mode 100644
+new mode 100755
+diff --git a/tests/test-document-fuse.sh b/tests/test-document-fuse.sh
+index cd51356..7868c91 100755
+--- a/tests/test-document-fuse.sh
++++ b/tests/test-document-fuse.sh
+@@ -72,14 +72,14 @@ fi
+ 
+ # First run a basic single-thread test
+ echo Testing single-threaded
+-python3 ${test_srcdir}/test-document-fuse.py --iterations 3 -v
++${test_srcdir}/test-document-fuse.py --iterations 3 -v
+ echo "ok single-threaded"
+ 
+ # Then a bunch of copies in parallel to stress-test
+ echo Testing in parallel
+ PIDS=()
+ for i in $(seq 20); do
+-    python3 ${test_srcdir}/test-document-fuse.py --iterations 10 --prefix $i &
++    ${test_srcdir}/test-document-fuse.py --iterations 10 --prefix $i &
+     PID="$!"
+     PIDS+=( "$PID" )
+ done
diff --git a/debian/patches/tests-use-kill-from-PATH.patch b/debian/patches/tests-use-kill-from-PATH.patch
new file mode 100644
index 0000000..c8a6cec
--- /dev/null
+++ b/debian/patches/tests-use-kill-from-PATH.patch
@@ -0,0 +1,31 @@
+From: Jan Tojnar <jtojnar at gmail.com>
+Date: Sun, 21 Jun 2020 17:02:56 +0200
+Subject: tests: use kill from PATH
+
+It is not guaranteed that /bin/kill exists and we are already using the bash builtin elsewhere in the script.
+---
+ tests/test-document-fuse.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test-document-fuse.sh b/tests/test-document-fuse.sh
+index a571a16..cd51356 100755
+--- a/tests/test-document-fuse.sh
++++ b/tests/test-document-fuse.sh
+@@ -49,7 +49,7 @@ export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
+ cleanup () {
+     fusermount -u $XDG_RUNTIME_DIR/doc || :
+     sleep 0.1
+-    /bin/kill -9 $DBUS_SESSION_BUS_PID
++    kill -9 $DBUS_SESSION_BUS_PID
+     kill $(jobs -p) &> /dev/null || true
+     rm -rf $TEST_DATA_DIR
+ }
+@@ -62,7 +62,7 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \
+ export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)"
+ DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)"
+ 
+-if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
++if ! kill -0 "$DBUS_SESSION_BUS_PID"; then
+     assert_not_reached "Failed to start dbus-daemon"
+ fi
+ 
diff --git a/debian/rules b/debian/rules
index b24ed4f..49231d2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -32,6 +32,7 @@ override_dh_missing:
 
 override_dh_auto_test:
 ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
+	chmod +x tests/test-document-fuse.py
 	G_MESSAGES_DEBUG=all \
 	TEST_IN_CI=1 \
 	dh_auto_test --no-parallel



More information about the Neon-commits mailing list