From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: Willian Rampazzo <willianr@redhat.com>, qemu-devel@nongnu.org
Cc: "Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"John G Johnson" <john.g.johnson@oracle.com>,
"Jagannathan Raman" <jag.raman@oracle.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v2 1/2] avocado_qemu: add exec_command function
Date: Tue, 2 Mar 2021 12:38:03 -0300 [thread overview]
Message-ID: <73aeddc8-7b60-a935-b58d-faf5354247b1@redhat.com> (raw)
In-Reply-To: <20210225205907.223995-2-willianr@redhat.com>
Hi,
On 2/25/21 5:59 PM, Willian Rampazzo wrote:
> Sometimes a test needs to send a command to a console without waiting
> for a pattern as a result, or the command issued do not produce any kind
> of output, like, for example, a `mount` command.
>
> This introduces the `exec_command` function to the avocado_qemu,
> allowing the test to send a command to the console without the need to
> match a pattern produced as a result.
>
> Signed-off-by: Willian Rampazzo <willianr@redhat.com>
> ---
> tests/acceptance/avocado_qemu/__init__.py | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index df167b142c..6ea94cc721 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -93,7 +93,7 @@ def _console_interaction(test, success_message, failure_message,
> if not msg:
> continue
> console_logger.debug(msg)
> - if success_message in msg:
> + if success_message is None or success_message in msg:
> break
> if failure_message and failure_message in msg:
> console.close()
> @@ -139,6 +139,17 @@ def wait_for_console_pattern(test, success_message, failure_message=None,
> """
> _console_interaction(test, success_message, failure_message, None, vm=vm)
>
> +def exec_command(test, command):
> + """
> + Send a command to a console (appending CRLF characters), while logging
> + the content.
> +
> + :param test: an Avocado test containing a VM.
> + :type test: :class:`avocado_qemu.Test`
> + :param command: the command to send
It's missing the command type. With that:
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> + """
> + _console_interaction(test, None, None, command + '\r')
> +
> def exec_command_and_wait_for_pattern(test, command,
> success_message, failure_message=None):
> """
next prev parent reply other threads:[~2021-03-02 15:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 20:59 [PATCH v2 0/2] tests: Add functional test for out-of-process device emulation Willian Rampazzo
2021-02-25 20:59 ` [PATCH v2 1/2] avocado_qemu: add exec_command function Willian Rampazzo
2021-03-02 15:38 ` Wainer dos Santos Moschetta [this message]
2021-02-25 20:59 ` [PATCH v2 2/2] tests: Add functional test for out-of-process device emulation Willian Rampazzo
2021-03-02 17:14 ` Wainer dos Santos Moschetta
2021-02-25 23:07 ` [PATCH v2 0/2] " Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=73aeddc8-7b60-a935-b58d-faf5354247b1@redhat.com \
--to=wainersm@redhat.com \
--cc=crosa@redhat.com \
--cc=elena.ufimtseva@oracle.com \
--cc=jag.raman@oracle.com \
--cc=john.g.johnson@oracle.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=willianr@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).