Merge pull request #120667 from samueldr/fix/grub1-test

nixosTests.installer: Fix grub1 test being unreliable
This commit is contained in:
Samuel Dionne-Riel 2021-04-27 19:32:13 -04:00 committed by GitHub
commit 1f4dedfa64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -294,7 +294,7 @@ let
# the same during and after installation. # the same during and after installation.
virtualisation.emptyDiskImages = [ 512 ]; virtualisation.emptyDiskImages = [ 512 ];
virtualisation.bootDevice = virtualisation.bootDevice =
if grubVersion == 1 then "/dev/sdb" else "/dev/vdb"; if grubVersion == 1 then "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive2" else "/dev/vdb";
virtualisation.qemu.diskInterface = virtualisation.qemu.diskInterface =
if grubVersion == 1 then "scsi" else "virtio"; if grubVersion == 1 then "scsi" else "virtio";
@ -695,22 +695,23 @@ in {
}; };
# Test a basic install using GRUB 1. # Test a basic install using GRUB 1.
grub1 = makeInstallerTest "grub1" { grub1 = makeInstallerTest "grub1" rec {
createPartitions = '' createPartitions = ''
machine.succeed( machine.succeed(
"flock /dev/sda parted --script /dev/sda -- mklabel msdos" "flock ${grubDevice} parted --script ${grubDevice} -- mklabel msdos"
+ " mkpart primary linux-swap 1M 1024M" + " mkpart primary linux-swap 1M 1024M"
+ " mkpart primary ext2 1024M -1s", + " mkpart primary ext2 1024M -1s",
"udevadm settle", "udevadm settle",
"mkswap /dev/sda1 -L swap", "mkswap ${grubDevice}-part1 -L swap",
"swapon -L swap", "swapon -L swap",
"mkfs.ext3 -L nixos /dev/sda2", "mkfs.ext3 -L nixos ${grubDevice}-part2",
"mount LABEL=nixos /mnt", "mount LABEL=nixos /mnt",
"mkdir -p /mnt/tmp", "mkdir -p /mnt/tmp",
) )
''; '';
grubVersion = 1; grubVersion = 1;
grubDevice = "/dev/sda"; # /dev/sda is not stable, even when the SCSI disk number is.
grubDevice = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive1";
}; };
# Test using labels to identify volumes in grub # Test using labels to identify volumes in grub