1{ system
2, pkgs ? import ../.. { inherit system config; }
3 # Use a minimal kernel?
4, minimal ? false
5 # Ignored
6, config ? { }
7 # !!! See comment about args in lib/modules.nix
8, specialArgs ? { }
9 # Modules to add to each VM
10, extraConfigurations ? [ ]
11}:
12let
13 nixos-lib = import ./default.nix { inherit (pkgs) lib; };
14in
15
16rec {
17
18 inherit pkgs;
19
20 evalTest = module: nixos-lib.evalTest { imports = [ extraTestModule module ]; };
21 runTest = module: nixos-lib.runTest { imports = [ extraTestModule module ]; };
22
23 extraTestModule = {
24 config = {
25 hostPkgs = pkgs;
26 };
27 };
28
29 # Make a full-blown test (legacy)
30 # For an official public interface to the tests, see
31 # https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests
32 makeTest =
33 { machine ? null
34 , nodes ? {}
35 , testScript
36 , enableOCR ? false
37 , name ? "unnamed"
38 , skipTypeCheck ? false
39 # Skip linting (mainly intended for faster dev cycles)
40 , skipLint ? false
41 , passthru ? {}
42 , meta ? {}
43 , # For meta.position
44 pos ? # position used in error messages and for meta.position
45 (if meta.description or null != null
46 then builtins.unsafeGetAttrPos "description" meta
47 else builtins.unsafeGetAttrPos "testScript" t)
48 , extraPythonPackages ? (_ : [])
49 , interactive ? {}
50 } @ t: let
51 testConfig =
52 (evalTest {
53 imports = [
54 { _file = "makeTest parameters"; config = t; }
55 {
56 defaults = {
57 _file = "makeTest: extraConfigurations";
58 imports = extraConfigurations;
59 };
60 }
61 ];
62 }).config;
63 in
64 testConfig.test # For nix-build
65 // testConfig; # For all-tests.nix
66
67 simpleTest = as: (makeTest as).test;
68
69}