diff options
Diffstat (limited to 'pkgs/test/kernel.nix')
-rw-r--r-- | pkgs/test/kernel.nix | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/pkgs/test/kernel.nix b/pkgs/test/kernel.nix index 2ccd188b1edb0..e345d9fa207e7 100644 --- a/pkgs/test/kernel.nix +++ b/pkgs/test/kernel.nix @@ -1,6 +1,3 @@ -# to run these tests: -# nix-instantiate --eval --strict . -A tests.kernel-config -# # make sure to use NON EXISTING kernel settings else they may conflict with # common-config.nix { lib, pkgs }: @@ -37,37 +34,40 @@ let { NIXOS_FAKE_USB_DEBUG = option yes;} ]; -in -runTests { - testEasy = { - expr = (getConfig { NIXOS_FAKE_USB_DEBUG = yes;}).NIXOS_FAKE_USB_DEBUG; - expected = { tristate = "y"; optional = false; freeform = null; }; - }; + failures = runTests { + testEasy = { + expr = (getConfig { NIXOS_FAKE_USB_DEBUG = yes;}).NIXOS_FAKE_USB_DEBUG; + expected = { tristate = "y"; optional = false; freeform = null; }; + }; - # mandatory flag should win over optional - testMandatoryCheck = { - expr = (getConfig mandatoryVsOptionalConfig).NIXOS_FAKE_USB_DEBUG.optional; - expected = false; - }; + # mandatory flag should win over optional + testMandatoryCheck = { + expr = (getConfig mandatoryVsOptionalConfig).NIXOS_FAKE_USB_DEBUG.optional; + expected = false; + }; - testYesWinsOverNo = { - expr = (getConfig mkDefaultWorksConfig)."NIXOS_TEST_BOOLEAN".tristate; - expected = "y"; - }; + testYesWinsOverNo = { + expr = (getConfig mkDefaultWorksConfig)."NIXOS_TEST_BOOLEAN".tristate; + expected = "y"; + }; - testAllOptionalRemainOptional = { - expr = (getConfig allOptionalRemainOptional)."NIXOS_FAKE_USB_DEBUG".optional; - expected = true; - }; + testAllOptionalRemainOptional = { + expr = (getConfig allOptionalRemainOptional)."NIXOS_FAKE_USB_DEBUG".optional; + expected = true; + }; + + # check that freeform options are unique + # Should trigger + # > The option `settings.NIXOS_FAKE_MMC_BLOCK_MINORS.freeform' has conflicting definitions, in `<unknown-file>' and `<unknown-file>' + testTreeform = let + res = builtins.tryEval ( (getConfig freeformConfig).NIXOS_FAKE_MMC_BLOCK_MINORS.freeform); + in { + expr = res.success; + expected = false; + }; - # check that freeform options are unique - # Should trigger - # > The option `settings.NIXOS_FAKE_MMC_BLOCK_MINORS.freeform' has conflicting definitions, in `<unknown-file>' and `<unknown-file>' - testTreeform = let - res = builtins.tryEval ( (getConfig freeformConfig).NIXOS_FAKE_MMC_BLOCK_MINORS.freeform); - in { - expr = res.success; - expected = false; }; +in -} +lib.optional (failures != []) + (throw "The following kernel unit tests failed: ${lib.generators.toPretty {} failures}") |