summary refs log tree commit diff
path: root/nixos/tests/boot.nix
diff options
context:
space:
mode:
authorBob van der Linden <bobvanderlinden@gmail.com>2014-11-19 23:18:44 +0100
committerVladimír Čunát <vcunat@gmail.com>2015-03-24 22:09:07 +0100
commitc57a912016025f66d666f0da26bc998b49ae55a7 (patch)
treeb6ae5051493137fd826bcc71d4ecf30e72abac02 /nixos/tests/boot.nix
parent9ff9949896c7ff0307ea60dc8d25de340860bfc4 (diff)
downloadnixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar.gz
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar.bz2
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar.lz
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar.xz
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.tar.zst
nixpkgs-c57a912016025f66d666f0da26bc998b49ae55a7.zip
nixos: test: add tests for booting installation iso in various ways
Diffstat (limited to 'nixos/tests/boot.nix')
-rw-r--r--nixos/tests/boot.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix
new file mode 100644
index 00000000000..2fdbb0c00b8
--- /dev/null
+++ b/nixos/tests/boot.nix
@@ -0,0 +1,63 @@
+{ system ? builtins.currentSystem }:
+
+with import ../lib/testing.nix { inherit system; };
+with import ../lib/qemu-flags.nix;
+with pkgs.lib;
+
+let
+
+  iso =
+    (import ../lib/eval-config.nix {
+      inherit system;
+      modules =
+        [ ../modules/installer/cd-dvd/installation-cd-minimal.nix
+          ../modules/testing/test-instrumentation.nix
+          { key = "serial";
+            boot.loader.grub.timeout = mkOverride 0 0;
+
+            # The test cannot access the network, so any sources we
+            # need must be included in the ISO.
+            isoImage.storeContents =
+              [ pkgs.glibcLocales
+                pkgs.sudo
+                pkgs.docbook5
+                pkgs.docbook5_xsl
+                pkgs.grub
+                pkgs.perlPackages.XMLLibXML
+                pkgs.unionfs-fuse
+                pkgs.gummiboot
+              ];
+          }
+        ];
+    }).config.system.build.isoImage;
+
+  makeBootTest = name: machineConfig:
+    makeTest {
+      inherit iso;
+      name = "boot-" + name;
+      nodes = { };
+      testScript =
+        ''
+          my $machine = createMachine({ ${machineConfig}, qemuFlags => '-m 768' });
+          $machine->start;
+          $machine->waitForUnit("multi-user.target");
+          $machine->shutdown;
+        '';
+    };
+in {
+    bootBiosCdrom = makeBootTest "bios-cdrom" ''
+        cdrom => glob("${iso}/iso/*.iso")
+      '';
+    bootBiosUsb = makeBootTest "bios-usb" ''
+        usb => glob("${iso}/iso/*.iso")
+      '';
+    bootUefiCdrom = makeBootTest "uefi-cdrom" ''
+        cdrom => glob("${iso}/iso/*.iso"),
+        bios => '${pkgs.OVMF}/FV/OVMF.fd'
+      '';
+    bootUefiUsb = makeBootTest "uefi-usb" ''
+        usb => glob("${iso}/iso/*.iso"),
+        bios => '${pkgs.OVMF}/FV/OVMF.fd'
+      '';
+  }
+