forked from mirrors/nixpkgs
kernel: Add tests to passthru.tests
This commit is contained in:
parent
2e2a36f082
commit
bd7fed9a2f
|
@ -194,6 +194,7 @@ in
|
|||
keepalived = handleTest ./keepalived.nix {};
|
||||
keepassxc = handleTest ./keepassxc.nix {};
|
||||
kerberos = handleTest ./kerberos/default.nix {};
|
||||
kernel-generic = handleTest ./kernel-generic.nix {};
|
||||
kernel-latest = handleTest ./kernel-latest.nix {};
|
||||
kernel-lts = handleTest ./kernel-lts.nix {};
|
||||
kernel-testing = handleTest ./kernel-testing.nix {};
|
||||
|
|
29
nixos/tests/kernel-generic.nix
Normal file
29
nixos/tests/kernel-generic.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, config ? { }
|
||||
, pkgs ? import ../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
makeKernelTest = version: linuxPackages: (import ./make-test-python.nix ({ pkgs, ... }: {
|
||||
name = "kernel-${version}";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ nequissimus ];
|
||||
};
|
||||
|
||||
machine = { ... }:
|
||||
{
|
||||
boot.kernelPackages = linuxPackages;
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
assert "Linux" in machine.succeed("uname -s")
|
||||
assert "${linuxPackages.kernel.version}" in machine.succeed("uname -a")
|
||||
'';
|
||||
}));
|
||||
in
|
||||
with pkgs; {
|
||||
linux_5_11 = makeKernelTest "5.11" linuxPackages_5_11;
|
||||
}
|
|
@ -55,7 +55,7 @@
|
|||
, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules
|
||||
, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
|
||||
, kernelArch ? stdenv.hostPlatform.linuxArch
|
||||
|
||||
, kernelTests ? []
|
||||
, ...
|
||||
}:
|
||||
|
||||
|
@ -182,6 +182,7 @@ let
|
|||
kernelOlder = lib.versionOlder version;
|
||||
kernelAtLeast = lib.versionAtLeast version;
|
||||
passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]);
|
||||
tests = kernelTests;
|
||||
};
|
||||
|
||||
in lib.extendDerivation true passthru kernel
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
|
||||
{ lib, buildPackages, fetchurl, perl, buildLinux, nixosTests, modDirVersionArg ? null, ... } @ args:
|
||||
|
||||
with lib;
|
||||
|
||||
|
@ -15,4 +15,6 @@ buildLinux (args // rec {
|
|||
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
|
||||
sha256 = "1fc3yl4srzla3cbihgnry0pqmgcc17zv0zlkk9zpx99371hpay0a";
|
||||
};
|
||||
|
||||
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_5_11 ];
|
||||
} // (args.argsOverride or {}))
|
||||
|
|
Loading…
Reference in a new issue