nixos/tests/systemd-initrd-modprobe: Test parameter in stage 1

This commit is contained in:
Will Fancher 2023-09-20 06:26:03 -04:00
parent b41cbee0fd
commit e9e2240763

View file

@ -2,6 +2,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "systemd-initrd-modprobe"; name = "systemd-initrd-modprobe";
nodes.machine = { pkgs, ... }: { nodes.machine = { pkgs, ... }: {
testing.initrdBackdoor = true;
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = [ "loop" ]; # Load module in initrd. boot.initrd.kernelModules = [ "loop" ]; # Load module in initrd.
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
@ -10,6 +11,12 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
}; };
testScript = '' testScript = ''
machine.wait_for_unit("initrd.target")
max_loop = machine.succeed("cat /sys/module/loop/parameters/max_loop")
assert int(max_loop) == 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") machine.wait_for_unit("multi-user.target")
max_loop = machine.succeed("cat /sys/module/loop/parameters/max_loop") max_loop = machine.succeed("cat /sys/module/loop/parameters/max_loop")
assert int(max_loop) == 42, "Parameter should be respected for initrd kernel modules" assert int(max_loop) == 42, "Parameter should be respected for initrd kernel modules"