* Add a installer test that uses GRUB 1 (it currently fails).

svn path=/nixos/trunk/; revision=33745
This commit is contained in:
Eelco Dolstra 2012-04-11 09:42:53 +00:00
parent e567309d85
commit 375511eb33

View file

@ -22,6 +22,7 @@ let
[ pkgs.glibcLocales [ pkgs.glibcLocales
pkgs.sudo pkgs.sudo
pkgs.docbook5 pkgs.docbook5
pkgs.grub
]; ];
} }
]; ];
@ -29,7 +30,7 @@ let
# The configuration to install. # The configuration to install.
config = { fileSystems, testChannel }: pkgs.writeText "configuration.nix" config = { fileSystems, testChannel, grubVersion }: pkgs.writeText "configuration.nix"
'' ''
{ config, pkgs, modulesPath, ... }: { config, pkgs, modulesPath, ... }:
@ -38,7 +39,10 @@ let
"''${modulesPath}/testing/test-instrumentation.nix" "''${modulesPath}/testing/test-instrumentation.nix"
]; ];
boot.loader.grub.version = 2; boot.loader.grub.version = ${toString grubVersion};
${optionalString (grubVersion == 1) ''
boot.loader.grub.splashImage = null;
''}
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
boot.loader.grub.extraConfig = "serial; terminal_output.serial"; boot.loader.grub.extraConfig = "serial; terminal_output.serial";
boot.initrd.kernelModules = [ "ext3" "virtio_console" ]; boot.initrd.kernelModules = [ "ext3" "virtio_console" ];
@ -89,7 +93,7 @@ let
# a test script fragment `createPartitions', which must create # a test script fragment `createPartitions', which must create
# partitions and filesystems, and a configuration.nix fragment # partitions and filesystems, and a configuration.nix fragment
# `fileSystems'. # `fileSystems'.
testScriptFun = { createPartitions, fileSystems, testChannel }: testScriptFun = { createPartitions, fileSystems, testChannel, grubVersion }:
'' ''
createDisk("harddisk", 4 * 1024); createDisk("harddisk", 4 * 1024);
@ -145,7 +149,7 @@ let
print STDERR "Result of the hardware scan:\n$cfg\n"; print STDERR "Result of the hardware scan:\n$cfg\n";
$machine->copyFileFromHost( $machine->copyFileFromHost(
"${ config { inherit fileSystems testChannel; } }", "${ config { inherit fileSystems testChannel grubVersion; } }",
"/mnt/etc/nixos/configuration.nix"); "/mnt/etc/nixos/configuration.nix");
# Perform the installation. # Perform the installation.
@ -185,11 +189,11 @@ let
''; '';
makeTest = { createPartitions, fileSystems, testChannel ? false }: makeTest = { createPartitions, fileSystems, testChannel ? false, grubVersion ? 2 }:
{ inherit iso; { inherit iso;
nodes = if testChannel then { inherit webserver; } else { }; nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun { testScript = testScriptFun {
inherit createPartitions fileSystems testChannel; inherit createPartitions fileSystems testChannel grubVersion;
}; };
}; };
@ -299,6 +303,25 @@ in {
fileSystems = rootFS + bootFS; fileSystems = rootFS + bootFS;
}; };
# Test a basic install using GRUB 1.
grub1 = makeTest
{ createPartitions =
''
$machine->mustSucceed(
"parted /dev/vda mklabel msdos",
"parted /dev/vda -- mkpart primary linux-swap 1M 1024M",
"parted /dev/vda -- mkpart primary ext2 1024M -1s",
"udevadm settle",
"mkswap /dev/vda1 -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/vda2",
"mount LABEL=nixos /mnt",
);
'';
fileSystems = rootFS;
grubVersion = 1;
};
# Rebuild the CD configuration with a little modification. # Rebuild the CD configuration with a little modification.
rebuildCD = rebuildCD =
{ inherit iso; { inherit iso;