From 7aa5c1fb37265970f1aa1ac1d7ba5feed5d34388 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 28 Jun 2023 10:46:12 -0700 Subject: [PATCH] Increase timout for prompt after SSH setup This failed in the last QEMU CI run. --- pycheribuild/boot_cheribsd/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pycheribuild/boot_cheribsd/__init__.py b/pycheribuild/boot_cheribsd/__init__.py index b21a29a72..39d070de1 100755 --- a/pycheribuild/boot_cheribsd/__init__.py +++ b/pycheribuild/boot_cheribsd/__init__.py @@ -227,8 +227,7 @@ def expect(self, patterns: PatternListType, timeout=-1, pretend_result=None, ign log_patterns=True, timeout_msg="timeout", **kwargs): assert isinstance(patterns, list), "expected list and not " + str(patterns) if log_patterns: - info("Expecting regex ", coloured(AnsiColour.cyan, str(patterns)), - f" with timeout {timeout}" if timeout > 0 else "") + info("Expecting regex ", coloured(AnsiColour.cyan, str(patterns))) return self._expect_and_handle_panic_impl(patterns, timeout_msg, ignore_timeout=ignore_timeout, timeout=timeout, expect_fn=super().expect, **kwargs) @@ -248,15 +247,15 @@ def expect_prompt(self, timeout=-1, timeout_msg="timeout waiting for prompt", ig time.sleep(0.05) # give QEMU a bit of time after printing the prompt (otherwise we might lose some input) return result - def _expect_and_handle_panic_impl(self, options: PatternListType, timeout_msg, *, ignore_timeout=True, expect_fn, - **kwargs): + def _expect_and_handle_panic_impl(self, options: PatternListType, timeout_msg, *, ignore_timeout=True, + expect_fn, timeout, **kwargs): assert PANIC not in options assert STOPPED not in options assert PANIC_KDB not in options assert PANIC_PAGE_FAULT not in options panic_regexes = [PANIC, STOPPED, PANIC_KDB, PANIC_PAGE_FAULT] try: - i = expect_fn(options + panic_regexes, **kwargs) + i = expect_fn(options + panic_regexes, timeout=timeout, **kwargs) if i > len(options): debug_kernel_panic(self) if INTERACT_ON_KERNEL_PANIC: @@ -265,6 +264,7 @@ def _expect_and_handle_panic_impl(self, options: PatternListType, timeout_msg, * failure("EXITING DUE TO KERNEL PANIC!", exit=self.EXIT_ON_KERNEL_PANIC) return i except pexpect.TIMEOUT as e: + info("Timeout reached after ", timeout if timeout > 0 else self.timeout, " seconds") if ignore_timeout: failure(timeout_msg, ": ", str(e), exit=False) else: @@ -658,7 +658,7 @@ def setup_ssh_for_root_login(qemu: QemuCheriBSDInstance): qemu.expect(["service: not found", "Starting sshd.", "Cannot 'restart' sshd."], timeout=240) except pexpect.TIMEOUT: failure("Timed out setting up SSH keys", exit=True) - qemu.expect_prompt(timeout=60) + qemu.expect_prompt(timeout=120) time.sleep(2) # sleep for two seconds to avoid a rejection success("===> SSH authorized_keys set up")