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:
parent
2a983acaff
commit
9e300052bd
@ -195,16 +195,19 @@ let kernel = config.boot.kernelPackages.kernel; in
|
|||||||
isYes = option: {
|
isYes = option: {
|
||||||
assertion = config: config.isYes option;
|
assertion = config: config.isYes option;
|
||||||
message = "CONFIG_${option} is not yes!";
|
message = "CONFIG_${option} is not yes!";
|
||||||
|
configLine = "CONFIG_${option}=y";
|
||||||
};
|
};
|
||||||
|
|
||||||
isNo = option: {
|
isNo = option: {
|
||||||
assertion = config: config.isNo option;
|
assertion = config: config.isNo option;
|
||||||
message = "CONFIG_${option} is not no!";
|
message = "CONFIG_${option} is not no!";
|
||||||
|
configLine = "CONFIG_${option}=n";
|
||||||
};
|
};
|
||||||
|
|
||||||
isModule = option: {
|
isModule = option: {
|
||||||
assertion = config: config.isModule option;
|
assertion = config: config.isModule option;
|
||||||
message = "CONFIG_${option} is not built as a module!";
|
message = "CONFIG_${option} is not built as a module!";
|
||||||
|
configLine = "CONFIG_${option}=m";
|
||||||
};
|
};
|
||||||
|
|
||||||
### Usually you will just want to use these two
|
### Usually you will just want to use these two
|
||||||
@ -212,12 +215,14 @@ let kernel = config.boot.kernelPackages.kernel; in
|
|||||||
isEnabled = option: {
|
isEnabled = option: {
|
||||||
assertion = config: config.isEnabled option;
|
assertion = config: config.isEnabled option;
|
||||||
message = "CONFIG_${option} is not enabled!";
|
message = "CONFIG_${option} is not enabled!";
|
||||||
|
configLine = "CONFIG_${option}=y";
|
||||||
};
|
};
|
||||||
|
|
||||||
# True if no or omitted
|
# True if no or omitted
|
||||||
isDisabled = option: {
|
isDisabled = option: {
|
||||||
assertion = config: config.isDisabled option;
|
assertion = config: config.isDisabled option;
|
||||||
message = "CONFIG_${option} is not disabled!";
|
message = "CONFIG_${option} is not disabled!";
|
||||||
|
configLine = "CONFIG_${option}=n";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -212,6 +212,7 @@ let
|
|||||||
kde4 = t.kde4.test;
|
kde4 = t.kde4.test;
|
||||||
login = t.login.test;
|
login = t.login.test;
|
||||||
misc = t.misc.test;
|
misc = t.misc.test;
|
||||||
|
minimal_kernel = t.minimal_kernel.test;
|
||||||
mpich = t.mpich.test;
|
mpich = t.mpich.test;
|
||||||
mysql = t.mysql.test;
|
mysql = t.mysql.test;
|
||||||
mysql_replication = t.mysql_replication.test;
|
mysql_replication = t.mysql_replication.test;
|
||||||
|
@ -11,6 +11,7 @@ with import ../lib/testing.nix { inherit system; };
|
|||||||
ipv6 = makeTest (import ./ipv6.nix);
|
ipv6 = makeTest (import ./ipv6.nix);
|
||||||
kde4 = makeTest (import ./kde4.nix);
|
kde4 = makeTest (import ./kde4.nix);
|
||||||
login = makeTest (import ./login.nix);
|
login = makeTest (import ./login.nix);
|
||||||
|
minimal_kernel = makeTest (import ./minimal-kernel.nix);
|
||||||
misc = makeTest (import ./misc.nix);
|
misc = makeTest (import ./misc.nix);
|
||||||
mpich = makeTest (import ./mpich.nix);
|
mpich = makeTest (import ./mpich.nix);
|
||||||
mysql = makeTest (import ./mysql.nix);
|
mysql = makeTest (import ./mysql.nix);
|
||||||
|
34
tests/minimal-kernel.nix
Normal file
34
tests/minimal-kernel.nix
Normal 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;
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user