···868868 # to match multiline regexes.
869869 console = io.StringIO()
870870871871- def console_matches() -> bool:
871871+ def console_matches(_: Any) -> bool:
872872 nonlocal console
873873 try:
874874 # This will return as soon as possible and
···884884 if timeout is not None:
885885 retry(console_matches, timeout)
886886 else:
887887- while not console_matches():
887887+ while not console_matches(False):
888888 pass
889889890890 def send_key(
+13-4
nixos/tests/systemd-initrd-vconsole.nix
···22 name = "systemd-initrd-vconsole";
3344 nodes.machine = { pkgs, ... }: {
55- boot.kernelParams = [ "rd.systemd.unit=rescue.target" ];
55+ boot.kernelParams = lib.mkAfter [ "rd.systemd.unit=rescue.target" "loglevel=3" "udev.log_level=3" "systemd.log_level=warning" ];
6677 boot.initrd.systemd = {
88 enable = true;
···2020 machine.start()
2121 machine.wait_for_console_text("Press Enter for maintenance")
2222 machine.send_console("\n")
2323- machine.wait_for_console_text("Logging in with home")
2323+2424+ # Wait for shell to become ready
2525+ for _ in range(300):
2626+ machine.send_console("printf '%s to receive commands:\\n' Ready\n")
2727+ try:
2828+ machine.wait_for_console_text("Ready to receive commands:", timeout=1)
2929+ break
3030+ except Exception:
3131+ continue
3232+ else:
3333+ raise RuntimeError("Rescue shell never became ready")
24342535 # Check keymap
2626- machine.send_console("(printf '%s to receive text: \\n' Ready && read text && echo \"$text\") </dev/tty1\n")
3636+ machine.send_console("(printf '%s to receive text:\\n' Ready && read text && echo \"$text\") </dev/tty1\n")
2737 machine.wait_for_console_text("Ready to receive text:")
2838 for key in "asdfjkl;\n":
2939 machine.send_key(key)
3040 machine.wait_for_console_text("arstneio")
3131- machine.send_console("systemctl poweroff\n")
3241 '';
3342})