mirror of
https://github.com/nix-community/disko.git
synced 2024-09-17 09:37:17 +03:00
tests: add testBoot parameter to disable boot tests
This commit is contained in:
parent
78d9448fcf
commit
c5973aed4e
@ -13,6 +13,7 @@
|
|||||||
, efi ? true
|
, efi ? true
|
||||||
, enableOCR ? false
|
, enableOCR ? false
|
||||||
, testMode ? "direct" # can be one of direct module cli
|
, testMode ? "direct" # can be one of direct module cli
|
||||||
|
, testBoot ? true # if we actually want to test booting or just create/mount
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
@ -141,26 +142,29 @@
|
|||||||
machine.succeed("${tsp-mount}") # verify that the command is idempotent
|
machine.succeed("${tsp-mount}") # verify that the command is idempotent
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# mount nix-store in /mnt
|
${lib.optionalString testBoot ''
|
||||||
machine.succeed("mkdir -p /mnt/nix/store")
|
# mount nix-store in /mnt
|
||||||
machine.succeed("mount --bind /nix/store /mnt/nix/store")
|
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"
|
# fix "this is not a NixOS installation"
|
||||||
machine.succeed("mkdir -p /mnt/etc")
|
machine.succeed("mkdir -p /mnt/etc")
|
||||||
machine.succeed("touch /mnt/etc/NIXOS")
|
machine.succeed("touch /mnt/etc/NIXOS")
|
||||||
|
|
||||||
machine.succeed("mkdir -p /mnt/nix/var/nix/profiles")
|
machine.succeed("mkdir -p /mnt/nix/var/nix/profiles")
|
||||||
machine.succeed("nix-env -p /mnt/nix/var/nix/profiles/system --set ${installedTopLevel}")
|
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("NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root /mnt -- ${installedTopLevel}/bin/switch-to-configuration boot")
|
||||||
machine.succeed("sync")
|
machine.succeed("sync")
|
||||||
machine.shutdown()
|
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}
|
${extraTestScript}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user