2014-11-19 22:18:44 +00:00
|
|
|
{ system ? builtins.currentSystem }:
|
|
|
|
|
|
|
|
with import ../lib/testing.nix { inherit system; };
|
|
|
|
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
|
|
|
|
];
|
|
|
|
}).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");
|
2018-02-07 15:50:47 +00:00
|
|
|
$machine->succeed("nix verify -r --no-trust /run/current-system");
|
2018-02-27 18:58:23 +00:00
|
|
|
|
|
|
|
# Test whether the channel got installed correctly.
|
|
|
|
$machine->succeed("nix-instantiate --dry-run '<nixpkgs>' -A hello");
|
|
|
|
$machine->succeed("nix-env --dry-run -iA nixos.procps");
|
|
|
|
|
2014-11-19 22:18:44 +00:00
|
|
|
$machine->shutdown;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in {
|
2016-05-25 08:21:14 +00:00
|
|
|
|
2016-03-01 18:02:36 +00:00
|
|
|
biosCdrom = makeBootTest "bios-cdrom" ''
|
2014-11-19 22:18:44 +00:00
|
|
|
cdrom => glob("${iso}/iso/*.iso")
|
|
|
|
'';
|
2016-05-25 08:21:14 +00:00
|
|
|
|
2016-03-01 18:02:36 +00:00
|
|
|
biosUsb = makeBootTest "bios-usb" ''
|
2014-11-19 22:18:44 +00:00
|
|
|
usb => glob("${iso}/iso/*.iso")
|
|
|
|
'';
|
2016-05-25 08:21:14 +00:00
|
|
|
|
2016-03-01 18:02:36 +00:00
|
|
|
uefiCdrom = makeBootTest "uefi-cdrom" ''
|
2014-11-19 22:18:44 +00:00
|
|
|
cdrom => glob("${iso}/iso/*.iso"),
|
2017-05-18 10:46:14 +00:00
|
|
|
bios => '${pkgs.OVMF.fd}/FV/OVMF.fd'
|
2014-11-19 22:18:44 +00:00
|
|
|
'';
|
2016-05-25 08:21:14 +00:00
|
|
|
|
2016-03-01 18:02:36 +00:00
|
|
|
uefiUsb = makeBootTest "uefi-usb" ''
|
2014-11-19 22:18:44 +00:00
|
|
|
usb => glob("${iso}/iso/*.iso"),
|
2017-05-18 10:46:14 +00:00
|
|
|
bios => '${pkgs.OVMF.fd}/FV/OVMF.fd'
|
2014-11-19 22:18:44 +00:00
|
|
|
'';
|
2016-05-25 08:21:14 +00:00
|
|
|
|
2016-04-08 13:53:27 +00:00
|
|
|
netboot = let
|
|
|
|
config = (import ../lib/eval-config.nix {
|
|
|
|
inherit system;
|
|
|
|
modules =
|
|
|
|
[ ../modules/installer/netboot/netboot.nix
|
|
|
|
../modules/testing/test-instrumentation.nix
|
|
|
|
{ key = "serial"; }
|
|
|
|
];
|
|
|
|
}).config;
|
|
|
|
ipxeScriptDir = pkgs.writeTextFile {
|
|
|
|
name = "ipxeScriptDir";
|
|
|
|
text = ''
|
|
|
|
#!ipxe
|
|
|
|
dhcp
|
|
|
|
kernel bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} console=ttyS0
|
|
|
|
initrd initrd
|
|
|
|
boot
|
|
|
|
'';
|
|
|
|
destination = "/boot.ipxe";
|
|
|
|
};
|
2016-05-03 20:05:11 +00:00
|
|
|
ipxeBootDir = pkgs.symlinkJoin {
|
|
|
|
name = "ipxeBootDir";
|
|
|
|
paths = [
|
|
|
|
config.system.build.netbootRamdisk
|
|
|
|
config.system.build.kernel
|
|
|
|
ipxeScriptDir
|
|
|
|
];
|
|
|
|
};
|
2016-04-08 13:53:27 +00:00
|
|
|
in
|
|
|
|
makeTest {
|
|
|
|
name = "boot-netboot";
|
|
|
|
nodes = { };
|
|
|
|
testScript =
|
|
|
|
''
|
|
|
|
my $machine = createMachine({ qemuFlags => '-boot order=n -net nic,model=e1000 -net user,tftp=${ipxeBootDir}/,bootfile=boot.ipxe -m 2000M' });
|
|
|
|
$machine->start;
|
|
|
|
$machine->waitForUnit("multi-user.target");
|
|
|
|
$machine->shutdown;
|
|
|
|
'';
|
|
|
|
};
|
2016-05-03 20:05:11 +00:00
|
|
|
}
|