nixos/tests/installer: Allow pre-boot commands.
These commands will be executed directly after the machine is created, so it gives us the chance to for example type in passphrases using the virtual keyboard. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
5d2c6f0353
commit
3b396701fd
@ -109,7 +109,7 @@ let
|
|||||||
# a test script fragment `createPartitions', which must create
|
# a test script fragment `createPartitions', which must create
|
||||||
# partitions and filesystems.
|
# partitions and filesystems.
|
||||||
testScriptFun = { createPartitions, testChannel, grubVersion, grubDevice
|
testScriptFun = { createPartitions, testChannel, grubVersion, grubDevice
|
||||||
, grubIdentifier, extraConfig
|
, grubIdentifier, preBootCommands, extraConfig
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
# FIXME: OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
|
# FIXME: OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
|
||||||
@ -194,6 +194,9 @@ let
|
|||||||
# Now see if we can boot the installation.
|
# Now see if we can boot the installation.
|
||||||
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
||||||
|
|
||||||
|
# For example to enter LUKS passphrase
|
||||||
|
${preBootCommands}
|
||||||
|
|
||||||
# Did /boot get mounted?
|
# Did /boot get mounted?
|
||||||
$machine->waitForUnit("local-fs.target");
|
$machine->waitForUnit("local-fs.target");
|
||||||
|
|
||||||
@ -229,6 +232,7 @@ let
|
|||||||
|
|
||||||
# Check whether a writable store build works
|
# Check whether a writable store build works
|
||||||
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
||||||
|
${preBootCommands}
|
||||||
$machine->waitForUnit("multi-user.target");
|
$machine->waitForUnit("multi-user.target");
|
||||||
$machine->copyFileFromHost(
|
$machine->copyFileFromHost(
|
||||||
"${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier extraConfig; readOnly = false; forceGrubReinstallCount = 2; } }",
|
"${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier extraConfig; readOnly = false; forceGrubReinstallCount = 2; } }",
|
||||||
@ -239,22 +243,24 @@ let
|
|||||||
# And just to be sure, check that the machine still boots after
|
# And just to be sure, check that the machine still boots after
|
||||||
# "nixos-rebuild switch".
|
# "nixos-rebuild switch".
|
||||||
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
||||||
|
${preBootCommands}
|
||||||
$machine->waitForUnit("network.target");
|
$machine->waitForUnit("network.target");
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
makeInstallerTest = name:
|
makeInstallerTest = name:
|
||||||
{ createPartitions, testChannel ? false, grubVersion ? 2
|
{ createPartitions, preBootCommands ? "", extraConfig ? ""
|
||||||
, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", extraConfig ? ""
|
, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda"
|
||||||
|
, grubIdentifier ? "uuid"
|
||||||
}:
|
}:
|
||||||
makeTest {
|
makeTest {
|
||||||
inherit iso;
|
inherit iso;
|
||||||
name = "installer-" + name;
|
name = "installer-" + name;
|
||||||
nodes = if testChannel then { inherit webserver; } else { };
|
nodes = if testChannel then { inherit webserver; } else { };
|
||||||
testScript = testScriptFun {
|
testScript = testScriptFun {
|
||||||
inherit createPartitions testChannel grubVersion grubDevice
|
inherit createPartitions preBootCommands testChannel grubVersion
|
||||||
grubIdentifier extraConfig;
|
grubDevice grubIdentifier extraConfig;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user