diff options
author | aszlig <aszlig@redmoonstudios.org> | 2015-05-21 12:40:07 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2015-05-21 13:21:41 +0200 |
commit | 3b396701fdc054795656562295d1092b72c192db (patch) | |
tree | e827e802d3be0c7b8cd7074e74d78e932d62a960 /nixos/tests | |
parent | 5d2c6f0353a2c85a755299c28d78cd2de493856f (diff) | |
download | nixlib-3b396701fdc054795656562295d1092b72c192db.tar nixlib-3b396701fdc054795656562295d1092b72c192db.tar.gz nixlib-3b396701fdc054795656562295d1092b72c192db.tar.bz2 nixlib-3b396701fdc054795656562295d1092b72c192db.tar.lz nixlib-3b396701fdc054795656562295d1092b72c192db.tar.xz nixlib-3b396701fdc054795656562295d1092b72c192db.tar.zst nixlib-3b396701fdc054795656562295d1092b72c192db.zip |
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>
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/installer.nix | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index db029a5cc845..8ef247d6c4df 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -109,7 +109,7 @@ let # a test script fragment `createPartitions', which must create # partitions and filesystems. testScriptFun = { createPartitions, testChannel, grubVersion, grubDevice - , grubIdentifier, extraConfig + , grubIdentifier, preBootCommands, extraConfig }: let # 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. $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" }); + # For example to enter LUKS passphrase + ${preBootCommands} + # Did /boot get mounted? $machine->waitForUnit("local-fs.target"); @@ -229,6 +232,7 @@ let # Check whether a writable store build works $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" }); + ${preBootCommands} $machine->waitForUnit("multi-user.target"); $machine->copyFileFromHost( "${ 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 # "nixos-rebuild switch". $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" }); + ${preBootCommands} $machine->waitForUnit("network.target"); $machine->shutdown; ''; makeInstallerTest = name: - { createPartitions, testChannel ? false, grubVersion ? 2 - , grubDevice ? "/dev/vda", grubIdentifier ? "uuid", extraConfig ? "" + { createPartitions, preBootCommands ? "", extraConfig ? "" + , testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda" + , grubIdentifier ? "uuid" }: makeTest { inherit iso; name = "installer-" + name; nodes = if testChannel then { inherit webserver; } else { }; testScript = testScriptFun { - inherit createPartitions testChannel grubVersion grubDevice - grubIdentifier extraConfig; + inherit createPartitions preBootCommands testChannel grubVersion + grubDevice grubIdentifier extraConfig; }; }; |