[PATCH v3 7/9] tests/functional: exec_command_and_wait_for_pattern: add vm arg

Vladimir Sementsov-Ogievskiy posted 9 patches 5 months, 1 week ago
[PATCH v3 7/9] tests/functional: exec_command_and_wait_for_pattern: add vm arg
Posted by Vladimir Sementsov-Ogievskiy 5 months, 1 week ago
Allow to specify non default vm for the command.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/cmd.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
index dc5f422b77..28b36a3a54 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -172,7 +172,8 @@ def exec_command(test, command):
     _console_interaction(test, None, None, command + '\r')
 
 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.
@@ -184,9 +185,11 @@ def exec_command_and_wait_for_pattern(test, command,
     :param command: the command to send
     :param success_message: if this message appears, test succeeds
     :param failure_message: if this message appears, test fails
+    :param vm: the VM to use (defaults to test.vm if None)
     """
     assert success_message
-    _console_interaction(test, success_message, failure_message, command + '\r')
+    _console_interaction(test, success_message, failure_message, command + '\r',
+                         vm=vm)
 
 def get_qemu_img(test):
     test.log.debug('Looking for and selecting a qemu-img binary')
-- 
2.48.1


Re: [PATCH v3 7/9] tests/functional: exec_command_and_wait_for_pattern: add vm arg
Posted by Thomas Huth 5 months ago
On 05/09/2025 15.50, Vladimir Sementsov-Ogievskiy wrote:
> Allow to specify non default vm for the command.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/functional/qemu_test/cmd.py | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77..28b36a3a54 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -172,7 +172,8 @@ def exec_command(test, command):
>       _console_interaction(test, None, None, command + '\r')
>   
>   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.
> @@ -184,9 +185,11 @@ def exec_command_and_wait_for_pattern(test, command,
>       :param command: the command to send
>       :param success_message: if this message appears, test succeeds
>       :param failure_message: if this message appears, test fails
> +    :param vm: the VM to use (defaults to test.vm if None)
>       """
>       assert success_message
> -    _console_interaction(test, success_message, failure_message, command + '\r')
> +    _console_interaction(test, success_message, failure_message, command + '\r',
> +                         vm=vm)

  Hi,

FYI, there was another patch on the list that does something very similar, 
and I picked it for my pull request today (since it fixed some more spots):

  https://lore.kernel.org/qemu-devel/20250909135147.612345-20-thuth@redhat.com/

... so once that got merged, you can likely drop this patch from your series.

  Regards,
   Thomas


Re: [PATCH v3 7/9] tests/functional: exec_command_and_wait_for_pattern: add vm arg
Posted by Vladimir Sementsov-Ogievskiy 5 months ago
On 09.09.25 17:03, Thomas Huth wrote:
> On 05/09/2025 15.50, Vladimir Sementsov-Ogievskiy wrote:
>> Allow to specify non default vm for the command.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   tests/functional/qemu_test/cmd.py | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
>> index dc5f422b77..28b36a3a54 100644
>> --- a/tests/functional/qemu_test/cmd.py
>> +++ b/tests/functional/qemu_test/cmd.py
>> @@ -172,7 +172,8 @@ def exec_command(test, command):
>>       _console_interaction(test, None, None, command + '\r')
>>   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.
>> @@ -184,9 +185,11 @@ def exec_command_and_wait_for_pattern(test, command,
>>       :param command: the command to send
>>       :param success_message: if this message appears, test succeeds
>>       :param failure_message: if this message appears, test fails
>> +    :param vm: the VM to use (defaults to test.vm if None)
>>       """
>>       assert success_message
>> -    _console_interaction(test, success_message, failure_message, command + '\r')
>> +    _console_interaction(test, success_message, failure_message, command + '\r',
>> +                         vm=vm)
> 
>   Hi,
> 
> FYI, there was another patch on the list that does something very similar, and I picked it for my pull request today (since it fixed some more spots):
> 
>   https://lore.kernel.org/qemu-devel/20250909135147.612345-20-thuth@redhat.com/
> 
> ... so once that got merged, you can likely drop this patch from your series.
> 

Good, thanks!


-- 
Best regards,
Vladimir