aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/tests/installer.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/installer.nix')
-rw-r--r--nixpkgs/nixos/tests/installer.nix35
1 files changed, 24 insertions, 11 deletions
diff --git a/nixpkgs/nixos/tests/installer.nix b/nixpkgs/nixos/tests/installer.nix
index eef9abebf9f..d80cfb4bd83 100644
--- a/nixpkgs/nixos/tests/installer.nix
+++ b/nixpkgs/nixos/tests/installer.nix
@@ -64,7 +64,7 @@ let
# a test script fragment `createPartitions', which must create
# partitions and filesystems.
testScriptFun = { bootLoader, createPartitions, grubVersion, grubDevice, grubUseEfi
- , grubIdentifier, preBootCommands, extraConfig
+ , grubIdentifier, preBootCommands, postBootCommands, extraConfig
, testSpecialisationConfig
}:
let iface = if grubVersion == 1 then "ide" else "virtio";
@@ -74,7 +74,7 @@ let
throw "Non-EFI boot methods are only supported on i686 / x86_64"
else ''
def assemble_qemu_flags():
- flags = "-cpu host"
+ flags = "-cpu max"
${if system == "x86_64-linux"
then ''flags += " -m 768"''
else ''flags += " -m 512 -enable-kvm -machine virt,gic-version=host"''
@@ -216,6 +216,7 @@ let
machine = create_machine_named("boot-after-rebuild-switch")
${preBootCommands}
machine.wait_for_unit("network.target")
+ ${postBootCommands}
machine.shutdown()
# Tests for validating clone configuration entries in grub menu
@@ -238,6 +239,7 @@ let
with subtest("Set grub to boot the second configuration"):
machine.succeed("grub-reboot 1")
+ ${postBootCommands}
machine.shutdown()
# Reboot Machine
@@ -252,12 +254,13 @@ let
with subtest("We should find a file named /etc/gitconfig"):
machine.succeed("test -e /etc/gitconfig")
+ ${postBootCommands}
machine.shutdown()
'';
makeInstallerTest = name:
- { createPartitions, preBootCommands ? "", extraConfig ? ""
+ { createPartitions, preBootCommands ? "", postBootCommands ? "", extraConfig ? ""
, extraInstallerConfig ? {}
, bootLoader ? "grub" # either "grub" or "systemd-boot"
, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", grubUseEfi ? false
@@ -282,7 +285,7 @@ let
];
virtualisation.diskSize = 8 * 1024;
- virtualisation.memorySize = 1024;
+ virtualisation.memorySize = 1536;
# Use a small /dev/vdb as the root disk for the
# installer. This ensures the target disk (/dev/vda) is
@@ -335,7 +338,7 @@ let
};
testScript = testScriptFun {
- inherit bootLoader createPartitions preBootCommands
+ inherit bootLoader createPartitions preBootCommands postBootCommands
grubVersion grubDevice grubIdentifier grubUseEfi extraConfig
testSpecialisationConfig;
};
@@ -552,16 +555,26 @@ in {
+ " mkpart primary 2048M -1s" # PV2
+ " set 2 lvm on",
"udevadm settle",
+ "sleep 1",
"pvcreate /dev/vda1 /dev/vda2",
+ "sleep 1",
"vgcreate MyVolGroup /dev/vda1 /dev/vda2",
+ "sleep 1",
"lvcreate --size 1G --name swap MyVolGroup",
- "lvcreate --size 2G --name nixos MyVolGroup",
+ "sleep 1",
+ "lvcreate --size 3G --name nixos MyVolGroup",
+ "sleep 1",
"mkswap -f /dev/MyVolGroup/swap -L swap",
"swapon -L swap",
"mkfs.xfs -L nixos /dev/MyVolGroup/nixos",
"mount LABEL=nixos /mnt",
)
'';
+ postBootCommands = ''
+ assert "loaded active" in machine.succeed(
+ "systemctl list-units 'lvm2-pvscan@*' -ql --no-legend | tee /dev/stderr"
+ )
+ '';
};
# Boot off an encrypted root partition with the default LUKS header format
@@ -620,10 +633,10 @@ in {
+ " mklabel msdos"
+ " mkpart primary ext2 1M 100MB" # /boot
+ " mkpart extended 100M -1s"
- + " mkpart logical 102M 2102M" # md0 (root), first device
- + " mkpart logical 2103M 4103M" # md0 (root), second device
- + " mkpart logical 4104M 4360M" # md1 (swap), first device
- + " mkpart logical 4361M 4617M", # md1 (swap), second device
+ + " mkpart logical 102M 3102M" # md0 (root), first device
+ + " mkpart logical 3103M 6103M" # md0 (root), second device
+ + " mkpart logical 6104M 6360M" # md1 (swap), first device
+ + " mkpart logical 6361M 6617M", # md1 (swap), second device
"udevadm settle",
"ls -l /dev/vda* >&2",
"cat /proc/partitions >&2",
@@ -786,7 +799,7 @@ in {
"btrfs subvol create /mnt/badpath/boot",
"btrfs subvol create /mnt/nixos",
"btrfs subvol set-default "
- + "$(btrfs subvol list /mnt | grep 'nixos' | awk '{print \$2}') /mnt",
+ + "$(btrfs subvol list /mnt | grep 'nixos' | awk '{print $2}') /mnt",
"umount /mnt",
"mount -o defaults LABEL=root /mnt",
"mkdir -p /mnt/badpath/boot", # Help ensure the detection mechanism