Skip to content

Commit b53b058

Browse files
committed
qemu: Move prompt handling out of standard_boot()
1 parent 301daf2 commit b53b058

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

lib/pexpect_utils.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77

88
class PexpectHelper:
9-
DEFAULT_PROMPT = "/ #"
10-
119
default_bug_patterns = [
1210
'Unable to handle kernel paging request',
1311
'Oops: Kernel access of bad area',
@@ -103,12 +101,7 @@ def cmd(self, cmd):
103101
self.expect_prompt()
104102

105103

106-
def standard_boot(p, login=False, user='root', password=None, timeout=-1, prompt=None):
107-
if prompt is None:
108-
prompt = p.DEFAULT_PROMPT
109-
110-
p.push_prompt(prompt)
111-
104+
def standard_boot(p, login=False, user='root', password=None, timeout=-1):
112105
logging.info("Waiting for kernel to boot")
113106
p.expect("Freeing unused kernel ", timeout=timeout)
114107

lib/qemu.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ def apply_defaults(self):
149149
self.cmdline += 'root=/dev/vda2 '
150150
self.prompt = 'root@debian:~#'
151151

152+
if self.prompt is None:
153+
# Default prompt for our root disks
154+
self.prompt = "/ #"
155+
152156
if self.initrd is None and self.drive is None and self.cloud_image is None:
153157
if self.compat_rootfs or self.qemu_path.endswith('qemu-system-ppc'):
154158
subarch = 'ppc'
@@ -368,7 +372,8 @@ def qemu_main(qconf):
368372
p = PexpectHelper()
369373
p.spawn(cmd, logfile=open(qconf.logpath, 'w'), timeout=pexpect_timeout, quiet=qconf.quiet)
370374

371-
standard_boot(p, qconf.login, qconf.user, qconf.password, boot_timeout, qconf.prompt)
375+
p.push_prompt(qconf.prompt)
376+
standard_boot(p, qconf.login, qconf.user, qconf.password, boot_timeout)
372377

373378
p.send('echo "booted-revision: `uname -r`"')
374379
p.expect(f'booted-revision: {qconf.expected_release}')

0 commit comments

Comments
 (0)