depot/nixos/tests/systemd-initrd-modprobe.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

24 lines
846 B
Nix

import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "systemd-initrd-modprobe";
nodes.machine = { pkgs, ... }: {
testing.initrdBackdoor = true;
boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = [ "tcp_hybla" ]; # Load module in initrd.
boot.extraModprobeConfig = ''
options tcp_hybla rtt0=42
'';
};
testScript = ''
machine.wait_for_unit("initrd.target")
rtt = machine.succeed("cat /sys/module/tcp_hybla/parameters/rtt0")
assert int(rtt) == 42, "Parameter should be respected for initrd kernel modules"
# Make sure it sticks in stage 2
machine.switch_root()
machine.wait_for_unit("multi-user.target")
rtt = machine.succeed("cat /sys/module/tcp_hybla/parameters/rtt0")
assert int(rtt) == 42, "Parameter should be respected for initrd kernel modules"
'';
})