Add test to check that a machine with a minimal kernel but all of the requiredKernelConfig options set boots and shuts down

This commit is contained in:
Shea Levy 2012-08-01 22:32:16 -04:00
parent 2a983acaff
commit 9e300052bd
4 changed files with 41 additions and 0 deletions

View File

@ -195,16 +195,19 @@ let kernel = config.boot.kernelPackages.kernel; in
isYes = option: {
assertion = config: config.isYes option;
message = "CONFIG_${option} is not yes!";
configLine = "CONFIG_${option}=y";
};
isNo = option: {
assertion = config: config.isNo option;
message = "CONFIG_${option} is not no!";
configLine = "CONFIG_${option}=n";
};
isModule = option: {
assertion = config: config.isModule option;
message = "CONFIG_${option} is not built as a module!";
configLine = "CONFIG_${option}=m";
};
### Usually you will just want to use these two
@ -212,12 +215,14 @@ let kernel = config.boot.kernelPackages.kernel; in
isEnabled = option: {
assertion = config: config.isEnabled option;
message = "CONFIG_${option} is not enabled!";
configLine = "CONFIG_${option}=y";
};
# True if no or omitted
isDisabled = option: {
assertion = config: config.isDisabled option;
message = "CONFIG_${option} is not disabled!";
configLine = "CONFIG_${option}=n";
};
};

View File

@ -212,6 +212,7 @@ let
kde4 = t.kde4.test;
login = t.login.test;
misc = t.misc.test;
minimal_kernel = t.minimal_kernel.test;
mpich = t.mpich.test;
mysql = t.mysql.test;
mysql_replication = t.mysql_replication.test;

View File

@ -11,6 +11,7 @@ with import ../lib/testing.nix { inherit system; };
ipv6 = makeTest (import ./ipv6.nix);
kde4 = makeTest (import ./kde4.nix);
login = makeTest (import ./login.nix);
minimal_kernel = makeTest (import ./minimal-kernel.nix);
misc = makeTest (import ./misc.nix);
mpich = makeTest (import ./mpich.nix);
mysql = makeTest (import ./mysql.nix);

34
tests/minimal-kernel.nix Normal file
View File

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
machine = { config, pkgs, ... }:
let
configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n"
(map (builtins.getAttr "configLine") config.system.requiredKernelConfig)));
kernel = pkgs.lib.overrideDerivation (pkgs.linuxManualConfig {
inherit (pkgs.linux) src version;
inherit configfile;
allowImportFromDerivation = true;
}) (attrs: {
configurePhase = ''
runHook preConfigure
mkdir ../build
make $makeFlags "''${makeFlagsArray[@]}" mrproper
make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig
runHook postConfigure
'';
});
kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages;
in {
boot.kernelPackages = kernelPackages;
};
testScript =
''
startAll;
$machine->shutdown;
'';
}