2019-09-06 08:25:22 +01:00
|
|
|
{ system
|
|
|
|
, pkgs ? import ../.. { inherit system config; }
|
|
|
|
# Use a minimal kernel?
|
|
|
|
, minimal ? false
|
|
|
|
# Ignored
|
2020-10-23 22:13:38 +01:00
|
|
|
, config ? { }
|
2020-06-02 15:27:07 +01:00
|
|
|
# !!! See comment about args in lib/modules.nix
|
2020-10-23 22:13:38 +01:00
|
|
|
, specialArgs ? { }
|
2019-09-06 08:25:22 +01:00
|
|
|
# Modules to add to each VM
|
2020-10-23 22:13:38 +01:00
|
|
|
, extraConfigurations ? [ ]
|
|
|
|
}:
|
2019-09-06 08:25:22 +01:00
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
2022-06-15 15:59:21 +01:00
|
|
|
let
|
|
|
|
nixos-lib = import ./default.nix { inherit (pkgs) lib; };
|
|
|
|
in
|
|
|
|
|
2020-05-14 13:34:50 +01:00
|
|
|
rec {
|
2019-09-06 08:25:22 +01:00
|
|
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
2022-06-15 15:59:21 +01:00
|
|
|
evalTest = module: nixos-lib.evalTest { imports = [ extraTestModule module ]; };
|
|
|
|
runTest = module: nixos-lib.runTest { imports = [ extraTestModule module ]; };
|
|
|
|
|
|
|
|
extraTestModule = {
|
|
|
|
config = {
|
|
|
|
hostPkgs = pkgs;
|
|
|
|
};
|
|
|
|
};
|
2022-06-06 12:29:04 +01:00
|
|
|
|
2021-06-06 17:36:07 +01:00
|
|
|
# Make a full-blown test
|
2019-09-06 08:25:22 +01:00
|
|
|
makeTest =
|
2022-03-18 00:20:21 +00:00
|
|
|
{ machine ? null
|
|
|
|
, nodes ? {}
|
|
|
|
, testScript
|
2019-09-06 08:25:22 +01:00
|
|
|
, enableOCR ? false
|
|
|
|
, name ? "unnamed"
|
2022-06-03 12:37:04 +01:00
|
|
|
, skipTypeCheck ? false
|
2020-10-23 22:13:38 +01: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 10:08:13 +01:00
|
|
|
, extraPythonPackages ? (_ : [])
|
2022-06-27 12:05:59 +01:00
|
|
|
, interactive ? {}
|
2019-09-06 08:25:22 +01:00
|
|
|
} @ t:
|
2022-09-29 09:32:31 +01:00
|
|
|
(evalTest {
|
2022-06-21 23:41:12 +01:00
|
|
|
imports = [
|
|
|
|
{ _file = "makeTest parameters"; config = t; }
|
|
|
|
{
|
|
|
|
defaults = {
|
|
|
|
_file = "makeTest: extraConfigurations";
|
|
|
|
imports = extraConfigurations;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2022-09-29 09:32:31 +01:00
|
|
|
}).config;
|
2019-09-06 08:25:22 +01:00
|
|
|
|
|
|
|
simpleTest = as: (makeTest as).test;
|
|
|
|
|
|
|
|
}
|