1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 05:00:16 +00:00

Merge pull request #121518 from Atemu/automatic-kernelTests

kernel/generic: add kernelTests automatically
This commit is contained in:
Kevin Cox 2021-08-23 18:23:32 +00:00 committed by GitHub
commit c3df8057da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 35 additions and 35 deletions

View file

@ -6,10 +6,10 @@
with pkgs.lib;
let
makeKernelTest = version: linuxPackages: (import ./make-test-python.nix ({ pkgs, ... }: {
name = "kernel-${version}";
testsForLinuxPackages = linuxPackages: (import ./make-test-python.nix ({ pkgs, ... }: {
name = "kernel-${linuxPackages.kernel.version}";
meta = with pkgs.lib.maintainers; {
maintainers = [ nequissimus ];
maintainers = [ nequissimus atemu ];
};
machine = { ... }:
@ -23,20 +23,26 @@ let
assert "${linuxPackages.kernel.modDirVersion}" in machine.succeed("uname -a")
'';
}) args);
in
with pkgs; {
linux_4_4 = makeKernelTest "4.4" linuxPackages_4_4;
linux_4_9 = makeKernelTest "4.9" linuxPackages_4_9;
linux_4_14 = makeKernelTest "4.14" linuxPackages_4_14;
linux_4_19 = makeKernelTest "4.19" linuxPackages_4_19;
linux_5_4 = makeKernelTest "5.4" linuxPackages_5_4;
linux_5_10 = makeKernelTest "5.10" linuxPackages_5_10;
linux_5_13 = makeKernelTest "5.13" linuxPackages_5_13;
kernels = {
inherit (pkgs)
linuxPackages_4_4
linuxPackages_4_9
linuxPackages_4_14
linuxPackages_4_19
linuxPackages_5_4
linuxPackages_5_10
linuxPackages_5_13
linux_hardened_4_14 = makeKernelTest "4.14" linuxPackages_4_14_hardened;
linux_hardened_4_19 = makeKernelTest "4.19" linuxPackages_4_19_hardened;
linux_hardened_5_4 = makeKernelTest "5.4" linuxPackages_5_4_hardened;
linux_hardened_5_10 = makeKernelTest "5.10" linuxPackages_5_10_hardened;
linuxPackages_4_14_hardened
linuxPackages_4_19_hardened
linuxPackages_5_4_hardened
linuxPackages_5_10_hardened
linux_testing = makeKernelTest "testing" linuxPackages_testing;
linuxPackages_testing;
};
in mapAttrs (_: lP: testsForLinuxPackages lP) kernels // {
inherit testsForLinuxPackages;
testsForKernel = kernel: testsForLinuxPackages (pkgs.linuxPackagesFor kernel);
}

View file

@ -58,6 +58,7 @@
, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
, kernelArch ? stdenv.hostPlatform.linuxArch
, kernelTests ? []
, nixosTests
, ...
}:
@ -192,7 +193,16 @@ let
kernelOlder = lib.versionOlder version;
kernelAtLeast = lib.versionAtLeast version;
passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]);
tests = kernelTests;
tests = let
overridableKernel = finalKernel // {
override = args:
lib.warn (
"override is stubbed for NixOS kernel tests, not applying changes these arguments: "
+ toString (lib.attrNames (if lib.isAttrs args then args else args {}))
) overridableKernel;
};
in [ (nixosTests.kernel-generic.testsForKernel overridableKernel) ] ++ kernelTests;
};
in lib.extendDerivation true passthru kernel
finalKernel = lib.extendDerivation true passthru kernel;
in finalKernel

View file

@ -15,6 +15,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "0x554dck5f78ljknwahjvf49952s1w0zja3yh4vfz6lmf6hvzq5n";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_4_14 ];
} // (args.argsOverride or {}))

View file

@ -15,6 +15,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "1rcx99sz4fgr2d138i92dw2vfplnqgys58hxywgmjb56c83l3qy4";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_4_19 ];
} // (args.argsOverride or {}))

View file

@ -9,6 +9,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "12grr2vc2mcvy7k8w1apqs9mhfg0lvz6mrpksym234m4n5yy48ng";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_4_4 ];
} // (args.argsOverride or {}))

View file

@ -9,6 +9,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "0am9qg9j18j4fc5zi6bk1g0mi8dp31pl62wlihxhhkc5yspzrna3";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_4_9 ];
} // (args.argsOverride or {}))

View file

@ -15,6 +15,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "13gpamqj0shvad4nd9v11iv8qdfbjgb242nbvcim2z3c7xszfvv9";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_5_10 ];
} // (args.argsOverride or {}))

View file

@ -15,6 +15,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "0948w1zc2gqnl8x60chjqngfzdi0kcxm12i1nx3nx4ksiwj5vc98";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_5_13 ];
} // (args.argsOverride or { }))

View file

@ -15,6 +15,4 @@ buildLinux (args // rec {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "0l8l4cg04p5vx890jm45r35js1v0nljd0lp5qwkvlr45jql5fy4r";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_5_4 ];
} // (args.argsOverride or {}))

View file

@ -14,8 +14,6 @@ buildLinux (args // rec {
sha256 = "sha256-PunFd6tOsmrsPItp2QX4TEVxHnvvi1BMSwWio/DTlMU=";
};
kernelTests = args.kernelTests or [ nixosTests.kernel-generic.linux_testing ];
# Should the testing kernels ever be built on Hydra?
extraMeta.hydraPlatforms = [];