summary refs log tree commit diff
path: root/pkgs/stdenv/generic/check-meta.nix
diff options
context:
space:
mode:
authorLéo Gaspard <leo@gaspard.io>2018-11-11 20:30:07 +0900
committerLéo Gaspard <leo@gaspard.io>2018-11-11 23:11:46 +0900
commit83b27f60ceff23967e477c90bef8e78cc96d50a2 (patch)
tree201f8d83728afada8567c3d9e12d351ec3b2338b /pkgs/stdenv/generic/check-meta.nix
parent6c68fbd4e1f8beac39cb1f499ff90c78256262d6 (diff)
downloadnixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar.gz
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar.bz2
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar.lz
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar.xz
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.tar.zst
nixpkgs-83b27f60ceff23967e477c90bef8e78cc96d50a2.zip
tests: split into a separate `all-tests.nix` file
This will make the list much easier to re-use, eg. for `nixosTests`

The drawback is that this approaches makes the
```
nix-build release.nix -A tests.opensmtpd.x86_64-linux
```
command about twice as slow (3s to 6s): it now has to evaluate `nixpkgs`
once for each architecture, instead of just having the hardcoded list of
tests that allowed to say “ok just evaluate for x86_64-linux”.

On the other hand, complete evaluation of `release.nix` should be much
faster because we no longer import `nixpkgs` for each test: testing with
the following command went from 30s to 18s, and that's just for a few
tests.
```
time nix-instantiate --eval --strict nixos/release.nix -A tests.nat
```
I initially wanted to test on the whole `release.nix`, but there are too
many broken tests and it takes too long to eval them all, especially
compared to the fact that the current implementation breaks some setup.

Given developers can just `nix-build nixos/tests/my-test.nix`, it sounds
like an overall win.
Diffstat (limited to 'pkgs/stdenv/generic/check-meta.nix')
-rw-r--r--pkgs/stdenv/generic/check-meta.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 0e93df85547..359e499cc96 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -168,9 +168,11 @@ let
     # TODO: refactor once something like Profpatsch's types-simple will land
     tests = attrsOf (mkOptionType {
       name = "test";
-      check = x: isDerivation x &&
+      check = x: x == {} || ( # Accept {} for tests that are unsupported
+        isDerivation x &&
         x ? meta.timeout &&
-        x ? meta.needsVMSupport;
+        x ? meta.needsVMSupport
+      );
       merge = lib.options.mergeOneOption;
     });
     needsVMSupport = bool;