2019-11-06 00:56:21 +00:00
|
|
|
|
# NixOS tests for gnome-desktop-testing-runner using software
|
2024-05-01 12:54:54 +00:00
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/34987
|
2019-11-06 00:56:21 +00:00
|
|
|
|
|
|
|
|
|
{ system ? builtins.currentSystem,
|
|
|
|
|
config ? {},
|
|
|
|
|
pkgs ? import ../../.. { inherit system config; }
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
with import ../../lib/testing-python.nix { inherit system pkgs; };
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
callInstalledTest = pkgs.newScope { inherit makeInstalledTest; };
|
|
|
|
|
|
|
|
|
|
makeInstalledTest =
|
|
|
|
|
{ # Package to test. Needs to have an installedTests output
|
|
|
|
|
tested
|
|
|
|
|
|
|
|
|
|
# Config to inject into machine
|
|
|
|
|
, testConfig ? {}
|
|
|
|
|
|
|
|
|
|
# Test script snippet to inject before gnome-desktop-testing-runner begins.
|
|
|
|
|
# This is useful for extra setup the environment may need before the runner begins.
|
|
|
|
|
, preTestScript ? ""
|
|
|
|
|
|
|
|
|
|
# Does test need X11?
|
|
|
|
|
, withX11 ? false
|
|
|
|
|
|
|
|
|
|
# Extra flags to pass to gnome-desktop-testing-runner.
|
2022-10-03 13:56:51 +00:00
|
|
|
|
, testRunnerFlags ? []
|
2019-12-05 22:53:46 +00:00
|
|
|
|
|
|
|
|
|
# Extra attributes to pass to makeTest.
|
|
|
|
|
# They will be recursively merged into the attrset created by this function.
|
|
|
|
|
, ...
|
|
|
|
|
}@args:
|
|
|
|
|
makeTest
|
|
|
|
|
(recursiveUpdate
|
|
|
|
|
rec {
|
|
|
|
|
name = tested.name;
|
|
|
|
|
|
|
|
|
|
meta = {
|
2022-06-25 22:15:17 +00:00
|
|
|
|
maintainers = tested.meta.maintainers or [];
|
2019-12-05 22:53:46 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
|
nodes.machine = { ... }: {
|
2019-12-05 22:53:46 +00:00
|
|
|
|
imports = [
|
|
|
|
|
testConfig
|
|
|
|
|
] ++ optional withX11 ../common/x11.nix;
|
|
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
|
|
|
|
|
|
2020-07-24 13:17:42 +00:00
|
|
|
|
# The installed tests need to be added to the test VM’s closure.
|
|
|
|
|
# Otherwise, their dependencies might not actually be registered
|
|
|
|
|
# as valid paths in the VM’s Nix store database,
|
|
|
|
|
# and `nix-store --query` commands run as part of the tests
|
|
|
|
|
# (for example when building Flatpak runtimes) will fail.
|
|
|
|
|
environment.variables.TESTED_PACKAGE_INSTALLED_TESTS = "${tested.installedTests}/share";
|
2019-12-05 22:53:46 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
testScript =
|
|
|
|
|
optionalString withX11 ''
|
|
|
|
|
machine.wait_for_x()
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (preTestScript != "") ''
|
|
|
|
|
${preTestScript}
|
|
|
|
|
'' +
|
|
|
|
|
''
|
|
|
|
|
machine.succeed(
|
2022-10-03 13:56:51 +00:00
|
|
|
|
"gnome-desktop-testing-runner ${escapeShellArgs testRunnerFlags} -d '${tested.installedTests}/share'"
|
2019-12-05 22:53:46 +00:00
|
|
|
|
)
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(removeAttrs args [
|
|
|
|
|
"tested"
|
|
|
|
|
"testConfig"
|
|
|
|
|
"preTestScript"
|
|
|
|
|
"withX11"
|
|
|
|
|
"testRunnerFlags"
|
|
|
|
|
])
|
|
|
|
|
);
|
2019-11-06 00:56:21 +00:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
2022-02-25 11:26:15 +00:00
|
|
|
|
appstream = callInstalledTest ./appstream.nix {};
|
2022-02-25 12:09:27 +00:00
|
|
|
|
appstream-qt = callInstalledTest ./appstream-qt.nix {};
|
2019-11-06 00:56:21 +00:00
|
|
|
|
colord = callInstalledTest ./colord.nix {};
|
|
|
|
|
flatpak = callInstalledTest ./flatpak.nix {};
|
|
|
|
|
flatpak-builder = callInstalledTest ./flatpak-builder.nix {};
|
|
|
|
|
fwupd = callInstalledTest ./fwupd.nix {};
|
2019-11-07 12:59:11 +00:00
|
|
|
|
gcab = callInstalledTest ./gcab.nix {};
|
2019-11-06 00:56:21 +00:00
|
|
|
|
gdk-pixbuf = callInstalledTest ./gdk-pixbuf.nix {};
|
2022-07-01 22:24:22 +00:00
|
|
|
|
geocode-glib = callInstalledTest ./geocode-glib.nix {};
|
2019-11-06 00:56:21 +00:00
|
|
|
|
gjs = callInstalledTest ./gjs.nix {};
|
|
|
|
|
glib-networking = callInstalledTest ./glib-networking.nix {};
|
|
|
|
|
gnome-photos = callInstalledTest ./gnome-photos.nix {};
|
|
|
|
|
graphene = callInstalledTest ./graphene.nix {};
|
2020-10-13 20:57:48 +00:00
|
|
|
|
gsconnect = callInstalledTest ./gsconnect.nix {};
|
2022-08-20 06:45:18 +00:00
|
|
|
|
json-glib = callInstalledTest ./json-glib.nix {};
|
2019-11-07 14:05:42 +00:00
|
|
|
|
ibus = callInstalledTest ./ibus.nix {};
|
2019-11-07 13:07:51 +00:00
|
|
|
|
libgdata = callInstalledTest ./libgdata.nix {};
|
2020-02-08 03:36:49 +00:00
|
|
|
|
glib-testing = callInstalledTest ./glib-testing.nix {};
|
2020-03-30 05:37:07 +00:00
|
|
|
|
libjcat = callInstalledTest ./libjcat.nix {};
|
2019-11-07 13:02:33 +00:00
|
|
|
|
libxmlb = callInstalledTest ./libxmlb.nix {};
|
2020-02-08 05:16:13 +00:00
|
|
|
|
malcontent = callInstalledTest ./malcontent.nix {};
|
2019-11-06 00:56:21 +00:00
|
|
|
|
ostree = callInstalledTest ./ostree.nix {};
|
2020-08-05 18:48:37 +00:00
|
|
|
|
pipewire = callInstalledTest ./pipewire.nix {};
|
2023-07-13 07:01:02 +00:00
|
|
|
|
upower = callInstalledTest ./upower.nix {};
|
2019-11-06 00:56:21 +00:00
|
|
|
|
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {};
|
|
|
|
|
}
|