3
0
Fork 0
forked from mirrors/nixpkgs

nixos/test/installer: add postBootCommands

This commit is contained in:
ajs124 2020-05-25 04:05:55 +02:00 committed by Florian Klink
parent e55ef86ebd
commit d056f6e86d

View file

@ -64,7 +64,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 = { bootLoader, createPartitions, grubVersion, grubDevice, grubUseEfi testScriptFun = { bootLoader, createPartitions, grubVersion, grubDevice, grubUseEfi
, grubIdentifier, preBootCommands, extraConfig , grubIdentifier, preBootCommands, postBootCommands, extraConfig
, testSpecialisationConfig , testSpecialisationConfig
}: }:
let iface = if grubVersion == 1 then "ide" else "virtio"; let iface = if grubVersion == 1 then "ide" else "virtio";
@ -216,6 +216,7 @@ let
machine = create_machine_named("boot-after-rebuild-switch") machine = create_machine_named("boot-after-rebuild-switch")
${preBootCommands} ${preBootCommands}
machine.wait_for_unit("network.target") machine.wait_for_unit("network.target")
${postBootCommands}
machine.shutdown() machine.shutdown()
# Tests for validating clone configuration entries in grub menu # Tests for validating clone configuration entries in grub menu
@ -238,6 +239,7 @@ let
with subtest("Set grub to boot the second configuration"): with subtest("Set grub to boot the second configuration"):
machine.succeed("grub-reboot 1") machine.succeed("grub-reboot 1")
${postBootCommands}
machine.shutdown() machine.shutdown()
# Reboot Machine # Reboot Machine
@ -252,12 +254,13 @@ let
with subtest("We should find a file named /etc/gitconfig"): with subtest("We should find a file named /etc/gitconfig"):
machine.succeed("test -e /etc/gitconfig") machine.succeed("test -e /etc/gitconfig")
${postBootCommands}
machine.shutdown() machine.shutdown()
''; '';
makeInstallerTest = name: makeInstallerTest = name:
{ createPartitions, preBootCommands ? "", extraConfig ? "" { createPartitions, preBootCommands ? "", postBootCommands ? "", extraConfig ? ""
, extraInstallerConfig ? {} , extraInstallerConfig ? {}
, bootLoader ? "grub" # either "grub" or "systemd-boot" , bootLoader ? "grub" # either "grub" or "systemd-boot"
, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", grubUseEfi ? false , grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", grubUseEfi ? false
@ -335,7 +338,7 @@ let
}; };
testScript = testScriptFun { testScript = testScriptFun {
inherit bootLoader createPartitions preBootCommands inherit bootLoader createPartitions preBootCommands postBootCommands
grubVersion grubDevice grubIdentifier grubUseEfi extraConfig grubVersion grubDevice grubIdentifier grubUseEfi extraConfig
testSpecialisationConfig; testSpecialisationConfig;
}; };