summary refs log tree commit diff
path: root/nixos/tests/kexec.nix
blob: 010f3da49846a23bc99e84f8d64e8522b2acf3e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Test whether fast reboots via kexec work.

import ./make-test-python.nix ({ pkgs, lib, ...} : {
  name = "kexec";
  meta = with lib.maintainers; {
    maintainers = [ eelco ];
  };

  machine = { ... }:
    { virtualisation.vlans = [ ]; };

  testScript =
    ''
      machine.wait_for_unit("multi-user.target")
      machine.succeed('kexec --load /run/current-system/kernel --initrd /run/current-system/initrd --command-line "$(</proc/cmdline)"')
      machine.execute("systemctl kexec >&2 &", check_return=False)
      machine.connected = False
      machine.connect()
      machine.wait_for_unit("multi-user.target")
      machine.shutdown()
    '';
})