Skip to content

Commit

Permalink
Ditch efi installer tests
Browse files Browse the repository at this point in the history
They've been broken forever due to weirdness in qemu tests, and they don't add much over installer tests
  • Loading branch information
shlevy committed Oct 7, 2014
1 parent c07579a commit 92837f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 49 deletions.
2 changes: 0 additions & 2 deletions nixos/release-combined.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ in rec {
(all nixos.iso_graphical)
(all nixos.ova)

#(all nixos.tests.efi-installer.simple)
#(all nixos.tests.containers)
(all nixos.tests.firefox)
(all nixos.tests.firewall)
(all nixos.tests.gnome3)
#(all nixos.tests.installer.efi)
(all nixos.tests.installer.grub1)
(all nixos.tests.installer.lvm)
(all nixos.tests.installer.separateBoot)
Expand Down
1 change: 0 additions & 1 deletion nixos/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ in rec {
tests.firefox = callTest tests/firefox.nix {};
tests.firewall = callTest tests/firewall.nix {};
tests.gnome3 = callTest tests/gnome3.nix {};
tests.installer.efi = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).efi.test);
tests.installer.grub1 = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).grub1.test);
tests.installer.lvm = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).lvm.test);
tests.installer.rebuildCD = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).rebuildCD.test);
Expand Down
62 changes: 16 additions & 46 deletions nixos/tests/installer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let


# The configuration to install.
makeConfig = { testChannel, useEFI, grubVersion, grubDevice, grubIdentifier
makeConfig = { testChannel, grubVersion, grubDevice, grubIdentifier
, readOnly ? true, forceGrubReinstallCount ? 0 }:
pkgs.writeText "configuration.nix" ''
{ config, pkgs, modulesPath, ... }:
Expand All @@ -46,18 +46,13 @@ let
<nixpkgs/nixos/modules/profiles/minimal.nix>
];
${if useEFI then ''
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.gummiboot.enable = true;
'' else ''
boot.loader.grub.version = ${toString grubVersion};
${optionalString (grubVersion == 1) ''
boot.loader.grub.splashImage = null;
''}
boot.loader.grub.device = "${grubDevice}";
boot.loader.grub.extraConfig = "serial; terminal_output.serial";
boot.loader.grub.fsIdentifier = "${grubIdentifier}";
boot.loader.grub.version = ${toString grubVersion};
${optionalString (grubVersion == 1) ''
boot.loader.grub.splashImage = null;
''}
boot.loader.grub.device = "${grubDevice}";
boot.loader.grub.extraConfig = "serial; terminal_output.serial";
boot.loader.grub.fsIdentifier = "${grubIdentifier}";
boot.loader.grub.configurationLimit = 100 + ${toString forceGrubReinstallCount};
Expand Down Expand Up @@ -100,16 +95,14 @@ let
# disk, and then reboot from the hard disk. It's parameterized with
# a test script fragment `createPartitions', which must create
# partitions and filesystems.
testScriptFun = { createPartitions, testChannel, useEFI, grubVersion, grubDevice, grubIdentifier }:
testScriptFun = { createPartitions, testChannel, grubVersion, grubDevice, grubIdentifier }:
let
# FIXME: OVMF doesn't boot from virtio http://www.mail-archive.com/[email protected]/msg01501.html
iface = if useEFI || grubVersion == 1 then "scsi" else "virtio";
iface = if grubVersion == 1 then "scsi" else "virtio";
qemuFlags =
(if iso.system == "x86_64-linux" then "-m 768 " else "-m 512 ") +
(optionalString (iso.system == "x86_64-linux") "-cpu kvm64 ") +
(optionalString useEFI ''-L ${efiBios} -hda ''${\(Cwd::abs_path('harddisk'))} '');
hdFlags = optionalString (!useEFI)
''hda => "harddisk", hdaInterface => "${iface}", '';
hdFlags =''hda => "harddisk", hdaInterface => "${iface}", '';
in
''
createDisk("harddisk", 4 * 1024);
Expand Down Expand Up @@ -168,7 +161,7 @@ let
$machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
$machine->copyFileFromHost(
"${ makeConfig { inherit testChannel useEFI grubVersion grubDevice grubIdentifier; } }",
"${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; } }",
"/mnt/etc/nixos/configuration.nix");
# Perform the installation.
Expand All @@ -189,11 +182,7 @@ let
# Did /boot get mounted?
$machine->waitForUnit("local-fs.target");
${if useEFI then ''
$machine->succeed("test -e /boot/efi");
'' else ''
$machine->succeed("test -e /boot/grub");
''}
$machine->succeed("test -e /boot/grub");
# Did the swap device get activated?
$machine->waitForUnit("swap.target");
Expand All @@ -206,7 +195,7 @@ let
# We need to a writable nix-store on next boot
$machine->copyFileFromHost(
"${ makeConfig { inherit testChannel useEFI grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 1; } }",
"${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 1; } }",
"/etc/nixos/configuration.nix");
# Check whether nixos-rebuild works.
Expand All @@ -223,7 +212,7 @@ let
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
$machine->waitForUnit("multi-user.target");
$machine->copyFileFromHost(
"${ makeConfig { inherit testChannel useEFI grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 2; } }",
"${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 2; } }",
"/etc/nixos/configuration.nix");
$machine->succeed("nixos-rebuild boot >&2");
$machine->shutdown;
Expand All @@ -237,13 +226,13 @@ let


makeInstallerTest = name:
{ createPartitions, testChannel ? false, useEFI ? false, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid" }:
{ createPartitions, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid" }:
makeTest {
inherit iso;
name = "installer-" + name;
nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun {
inherit createPartitions testChannel useEFI grubVersion grubDevice grubIdentifier;
inherit createPartitions testChannel grubVersion grubDevice grubIdentifier;
};
};

Expand Down Expand Up @@ -369,25 +358,6 @@ in {
grubDevice = "/dev/sda";
};

# Test an EFI install.
efi = makeInstallerTest "efi"
{ createPartitions =
''
$machine->succeed(
"sgdisk -Z /dev/sda",
"sgdisk -n 1:0:+256M -n 2:0:+1024M -N 3 -t 1:ef00 -t 2:8200 -t 3:8300 -c 1:boot -c 2:swap -c 3:root /dev/sda",
"mkfs.vfat -n BOOT /dev/sda1",
"mkswap /dev/sda2 -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/sda3",
"mount LABEL=nixos /mnt",
"mkdir /mnt/boot",
"mount LABEL=BOOT /mnt/boot",
);
'';
useEFI = true;
};

# Rebuild the CD configuration with a little modification.
rebuildCD = makeTest
{ inherit iso;
Expand Down

0 comments on commit 92837f2

Please sign in to comment.