From 3d20a308afb1cde850f63feab990d7d5b4f8e296 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 1 Aug 2012 23:36:48 -0400 Subject: [PATCH] tests/minimal-kernel: Add CIFS timeout patch --- modules/testing/test-instrumentation.nix | 9 ++++++++- tests/minimal-kernel.nix | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index 830f1744fa0..b18e4263c2d 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -5,11 +5,18 @@ with pkgs.lib; +let + kernel = config.boot.kernelPackages.kernel; + + hasCIFSTimeout = if kernel ? features then kernel.features ? cifsTimeout + else (filter (p: p.name == "cifs-timeout") kernel.kernelPatches) != []; +in + { config = # Require a patch to the kernel to increase the 15s CIFS timeout. - mkAssert (config.boot.kernelPackages.kernel.features ? cifsTimeout) " + mkAssert hasCIFSTimeout " VM tests require that the kernel has the CIFS timeout patch. " { diff --git a/tests/minimal-kernel.nix b/tests/minimal-kernel.nix index 04fe17c261b..e27b39d1764 100644 --- a/tests/minimal-kernel.nix +++ b/tests/minimal-kernel.nix @@ -7,11 +7,14 @@ configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))); - kernel = pkgs.lib.overrideDerivation (pkgs.linuxManualConfig { + origKernel = pkgs.linuxManualConfig { inherit (pkgs.linux) src version; inherit configfile; allowImportFromDerivation = true; - }) (attrs: { + kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ]; + }; + + kernel = origKernel //(derivation (origKernel.drvAttrs // { configurePhase = '' runHook preConfigure mkdir ../build @@ -19,7 +22,7 @@ make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig runHook postConfigure ''; - }); + })); kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; in {