From 497cba6b81a5c278028fe4866c4a2b9737642d0e Mon Sep 17 00:00:00 2001 From: Phoebus Date: Sun, 27 Sep 2026 23:19:04 -0700 Subject: [PATCH] fix(vm): match zsh prompt in serial driver login --- installer/tests/vm/serial-driver.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/installer/tests/vm/serial-driver.py b/installer/tests/vm/serial-driver.py index 9357936..876c291 100644 --- a/installer/tests/vm/serial-driver.py +++ b/installer/tests/vm/serial-driver.py @@ -45,6 +45,12 @@ USER = os.environ.get("USERNAME", "phoebus") MEM = os.environ.get("VM_MEM", "8192") SMP = os.environ.get("VM_SMP", "8") +# Shell-prompt alternative for an installed Phoebus login. The default login +# shell is zsh with a powerline-style prompt ending in the `❯` glyph; color +# escapes sit between the glyph and the trailing space, so the bare glyph +# (not `❯ `) is matched. Bash/root prompts keep matching `[$#] `. +SHELL_PROMPT = r"[$#] |❯" + BLS_APPEND = ( "root=live:CDLABEL=gentoo-amd64-livegui rd.live.dir=/ " "rd.live.squashimg=image.squashfs cdroot console=ttyS0,115200" @@ -171,7 +177,7 @@ def _unlock_and_login(child, results, tag): timeout=30) if idx == 0: child.sendline(USER_PW) - if child.expect([r"[$#] $", r"Login incorrect", r"phoebus login:"], + if child.expect([SHELL_PROMPT, r"Login incorrect", r"phoebus login:"], timeout=60) == 0: logged_in = True break @@ -374,7 +380,7 @@ def do_boot(results, paths, disks): r"Login incorrect"], timeout=30) if idx == 0: child.sendline(USER_PW) - login_result = child.expect([r"[$#] $", r"Login incorrect", + login_result = child.expect([SHELL_PROMPT, r"Login incorrect", r"phoebus login:"], timeout=60) if login_result == 0: logged_in = True @@ -385,10 +391,10 @@ def do_boot(results, paths, disks): results.assert_true("detached-boot-login", logged_in, "could not log in") if os.environ.get("BOOT_AUTHENTICATE") == "1": child.sendline("sudo -v") - idx = child.expect([r"[Pp]assword(?: for [^:]+)?:", r"[$#] $"], timeout=30) + idx = child.expect([r"[Pp]assword(?: for [^:]+)?:", SHELL_PROMPT], timeout=30) if idx == 0: child.sendline(USER_PW) - child.expect(r"[$#] $", timeout=30) + child.expect(SHELL_PROMPT, timeout=30) child.sendline(checks) child.expect("===CHECKS-END===", timeout=int(os.environ.get("CHECKS_TIMEOUT", "180"))) serial = paths.serial_log.read_text(errors="replace")