summary refs log tree commit diff
path: root/nixos/lib/testing
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2023-10-25 13:44:37 +0200
committerRaito Bezarius <masterancpp@gmail.com>2023-10-29 12:45:00 +0100
commita0dc17bd572018e9a4c6f77e30583f5fc292c5d5 (patch)
tree61599ae3b85ca7c35c2ee0a14bbb0a2a1b3c1af9 /nixos/lib/testing
parentd4d7550108e4e3fe6f9303e2a57379fba10da77d (diff)
downloadnixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar.gz
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar.bz2
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar.lz
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar.xz
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.tar.zst
nixpkgs-a0dc17bd572018e9a4c6f77e30583f5fc292c5d5.zip
nixos/lib/testing/run: expose `rawTestDerivation`
For `testBuildFailure` and similar functions, we need a full blown derivation and not a lazy one.
This is an internal option for test framework developers.
Diffstat (limited to 'nixos/lib/testing')
-rw-r--r--nixos/lib/testing/run.nix36
1 files changed, 23 insertions, 13 deletions
diff --git a/nixos/lib/testing/run.nix b/nixos/lib/testing/run.nix
index 0cd07d8afd2..9440c1acdfd 100644
--- a/nixos/lib/testing/run.nix
+++ b/nixos/lib/testing/run.nix
@@ -16,6 +16,15 @@ in
       '';
     };
 
+    rawTestDerivation = mkOption {
+      type = types.package;
+      description = mdDoc ''
+        Unfiltered version of `test`, for troubleshooting the test framework and `testBuildFailure` in the test framework's test suite.
+        This is not intended for general use. Use `test` instead.
+      '';
+      internal = true;
+    };
+
     test = mkOption {
       type = types.package;
       # TODO: can the interactive driver be configured to access the network?
@@ -29,25 +38,26 @@ in
   };
 
   config = {
-    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}";
+    rawTestDerivation = hostPkgs.stdenv.mkDerivation {
+      name = "vm-test-run-${config.name}";
 
-        requiredSystemFeatures = [ "kvm" "nixos-test" ];
+      requiredSystemFeatures = [ "kvm" "nixos-test" ];
 
-        buildCommand = ''
-          mkdir -p $out
+      buildCommand = ''
+        mkdir -p $out
 
-          # effectively mute the XMLLogger
-          export LOGFILE=/dev/null
+        # effectively mute the XMLLogger
+        export LOGFILE=/dev/null
 
-          ${config.driver}/bin/nixos-test-driver -o $out
-        '';
+        ${config.driver}/bin/nixos-test-driver -o $out
+      '';
 
-        passthru = config.passthru;
+      passthru = config.passthru;
 
-        meta = config.meta;
-      };
+      meta = config.meta;
+    };
+    test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
+      derivation = config.rawTestDerivation;
       inherit (config) passthru meta;
     };