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