2019-09-06 09:25:22 +02:00
|
|
|
{ system
|
|
|
|
, pkgs ? import ../.. { inherit system config; }
|
|
|
|
# Use a minimal kernel?
|
|
|
|
, minimal ? false
|
|
|
|
# Ignored
|
2020-10-23 23:13:38 +02:00
|
|
|
, config ? { }
|
2020-06-02 16:27:07 +02:00
|
|
|
# !!! See comment about args in lib/modules.nix
|
2020-10-23 23:13:38 +02:00
|
|
|
, specialArgs ? { }
|
2019-09-06 09:25:22 +02:00
|
|
|
# Modules to add to each VM
|
2020-10-23 23:13:38 +02:00
|
|
|
, extraConfigurations ? [ ]
|
|
|
|
}:
|
2019-09-06 09:25:22 +02:00
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
2022-06-15 16:59:21 +02:00
|
|
|
let
|
|
|
|
nixos-lib = import ./default.nix { inherit (pkgs) lib; };
|
|
|
|
in
|
|
|
|
|
2020-05-14 14:34:50 +02:00
|
|
|
rec {
|
2019-09-06 09:25:22 +02:00
|
|
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
2022-06-15 16:59:21 +02:00
|
|
|
evalTest = module: nixos-lib.evalTest { imports = [ extraTestModule module ]; };
|
|
|
|
runTest = module: nixos-lib.runTest { imports = [ extraTestModule module ]; };
|
|
|
|
|
|
|
|
extraTestModule = {
|
|
|
|
config = {
|
|
|
|
hostPkgs = pkgs;
|
|
|
|
};
|
|
|
|
};
|
2022-06-06 13:29:04 +02:00
|
|
|
|
2021-06-06 18:36:07 +02:00
|
|
|
# Make a full-blown test
|
2019-09-06 09:25:22 +02:00
|
|
|
makeTest =
|
2022-03-18 01:20:21 +01:00
|
|
|
{ machine ? null
|
|
|
|
, nodes ? {}
|
|
|
|
, testScript
|
2019-09-06 09:25:22 +02:00
|
|
|
, enableOCR ? false
|
|
|
|
, name ? "unnamed"
|
2022-06-03 13:37:04 +02:00
|
|
|
, skipTypeCheck ? false
|
2020-10-23 23:13:38 +02:00
|
|
|
# Skip linting (mainly intended for faster dev cycles)
|
2019-12-22 14:50:08 +01:00
|
|
|
, skipLint ? false
|
2020-12-09 12:59:39 +01:00
|
|
|
, passthru ? {}
|
2022-03-18 01:20:21 +01:00
|
|
|
, meta ? {}
|
2021-02-09 12:02:35 +01:00
|
|
|
, # For meta.position
|
|
|
|
pos ? # position used in error messages and for meta.position
|
2022-03-18 01:20:21 +01:00
|
|
|
(if meta.description or null != null
|
|
|
|
then builtins.unsafeGetAttrPos "description" meta
|
2021-02-09 12:02:35 +01:00
|
|
|
else builtins.unsafeGetAttrPos "testScript" t)
|
2022-05-23 11:08:13 +02:00
|
|
|
, extraPythonPackages ? (_ : [])
|
2022-06-27 13:05:59 +02:00
|
|
|
, interactive ? {}
|
2019-09-06 09:25:22 +02:00
|
|
|
} @ t:
|
2022-06-22 00:41:12 +02:00
|
|
|
runTest {
|
|
|
|
imports = [
|
|
|
|
{ _file = "makeTest parameters"; config = t; }
|
|
|
|
{
|
|
|
|
defaults = {
|
|
|
|
_file = "makeTest: extraConfigurations";
|
|
|
|
imports = extraConfigurations;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2020-10-23 23:13:38 +02:00
|
|
|
};
|
2019-09-06 09:25:22 +02:00
|
|
|
|
|
|
|
simpleTest = as: (makeTest as).test;
|
|
|
|
|
|
|
|
}
|