Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add installed tests #34987

Open
14 of 44 tasks
jtojnar opened this issue Feb 14, 2018 · 9 comments
Open
14 of 44 tasks

Add installed tests #34987

jtojnar opened this issue Feb 14, 2018 · 9 comments
Labels
3.skill: good-first-bug This seems like it's fixable by a non-expert 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: freedesktop 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: testing Tooling for automated testing of packages and modules 9.needs: module (new) This needs a module to be created

Comments

@jtojnar
Copy link
Member

jtojnar commented Feb 14, 2018

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

@jtojnar jtojnar added 6.topic: GNOME GNOME desktop environment and its underlying platform 3.skill: good-first-bug This seems like it's fixable by a non-expert 9.needs: module (new) This needs a module to be created 6.topic: freedesktop labels Feb 14, 2018
@jtojnar jtojnar mentioned this issue Feb 22, 2018
8 tasks
@jtojnar jtojnar mentioned this issue Mar 18, 2019
10 tasks
@jtojnar jtojnar mentioned this issue Mar 26, 2019
10 tasks
@c0bw3b c0bw3b added the 6.topic: testing Tooling for automated testing of packages and modules label Apr 28, 2019
@jtojnar
Copy link
Member Author

jtojnar commented Oct 20, 2019

Ibus apparently has something based on gdtr fujiwarat/ibus-anthy@5a9e485, we should probably use that to prevent things like #68837 from reoccurring.

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@jtojnar
Copy link
Member Author

jtojnar commented Jun 1, 2020

This is a long term tracking goal.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 10, 2020
@stale
Copy link

stale bot commented Jun 7, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 7, 2021
@willbush
Copy link
Member

Hello! I'd like to start contributing to nixpkgs. I was thinking to try to improve testing to prevent regressions. Is this a good issue to start with?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 22, 2022
@jtojnar
Copy link
Member Author

jtojnar commented Jul 22, 2022

@willbush Hi. It will depend on your experience and vary from package to package. For libraries that are mostly self-contained, it may be as simple as adding the tested package and making sure the installed test files are installed by the package (usually there will be an configure option, though sometimes it is broken because upstreams do not regularly run installed tests). Sometimes there are paths that need to be patched or extra dependencies to be added, just like with any other Nix packaging. With extra dependencies, it might be nice to move the installed tests into a separate output.

Here are recent commits introducing installed tests to geocode-glib as another example: fb2877c 6a7da5b

json-glib, pango, libsoup, gtksourceview, evolution-data-server, evolution, tracker, gvfs, tracker-miners are the more consequential packages where tests might be useful (ordered roughly by the estimated complexity of getting the tests running, easiest first).

Feel free to ping me on Matrix or Discourse if you have more specific questions.

@willbush
Copy link
Member

@jtojnar Took a while to get over the learning curve, but I think json-glib PR is inline with how others were done.

I noticed that graphene and json-glib tests execute very fast. I was wondering why a VM has to be spun up for them? Is it because we don't know how they modify their environment?

@willbush
Copy link
Member

willbush commented Aug 1, 2022

@jtojnar I noticed that gtksourceview5 runs meson test in the checkPase. Would installed tests still be desired?

@jtojnar
Copy link
Member Author

jtojnar commented Aug 19, 2022

@willbush Sorry, this got lost in the noise.

I noticed that graphene and json-glib tests execute very fast. I was wondering why a VM has to be spun up for them? Is it because we don't know how they modify their environment?

I think for installed tests it is desirable to make them closer to a real runtime environment.

I noticed that gtksourceview5 runs meson test in the checkPase. Would installed tests still be desired?

Looks like the installed tests of gtksourceview5 run the same set of tests as the test suite so installing them is probably not necessary.

I would say that the installed tests mainly make sense for tests that require realistic runtime environment or ones that take long time. If the test suite is mostly self-contained, running it in the build is sufficient.

@samueldr samueldr added the 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems label Apr 23, 2024
@JohnRTitor JohnRTitor added this to GNOME Jun 20, 2024
@JohnRTitor JohnRTitor moved this to To Do in GNOME Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.skill: good-first-bug This seems like it's fixable by a non-expert 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: freedesktop 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: testing Tooling for automated testing of packages and modules 9.needs: module (new) This needs a module to be created
Projects
Status: To Do
Development

No branches or pull requests

4 participants