summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-11-10 09:46:06 +0100
committerlassulus <lassulus@lassul.us>2022-11-10 09:46:06 +0100
commitc5973aed4ed82106b0b8fb06be2ec70e94ebd532 (patch)
tree55d4c22748327506e51a4d1efbde7626b037292d /tests
parent78d9448fcff61f666d2cdd03af9c8c80795f01f4 (diff)
tests: add testBoot parameter to disable boot tests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib.nix36
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/lib.nix b/tests/lib.nix
index b9e75dd..195abcc 100644
--- a/tests/lib.nix
+++ b/tests/lib.nix
@@ -13,6 +13,7 @@
, efi ? true
, enableOCR ? false
, testMode ? "direct" # can be one of direct module cli
+ , testBoot ? true # if we actually want to test booting or just create/mount
}:
let
lib = pkgs.lib;
@@ -141,26 +142,29 @@
machine.succeed("${tsp-mount}") # verify that the command is idempotent
''}
- # mount nix-store in /mnt
- machine.succeed("mkdir -p /mnt/nix/store")
- machine.succeed("mount --bind /nix/store /mnt/nix/store")
+ ${lib.optionalString testBoot ''
+ # mount nix-store in /mnt
+ machine.succeed("mkdir -p /mnt/nix/store")
+ machine.succeed("mount --bind /nix/store /mnt/nix/store")
- machine.succeed("nix-store --load-db < ${pkgs.closureInfo {rootPaths = [installedTopLevel];}}/registration")
+ machine.succeed("nix-store --load-db < ${pkgs.closureInfo {rootPaths = [installedTopLevel];}}/registration")
- # fix "this is not a NixOS installation"
- machine.succeed("mkdir -p /mnt/etc")
- machine.succeed("touch /mnt/etc/NIXOS")
+ # fix "this is not a NixOS installation"
+ machine.succeed("mkdir -p /mnt/etc")
+ machine.succeed("touch /mnt/etc/NIXOS")
- machine.succeed("mkdir -p /mnt/nix/var/nix/profiles")
- machine.succeed("nix-env -p /mnt/nix/var/nix/profiles/system --set ${installedTopLevel}")
- machine.succeed("NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root /mnt -- ${installedTopLevel}/bin/switch-to-configuration boot")
- machine.succeed("sync")
- machine.shutdown()
+ machine.succeed("mkdir -p /mnt/nix/var/nix/profiles")
+ machine.succeed("nix-env -p /mnt/nix/var/nix/profiles/system --set ${installedTopLevel}")
+ machine.succeed("NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root /mnt -- ${installedTopLevel}/bin/switch-to-configuration boot")
+ machine.succeed("sync")
+ machine.shutdown()
+
+ machine = create_test_machine(oldmachine=machine, args={ "name": "booted_machine" })
+ machine.start()
+ ${bootCommands}
+ machine.wait_for_unit("local-fs.target")
+ ''}
- machine = create_test_machine(oldmachine=machine, args={ "name": "booted_machine" })
- machine.start()
- ${bootCommands}
- machine.wait_for_unit("local-fs.target")
${extraTestScript}
'';
};