From 973c2fcf3dd783b031db2b9488fc3b29028ed981 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 5 Dec 2019 23:53:46 +0100 Subject: [PATCH] nixosTests.installed-tests: allow passing extra makeTest args For example, extra meta tags. --- nixos/tests/installed-tests/default.nix | 65 +++++++++++++++---------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index f4780bdcfc97..9b11ce7a4fa9 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -29,36 +29,51 @@ let # Extra flags to pass to gnome-desktop-testing-runner. , testRunnerFlags ? "" - }: - makeTest rec { - name = tested.name; - meta = { - maintainers = tested.meta.maintainers; - }; + # 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; - machine = { ... }: { - imports = [ - testConfig - ] ++ optional withX11 ../common/x11.nix; + meta = { + maintainers = tested.meta.maintainers; + }; - environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; + machine = { ... }: { + imports = [ + testConfig + ] ++ optional withX11 ../common/x11.nix; - }; + environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; - testScript = - optionalString withX11 '' - machine.wait_for_x() - '' + - optionalString (preTestScript != "") '' - ${preTestScript} - '' + - '' - machine.succeed( - "gnome-desktop-testing-runner ${testRunnerFlags} -d '${tested.installedTests}/share'" - ) - ''; - }; + }; + + testScript = + optionalString withX11 '' + machine.wait_for_x() + '' + + optionalString (preTestScript != "") '' + ${preTestScript} + '' + + '' + machine.succeed( + "gnome-desktop-testing-runner ${testRunnerFlags} -d '${tested.installedTests}/share'" + ) + ''; + } + + (removeAttrs args [ + "tested" + "testConfig" + "preTestScript" + "withX11" + "testRunnerFlags" + ]) + ); in