2019-11-05 19:56:21 -05:00
|
|
|
|
# NixOS tests for gnome-desktop-testing-runner using software
|
2024-05-01 20:54:54 +08:00
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/34987
|
2019-11-05 19:56:21 -05: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 16:56:51 +03:00
|
|
|
|
testRunnerFlags ? [ ],
|
2019-12-05 23:53:46 +01: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-26 00:15:17 +02:00
|
|
|
|
maintainers = tested.meta.maintainers or [ ];
|
2019-12-05 23:53:46 +01:00
|
|
|
|
};
|
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
|
nodes.machine =
|
|
|
|
|
{ ... }:
|
|
|
|
|
{
|
2019-12-05 23:53:46 +01:00
|
|
|
|
imports = [
|
|
|
|
|
testConfig
|
|
|
|
|
] ++ optional withX11 ../common/x11.nix;
|
|
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
|
|
|
|
|
|
2020-07-24 15:17:42 +02: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 23:53:46 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
testScript =
|
|
|
|
|
optionalString withX11 ''
|
|
|
|
|
machine.wait_for_x()
|
|
|
|
|
''
|
|
|
|
|
+ optionalString (preTestScript != "") ''
|
|
|
|
|
${preTestScript}
|
|
|
|
|
''
|
2024-12-10 20:26:33 +01:00
|
|
|
|
+ ''
|
2019-12-05 23:53:46 +01:00
|
|
|
|
machine.succeed(
|
2022-10-03 16:56:51 +03:00
|
|
|
|
"gnome-desktop-testing-runner ${escapeShellArgs testRunnerFlags} -d '${tested.installedTests}/share'"
|
2019-12-05 23:53:46 +01:00
|
|
|
|
)
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
removeAttrs args [
|
|
|
|
|
"tested"
|
|
|
|
|
"testConfig"
|
|
|
|
|
"preTestScript"
|
|
|
|
|
"withX11"
|
|
|
|
|
"testRunnerFlags"
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
);
|
2019-11-05 19:56:21 -05:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
2022-02-25 19:26:15 +08:00
|
|
|
|
appstream = callInstalledTest ./appstream.nix { };
|
2022-02-25 20:09:27 +08:00
|
|
|
|
appstream-qt = callInstalledTest ./appstream-qt.nix { };
|
2019-11-05 19:56:21 -05:00
|
|
|
|
colord = callInstalledTest ./colord.nix { };
|
|
|
|
|
flatpak = callInstalledTest ./flatpak.nix { };
|
|
|
|
|
flatpak-builder = callInstalledTest ./flatpak-builder.nix { };
|
|
|
|
|
fwupd = callInstalledTest ./fwupd.nix { };
|
2019-11-07 13:59:11 +01:00
|
|
|
|
gcab = callInstalledTest ./gcab.nix { };
|
2019-11-05 19:56:21 -05:00
|
|
|
|
gdk-pixbuf = callInstalledTest ./gdk-pixbuf.nix { };
|
2022-07-01 22:24:22 +00:00
|
|
|
|
geocode-glib = callInstalledTest ./geocode-glib.nix { };
|
2019-11-05 19:56:21 -05:00
|
|
|
|
gjs = callInstalledTest ./gjs.nix { };
|
|
|
|
|
glib-networking = callInstalledTest ./glib-networking.nix { };
|
|
|
|
|
gnome-photos = callInstalledTest ./gnome-photos.nix { };
|
|
|
|
|
graphene = callInstalledTest ./graphene.nix { };
|
2020-10-13 22:57:48 +02:00
|
|
|
|
gsconnect = callInstalledTest ./gsconnect.nix { };
|
2022-08-20 08:45:18 +02:00
|
|
|
|
json-glib = callInstalledTest ./json-glib.nix { };
|
2019-11-07 15:05:42 +01:00
|
|
|
|
ibus = callInstalledTest ./ibus.nix { };
|
2019-11-07 08:07:51 -05:00
|
|
|
|
libgdata = callInstalledTest ./libgdata.nix { };
|
2020-02-08 04:36:49 +01:00
|
|
|
|
glib-testing = callInstalledTest ./glib-testing.nix { };
|
2020-03-30 07:37:07 +02:00
|
|
|
|
libjcat = callInstalledTest ./libjcat.nix { };
|
2019-11-07 08:02:33 -05:00
|
|
|
|
libxmlb = callInstalledTest ./libxmlb.nix { };
|
2020-02-08 06:16:13 +01:00
|
|
|
|
malcontent = callInstalledTest ./malcontent.nix { };
|
2019-11-05 19:56:21 -05:00
|
|
|
|
ostree = callInstalledTest ./ostree.nix { };
|
2020-08-05 14:48:37 -04:00
|
|
|
|
pipewire = callInstalledTest ./pipewire.nix { };
|
2023-07-13 09:01:02 +02:00
|
|
|
|
upower = callInstalledTest ./upower.nix { };
|
2019-11-05 19:56:21 -05:00
|
|
|
|
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix { };
|
|
|
|
|
}
|