Skip to content

Commit

Permalink
Increase timout for prompt after SSH setup
Browse files Browse the repository at this point in the history
This failed in the last QEMU CI run.
  • Loading branch information
arichardson committed Jun 28, 2023
1 parent c11abba commit 7aa5c1f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pycheribuild/boot_cheribsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 7aa5c1f

Please sign in to comment.