about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2024-01-28 20:36:51 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2024-01-31 09:52:20 +0100
commit37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb (patch)
tree0e2e48c4605af6f52edb2a1e0ff5809d81e32356 /nixos
parentcff853ca15c4bb2ff6d7c47ea601570553de5793 (diff)
downloadnixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar.gz
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar.bz2
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar.lz
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar.xz
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.tar.zst
nixlib-37ac24e2c7e991a8ff5759bc5ae0f6f1d218a0cb.zip
nixos/tests/kernel-rust: test against 6.7 and testing (6.8rc1)
In #283893 we realized that not only 6.7, but also testing is affected.
And with more stable kernels following, we'll probably want to test
against all of them whether Rust support is working fine. As long as
it's not the default at least, then we should probably move this to
`kernel-generic`.

Every kernel that's new enough to support `rust-out-of-tree-module` (and
`linux_testing`) is part of this text matrix.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix2
-rw-r--r--nixos/tests/kernel-rust.nix65
2 files changed, 40 insertions, 27 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 81bd36cf0e34..a8be55193824 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -451,7 +451,7 @@ in {
   kerberos = handleTest ./kerberos/default.nix {};
   kernel-generic = handleTest ./kernel-generic.nix {};
   kernel-latest-ath-user-regd = handleTest ./kernel-latest-ath-user-regd.nix {};
-  kernel-rust = runTestOn ["x86_64-linux"] ./kernel-rust.nix;
+  kernel-rust = handleTestOn ["x86_64-linux"] ./kernel-rust.nix {};
   keter = handleTest ./keter.nix {};
   kexec = handleTest ./kexec.nix {};
   keycloak = discoverTests (import ./keycloak.nix);
diff --git a/nixos/tests/kernel-rust.nix b/nixos/tests/kernel-rust.nix
index 80eb38693677..1f269173ec2e 100644
--- a/nixos/tests/kernel-rust.nix
+++ b/nixos/tests/kernel-rust.nix
@@ -1,30 +1,43 @@
-{ pkgs, ... }: {
-  name = "kernel-rust";
-  meta = with pkgs.lib.maintainers; {
-    maintainers = [ blitz ];
-  };
+{ system ? builtins.currentSystem
+, config ? { }
+, pkgs ? import ../.. { inherit system config; }
+}:
 
-  nodes.machine = { config, pkgs, ... }:
-    {
-      boot.kernelPackages = pkgs.linuxPackages_testing;
+let
+  inherit (pkgs.lib) const filterAttrs mapAttrs;
 
-      boot.extraModulePackages = [
-        config.boot.kernelPackages.rust-out-of-tree-module
-      ];
-
-      boot.kernelPatches = [
-        {
-          name = "Rust Support";
-          patch = null;
-          features = {
-            rust = true;
-          };
-        }
-      ];
+  kernelRustTest = kernelPackages: import ./make-test-python.nix ({ lib, ... }: {
+    name = "kernel-rust";
+    meta.maintainers = with lib.maintainers; [ blitz ma27 ];
+    nodes.machine = { config, ... }: {
+      boot = {
+        inherit kernelPackages;
+        extraModulePackages = [ config.boot.kernelPackages.rust-out-of-tree-module ];
+        kernelPatches = [
+          {
+            name = "Rust Support";
+            patch = null;
+            features = {
+              rust = true;
+            };
+          }
+        ];
+      };
     };
+    testScript = ''
+      machine.wait_for_unit("default.target")
+      machine.succeed("modprobe rust_out_of_tree")
+    '';
+  });
 
-  testScript = ''
-    machine.wait_for_unit("default.target")
-    machine.succeed("modprobe rust_out_of_tree")
-  '';
-}
+  kernels = {
+    inherit (pkgs.linuxKernel.packages) linux_testing;
+  }
+  // filterAttrs
+    (const (x: let
+      inherit (builtins.tryEval (
+        x.rust-out-of-tree-module or null != null
+      )) success value;
+    in success && value))
+    pkgs.linuxKernel.vanillaPackages;
+in mapAttrs (const kernelRustTest) kernels