[PATCH v4 14/18] iotests.py: add qemu_io_pipe_and_status()

Vladimir Sementsov-Ogievskiy posted 18 patches 3 years, 11 months ago
Maintainers: Wen Congyang <wencongyang2@huawei.com>, Markus Armbruster <armbru@redhat.com>, John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Xie Changlong <xiechanglong.d@gmail.com>, Eric Blake <eblake@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Hanna Reitz <hreitz@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
[PATCH v4 14/18] iotests.py: add qemu_io_pipe_and_status()
Posted by Vladimir Sementsov-Ogievskiy 3 years, 11 months ago
Add helper that returns both status and output, to be used in the
following commit

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/iotests.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 6ba65eb1ff..23bc6f686f 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -278,6 +278,10 @@ def qemu_io(*args):
     '''Run qemu-io and return the stdout data'''
     return qemu_tool_pipe_and_status('qemu-io', qemu_io_wrap_args(args))[0]
 
+def qemu_io_pipe_and_status(*args):
+    args = qemu_io_args + list(args)
+    return qemu_tool_pipe_and_status('qemu-io', args)
+
 def qemu_io_log(*args):
     result = qemu_io(*args)
     log(result, filters=[filter_testfiles, filter_qemu_io])
-- 
2.31.1


Re: [PATCH v4 14/18] iotests.py: add qemu_io_pipe_and_status()
Posted by Hanna Reitz 3 years, 11 months ago
On 16.02.22 20:46, Vladimir Sementsov-Ogievskiy wrote:
> Add helper that returns both status and output, to be used in the
> following commit
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   tests/qemu-iotests/iotests.py | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 6ba65eb1ff..23bc6f686f 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -278,6 +278,10 @@ def qemu_io(*args):
>       '''Run qemu-io and return the stdout data'''
>       return qemu_tool_pipe_and_status('qemu-io', qemu_io_wrap_args(args))[0]
>   
> +def qemu_io_pipe_and_status(*args):
> +    args = qemu_io_args + list(args)
> +    return qemu_tool_pipe_and_status('qemu-io', args)

Shouldn’t we use qemu_io_wrap_args() here, like above?  The next patch 
adds a caller that passes `'-f', 'raw'` to it, which kind of implies to 
me that qemu_io_wrap_args() would be better.

> +
>   def qemu_io_log(*args):
>       result = qemu_io(*args)
>       log(result, filters=[filter_testfiles, filter_qemu_io])


Re: [PATCH v4 14/18] iotests.py: add qemu_io_pipe_and_status()
Posted by Vladimir Sementsov-Ogievskiy 3 years, 11 months ago
24.02.2022 15:52, Hanna Reitz wrote:
> On 16.02.22 20:46, Vladimir Sementsov-Ogievskiy wrote:
>> Add helper that returns both status and output, to be used in the
>> following commit
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   tests/qemu-iotests/iotests.py | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index 6ba65eb1ff..23bc6f686f 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
>> @@ -278,6 +278,10 @@ def qemu_io(*args):
>>       '''Run qemu-io and return the stdout data'''
>>       return qemu_tool_pipe_and_status('qemu-io', qemu_io_wrap_args(args))[0]
>> +def qemu_io_pipe_and_status(*args):
>> +    args = qemu_io_args + list(args)
>> +    return qemu_tool_pipe_and_status('qemu-io', args)
> 
> Shouldn’t we use qemu_io_wrap_args() here, like above?  The next patch adds a caller that passes `'-f', 'raw'` to it, which kind of implies to me that qemu_io_wrap_args() would be better.

Will do

> 
>> +
>>   def qemu_io_log(*args):
>>       result = qemu_io(*args)
>>       log(result, filters=[filter_testfiles, filter_qemu_io])
> 


-- 
Best regards,
Vladimir