[PATCH v4 02/14] tests/avocado: Specify target VM argument to helper routines

Jagannathan Raman posted 14 patches 4 years, 1 month ago
Maintainers: Wainer dos Santos Moschetta <wainersm@redhat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Beraldo Leal <bleal@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, John G Johnson <john.g.johnson@oracle.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Juan Quintela <quintela@redhat.com>, Elena Ufimtseva <elena.ufimtseva@oracle.com>, Cleber Rosa <crosa@redhat.com>, Jagannathan Raman <jag.raman@oracle.com>
There is a newer version of this series
[PATCH v4 02/14] tests/avocado: Specify target VM argument to helper routines
Posted by Jagannathan Raman 4 years, 1 month ago
Specify target VM for exec_command and
exec_command_and_wait_for_pattern routines

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
 tests/avocado/avocado_qemu/__init__.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 75063c0c30..26ac782f53 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -198,7 +198,7 @@ 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):
+def exec_command(test, command, vm=None):
     """
     Send a command to a console (appending CRLF characters), while logging
     the content.
@@ -208,10 +208,11 @@ def exec_command(test, command):
     :param command: the command to send
     :type command: str
     """
-    _console_interaction(test, None, None, command + '\r')
+    _console_interaction(test, None, None, command + '\r', vm=vm)
 
 def exec_command_and_wait_for_pattern(test, command,
-                                      success_message, failure_message=None):
+                                      success_message, failure_message=None,
+                                      vm=None):
     """
     Send a command to a console (appending CRLF characters), then wait
     for success_message to appear on the console, while logging the.
@@ -224,7 +225,8 @@ def exec_command_and_wait_for_pattern(test, command,
     :param success_message: if this message appears, test succeeds
     :param failure_message: if this message appears, test fails
     """
-    _console_interaction(test, success_message, failure_message, command + '\r')
+    _console_interaction(test, success_message, failure_message, command + '\r',
+                         vm=vm)
 
 class QemuBaseTest(avocado.Test):
     def _get_unique_tag_val(self, tag_name):
-- 
2.20.1


Re: [PATCH v4 02/14] tests/avocado: Specify target VM argument to helper routines
Posted by Philippe Mathieu-Daudé 4 years, 1 month ago
On 12/15/21 16:35, Jagannathan Raman wrote:
> Specify target VM for exec_command and
> exec_command_and_wait_for_pattern routines
> 
> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
> Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>  tests/avocado/avocado_qemu/__init__.py | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH v4 02/14] tests/avocado: Specify target VM argument to helper routines
Posted by Beraldo Leal 4 years, 1 month ago
On Wed, Dec 15, 2021 at 10:35:26AM -0500, Jagannathan Raman wrote:
> Specify target VM for exec_command and
> exec_command_and_wait_for_pattern routines
> 
> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
> Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>  tests/avocado/avocado_qemu/__init__.py | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
> index 75063c0c30..26ac782f53 100644
> --- a/tests/avocado/avocado_qemu/__init__.py
> +++ b/tests/avocado/avocado_qemu/__init__.py
> @@ -198,7 +198,7 @@ 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):
> +def exec_command(test, command, vm=None):

nitpick: if possible, it would be nice to update the docstring, by
adding this new argument.

>      """
>      Send a command to a console (appending CRLF characters), while logging
>      the content.
> @@ -208,10 +208,11 @@ def exec_command(test, command):
>      :param command: the command to send
>      :type command: str
>      """
> -    _console_interaction(test, None, None, command + '\r')
> +    _console_interaction(test, None, None, command + '\r', vm=vm)
>  
>  def exec_command_and_wait_for_pattern(test, command,
> -                                      success_message, failure_message=None):
> +                                      success_message, failure_message=None,
> +                                      vm=None):

Same here.

Other than that, lgtm.

Reviewed-by: Beraldo Leal <bleal@redhat.com>

--
Beraldo


Re: [PATCH v4 02/14] tests/avocado: Specify target VM argument to helper routines
Posted by Jag Raman 4 years, 1 month ago

> On Dec 15, 2021, at 5:04 PM, Beraldo Leal <bleal@redhat.com> wrote:
> 
> On Wed, Dec 15, 2021 at 10:35:26AM -0500, Jagannathan Raman wrote:
>> Specify target VM for exec_command and
>> exec_command_and_wait_for_pattern routines
>> 
>> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
>> Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
>> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>> ---
>> tests/avocado/avocado_qemu/__init__.py | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>> 
>> diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
>> index 75063c0c30..26ac782f53 100644
>> --- a/tests/avocado/avocado_qemu/__init__.py
>> +++ b/tests/avocado/avocado_qemu/__init__.py
>> @@ -198,7 +198,7 @@ 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):
>> +def exec_command(test, command, vm=None):
> 
> nitpick: if possible, it would be nice to update the docstring, by
> adding this new argument.
> 
>>     """
>>     Send a command to a console (appending CRLF characters), while logging
>>     the content.
>> @@ -208,10 +208,11 @@ def exec_command(test, command):
>>     :param command: the command to send
>>     :type command: str
>>     """
>> -    _console_interaction(test, None, None, command + '\r')
>> +    _console_interaction(test, None, None, command + '\r', vm=vm)
>> 
>> def exec_command_and_wait_for_pattern(test, command,
>> -                                      success_message, failure_message=None):
>> +                                      success_message, failure_message=None,
>> +                                      vm=None):
> 
> Same here.

OK sure, will do. Thank you!
--
Jag

> 
> Other than that, lgtm.
> 
> Reviewed-by: Beraldo Leal <bleal@redhat.com>
> 
> --
> Beraldo
>