xdg-desktop-portal: Fix installedTests (#344743)

This commit is contained in:
Artturin 2024-10-14 21:36:39 +03:00 committed by GitHub
commit 431d0a19ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 3 deletions

View File

@ -3,7 +3,20 @@
makeInstalledTest {
tested = pkgs.xdg-desktop-portal;
# Ton of breakage.
# https://github.com/flatpak/xdg-desktop-portal/pull/428
meta.broken = true;
# Red herring
# Failed to load RealtimeKit property: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.RealtimeKit1 was not provided by any .service files
# Maybe a red herring, enabling PipeWire doesn't fix the location test.
# Failed connect to PipeWire: Couldn't connect to PipeWire
testConfig = {
environment.variables = {
TEST_IN_CI = 1;
XDG_DATA_DIRS = "${pkgs.xdg-desktop-portal.installedTests}/share/installed-tests/xdg-desktop-portal/share";
};
# Broken, see comment in the package file.
#services.geoclue2 = {
# enable = true;
# enableDemoAgent = true;
#};
#location.provider = "geoclue2";
};
}

View File

@ -27,6 +27,7 @@
, runCommand
, wrapGAppsHook3
, xmlto
, bash
, enableGeoLocation ? true
, enableSystemd ? true
}:
@ -63,6 +64,10 @@ stdenv.mkDerivation (finalAttrs: {
# test tries to read /proc/cmdline, which is not intended to be accessible in the sandbox
./trash-test.patch
# Install files required to be in XDG_DATA_DIR of the installed tests
# Merged PR https://github.com/flatpak/xdg-desktop-portal/pull/1444
./installed-tests-share.patch
];
# until/unless bubblewrap ships a pkg-config file, meson has no way to find it when cross-compiling.
@ -102,6 +107,7 @@ stdenv.mkDerivation (finalAttrs: {
(python3.withPackages (pp: with pp; [
pygobject3
]))
bash
] ++ lib.optionals enableGeoLocation [
geoclue2
] ++ lib.optionals enableSystemd [
@ -142,6 +148,21 @@ stdenv.mkDerivation (finalAttrs: {
export TEST_IN_CI=1
'';
postFixup = let
documentFuse = "${placeholder "installedTests"}/libexec/installed-tests/xdg-desktop-portal/test-document-fuse.py";
testPortals = "${placeholder "installedTests"}/libexec/installed-tests/xdg-desktop-portal/test-portals";
in ''
if [ -x '${documentFuse}' ] ; then
wrapGApp '${documentFuse}'
wrapGApp '${testPortals}'
# (xdg-desktop-portal:995): xdg-desktop-portal-WARNING **: 21:21:55.673: Failed to get GeoClue client: Timeout was reached
# xdg-desktop-portal:ERROR:../tests/location.c:22:location_cb: 'res' should be TRUE
# https://github.com/flatpak/xdg-desktop-portal/blob/1d6dfb57067dec182b546dfb60c87aa3452c77ed/tests/location.c#L21
rm $installedTests/share/installed-tests/xdg-desktop-portal/test-portals-location.test
fi
'';
passthru = {
tests = {
installedTests = nixosTests.installed-tests.xdg-desktop-portal;

View File

@ -0,0 +1,9 @@
diff --git a/tests/share/applications/meson.build b/tests/share/applications/meson.build
index d56b633..3ad3371 100644
--- a/tests/share/applications/meson.build
+++ b/tests/share/applications/meson.build
@@ -1,2 +1,2 @@
-configure_file(input: 'furrfix.desktop', output: '@PLAINNAME@', copy: true)
-configure_file(input: 'mimeinfo.cache', output: '@PLAINNAME@', copy: true)
+configure_file(input: 'furrfix.desktop', output: '@PLAINNAME@', copy: true, install: enable_installed_tests, install_dir: installed_tests_data_dir / 'share' / 'applications')
+configure_file(input: 'mimeinfo.cache', output: '@PLAINNAME@', copy: true, install: enable_installed_tests, install_dir: installed_tests_data_dir / 'share' / 'applications')