about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-06-25 12:47:50 +0200
committerRobert Hensing <robert@roberthensing.nl>2022-09-24 17:38:09 +0100
commit9886db059a822f9bc1f8fbdacfd1ca1938fe9ebf (patch)
tree5c9dbce218392cb1bad2f56424029761a9e2f66b /nixos/lib
parent5297d584bcc5f95c8e87c631813b4e2ab7f19ecc (diff)
nixos/testing: Embrace callTest
My conception of its input was wrong. It is quite a useful construct,
even if its name is a bit weird.
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/testing-python.nix1
-rw-r--r--nixos/lib/testing/run.nix20
2 files changed, 11 insertions, 10 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index cdaed5fa514ce..fd34fe23d7678 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -26,7 +26,6 @@ rec {
   extraTestModule = {
     config = {
       hostPkgs = pkgs;
-      minimalResult = hydra;
     };
   };
 
diff --git a/nixos/lib/testing/run.nix b/nixos/lib/testing/run.nix
index 65bcbe720bf30..cc31914f745d5 100644
--- a/nixos/lib/testing/run.nix
+++ b/nixos/lib/testing/run.nix
@@ -16,22 +16,22 @@ in
       '';
     };
 
-    run = mkOption {
+    test = mkOption {
       type = types.package;
       description = ''
-        Derivation that runs the test.
+        Derivation that runs the test as its "build" process.
       '';
     };
   };
 
   config = {
-    run = hostPkgs.stdenv.mkDerivation {
-      name = "vm-test-run-${config.name}";
+    test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
+      derivation = hostPkgs.stdenv.mkDerivation {
+        name = "vm-test-run-${config.name}";
 
-      requiredSystemFeatures = [ "kvm" "nixos-test" ];
+        requiredSystemFeatures = [ "kvm" "nixos-test" ];
 
-      buildCommand =
-        ''
+        buildCommand = ''
           mkdir -p $out
 
           # effectively mute the XMLLogger
@@ -40,9 +40,11 @@ in
           ${config.driver}/bin/nixos-test-driver -o $out
         '';
 
-      passthru = config.passthru;
+        passthru = config.passthru;
 
-      meta = config.meta;
+        meta = config.meta;
+      };
+      inherit (config) passthru meta;
     };
 
     # useful for inspection (debugging / exploration)