Skip to content

Add installed tests #34987

@jtojnar

Description

@jtojnar

We want to test that packages work on NixOS but writing tests manually is a chore so not many applications are covered. Fortunately, many packages (especially from GNOME or Freedesktop) ship so called installed tests that already do what we want.

I already implemented them for gjs and fwupd and as you can see it is actually quite simple. We can even factor it out into something like:

import ./make-test.nix ({ pkgs, ... }:
  let
    makeInstalledTest = { tested, withX ? false }: {
      name = tested.name;

      meta = {
        maintainers = tested.meta.maintainers;
      };

      machine = { pkgs, ... }: {
        imports = stdenv.lib.optional withX ./common/x11.nix;
        environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
        environment.variables.XDG_DATA_DIRS = [ "${tested.installedTests}/share" ];
      };

      testScript = ''
        ${stdenv.lib.optional withX "$machine->waitForX;"}
        $machine->succeed("gnome-desktop-testing-runner");
      '';
    };
  in makeInstalledTest { tested = pkgs.gjs; withX = true; }
)

Here is incomplete list of software that provides installed tests:

  • clutter
  • cogl
  • colord
  • eog
  • evolution
  • evolution-data-server
  • folks
  • fwupd
  • flatpak
  • flatpak-builder (flatpak-builder: 1.0.6 -> 1.0.7 #62413)
  • gdk-pixbuf
  • geocode-glib
  • gjs
  • glib
  • glib-networking
  • glib-openssl
  • gnome-boxes
  • gnome-calculator
  • gnome-characters
  • gnome-credentials
  • gnome-desktop
  • gnome-ostree
  • gnome-photos
  • gnome-software
  • gnome-weather
  • gspell
  • gtk+
  • gtksourceview
  • gvfs
  • ibus-engines.hangul
  • json-glib
  • libgdata
  • libgrss
  • libgsystem
  • libmediaart
  • librsvg
  • libsoup
  • mutter
  • ostree
  • pango
  • tepl
  • tracker
  • tracker-miners
  • xdg-desktop-portal

Finally, we should connect the tests to their respective packages, for example using #27604

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md3.skill: good-first-bugThis seems like it's fixable by a non-expert5.scope: trackingLong-lived issue tracking long-term fixes or multiple sub-problems6.topic: GNOMEGNOME desktop environment and its underlying platform6.topic: freedesktopInteroperability and shared base technology for X, Wayland and others6.topic: testingTooling for automated testing of packages and modules9.needs: module (new)This needs a module to be created

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions