nixos: test: add tests for booting installation iso in various ways
This commit is contained in:
parent
9ff9949896
commit
c57a912016
@ -37,6 +37,10 @@ sub new {
|
||||
if defined $args->{hda};
|
||||
$startCommand .= "-cdrom $args->{cdrom} "
|
||||
if defined $args->{cdrom};
|
||||
$startCommand .= "-device piix3-usb-uhci -drive id=usbdisk,file=$args->{usb},if=none,readonly -device usb-storage,drive=usbdisk "
|
||||
if defined $args->{usb};
|
||||
$startCommand .= "-bios $args->{bios} "
|
||||
if defined $args->{bios};
|
||||
$startCommand .= $args->{qemuFlags} || "";
|
||||
} else {
|
||||
$startCommand = Cwd::abs_path $startCommand;
|
||||
|
@ -310,6 +310,10 @@ in rec {
|
||||
tests.udisks2 = callTest tests/udisks2.nix {};
|
||||
tests.virtualbox = callTest tests/virtualbox.nix {};
|
||||
tests.xfce = callTest tests/xfce.nix {};
|
||||
tests.bootBiosCdrom = forAllSystems (system: scrubDrv (import tests/boot.nix { inherit system; }).bootBiosCdrom);
|
||||
tests.bootBiosUsb = forAllSystems (system: scrubDrv (import tests/boot.nix { inherit system; }).bootBiosUsb);
|
||||
tests.bootUefiCdrom = forAllSystems (system: scrubDrv (import tests/boot.nix { inherit system; }).bootUefiCdrom);
|
||||
tests.bootUefiUsb = forAllSystems (system: scrubDrv (import tests/boot.nix { inherit system; }).bootUefiUsb);
|
||||
|
||||
|
||||
/* Build a bunch of typical closures so that Hydra can keep track of
|
||||
|
63
nixos/tests/boot.nix
Normal file
63
nixos/tests/boot.nix
Normal file
@ -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'
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user