Author: eelco
Date: Wed Apr 11 09:42:53 2012
New Revision: 33745
URL: https://nixos.org/websvn/nix/?rev=33745&sc=1

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

Modified:
   nixos/trunk/tests/installer.nix

Modified: nixos/trunk/tests/installer.nix
==============================================================================
--- nixos/trunk/tests/installer.nix     Wed Apr 11 09:17:32 2012        (r33744)
+++ nixos/trunk/tests/installer.nix     Wed Apr 11 09:42:53 2012        (r33745)
@@ -22,6 +22,7 @@
               [ pkgs.glibcLocales
                 pkgs.sudo
                 pkgs.docbook5
+                pkgs.grub
               ];
           }
         ];
@@ -29,7 +30,7 @@
 
 
   # The configuration to install.
-  config = { fileSystems, testChannel }: pkgs.writeText "configuration.nix"
+  config = { fileSystems, testChannel, grubVersion }: pkgs.writeText 
"configuration.nix"
     ''
       { config, pkgs, modulesPath, ... }:
 
@@ -38,7 +39,10 @@
             "''${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.extraConfig = "serial; terminal_output.serial";
         boot.initrd.kernelModules = [ "ext3" "virtio_console" ];
@@ -89,7 +93,7 @@
   # a test script fragment `createPartitions', which must create
   # partitions and filesystems, and a configuration.nix fragment
   # `fileSystems'.
-  testScriptFun = { createPartitions, fileSystems, testChannel }:
+  testScriptFun = { createPartitions, fileSystems, testChannel, grubVersion }:
     ''
       createDisk("harddisk", 4 * 1024);
 
@@ -145,7 +149,7 @@
       print STDERR "Result of the hardware scan:\n$cfg\n";
 
       $machine->copyFileFromHost(
-          "${ config { inherit fileSystems testChannel; } }",
+          "${ config { inherit fileSystems testChannel grubVersion; } }",
           "/mnt/etc/nixos/configuration.nix");
 
       # Perform the installation.
@@ -185,11 +189,11 @@
     '';
 
 
-  makeTest = { createPartitions, fileSystems, testChannel ? false }:
+  makeTest = { createPartitions, fileSystems, testChannel ? false, grubVersion 
? 2 }:
     { inherit iso;
       nodes = if testChannel then { inherit webserver; } else { };
       testScript = testScriptFun {
-        inherit createPartitions fileSystems testChannel;
+        inherit createPartitions fileSystems testChannel grubVersion;
       };
     };
 
@@ -299,6 +303,25 @@
       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.
   rebuildCD =
     { inherit iso;
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to