[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 5/7] avocado: Add an optional flag 'login' to ge
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [RFC PATCH 5/7] avocado: Add an optional flag 'login' to get_console() |
Date: |
Thu, 19 Apr 2018 13:46:40 -0300 |
Not all consoles require users to log in :/
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/avocado/avocado_qemu/test.py | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/tests/avocado/avocado_qemu/test.py
b/tests/avocado/avocado_qemu/test.py
index 1ead917014..ac8ee6d250 100644
--- a/tests/avocado/avocado_qemu/test.py
+++ b/tests/avocado/avocado_qemu/test.py
@@ -244,7 +244,7 @@ class _VM(qemu.QEMUMachine):
super(_VM, self).__init__(qemu_bin, name=self.name, arch=arch)
logging.getLogger('QMP').setLevel(logging.INFO)
- def get_console(self, console_address=None, prompt=r"[\#\$] "):
+ def get_console(self, console_address=None, prompt=r"[\#\$] ", login=True):
"""
:param address: Socket address, can be either a unix socket path
(string) or a tuple in the form (address, port)
@@ -252,9 +252,6 @@ class _VM(qemu.QEMUMachine):
:param prompt: The regex to identify we reached the prompt.
"""
- if not all((self.username, self.password)):
- raise QEMULoginError('Username or password not set.')
-
if not self.is_running():
raise QEMULoginError('VM is not running.')
@@ -272,13 +269,17 @@ class _VM(qemu.QEMUMachine):
nc_cmd += ' -U %s' % console_address
console = aexpect.ShellSession(nc_cmd)
- try:
- logging.info('Console: Waiting login prompt...')
- _handle_prompts(console, self.username, self.password, prompt)
- logging.info('Console: Ready!')
- except:
- console.close()
- raise
+ if login:
+ if not all((self.username, self.password)):
+ raise QEMULoginError('Username or password not set.')
+
+ try:
+ logging.info('Console: Waiting login prompt...')
+ _handle_prompts(console, self.username, self.password, prompt)
+ except:
+ console.close()
+ raise
+ logging.info('Console: Ready!')
return console
--
2.17.0
- [Qemu-devel] [RFC PATCH 0/7] avocado: Add acceptance tests parsing the Linux boot console, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 3/7] qemu.py: Check console arch is supported before calling mktemp(), Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 2/7] avocado: Update python scripts to upstream codebase, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 1/7] AVOCADO_QEMU: Snapshot commit, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 4/7] qemu.py: Avoid deprecated tempfile.mktemp(), Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 5/7] avocado: Add an optional flag 'login' to get_console(),
Philippe Mathieu-Daudé <=
- [Qemu-devel] [RFC PATCH 6/7] avocado: Add a test parsing Linux kernel booting console, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [RFC PATCH 7/7] avocado: Add tests booting the Malta machine, Philippe Mathieu-Daudé, 2018/04/19
- Re: [Qemu-devel] [RFC PATCH 0/7] avocado: Add acceptance tests parsing the Linux boot console, no-reply, 2018/04/19
- Re: [Qemu-devel] [RFC PATCH 0/7] avocado: Add acceptance tests parsing the Linux boot console, Philippe Mathieu-Daudé, 2018/04/20
- Re: [Qemu-devel] [RFC PATCH 0/7] avocado: Add acceptance tests parsing the Linux boot console, Cleber Rosa, 2018/04/30