From f6d0724717273a19e6a37bdc6d23cffa9280d747 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 26 Sep 2024 20:01:35 +0300 Subject: [PATCH] xdg-desktop-portal: Fix `installedTests` --- .../installed-tests/xdg-desktop-portal.nix | 19 ++++++++++++++--- .../libraries/xdg-desktop-portal/default.nix | 21 +++++++++++++++++++ .../installed-tests-share.patch | 9 ++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch diff --git a/nixos/tests/installed-tests/xdg-desktop-portal.nix b/nixos/tests/installed-tests/xdg-desktop-portal.nix index 90529d37ee0f..d40317faeb01 100644 --- a/nixos/tests/installed-tests/xdg-desktop-portal.nix +++ b/nixos/tests/installed-tests/xdg-desktop-portal.nix @@ -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"; + }; } diff --git a/pkgs/development/libraries/xdg-desktop-portal/default.nix b/pkgs/development/libraries/xdg-desktop-portal/default.nix index f1dea3ab641c..6275dafd6bcd 100644 --- a/pkgs/development/libraries/xdg-desktop-portal/default.nix +++ b/pkgs/development/libraries/xdg-desktop-portal/default.nix @@ -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; diff --git a/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch b/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch new file mode 100644 index 000000000000..ba9a3822e59e --- /dev/null +++ b/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch @@ -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')