3
0
Fork 0
forked from mirrors/nixpkgs

kernel: Add tests to passthru.tests

This commit is contained in:
Tim Steinbach 2021-04-07 11:57:58 -04:00 committed by Tim Steinbach
parent 2e2a36f082
commit bd7fed9a2f
4 changed files with 35 additions and 2 deletions

View file

@ -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 {};

View 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;
}

View file

@ -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

View file

@ -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 {}))