Unverified Commit 431d0a19 authored by Artturin's avatar Artturin Committed by GitHub
Browse files

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

parents e3278f80 f6d07247
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -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";
  };
}
+21 −0
Original line number Diff line number Diff line
@@ -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;
+9 −0
Original line number Diff line number Diff line
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')