qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/3] iotests.py: Add wait_for_runstate()


From: Max Reitz
Subject: Re: [PATCH v2 2/3] iotests.py: Add wait_for_runstate()
Date: Tue, 21 Jul 2020 10:05:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 20.07.20 18:46, Vladimir Sementsov-Ogievskiy wrote:
> 16.07.2020 16:53, Max Reitz wrote:
>> Signed-off-by: Max Reitz <mreitz@redhat.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 3590ed78a0..fb240a334c 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
>> @@ -803,6 +803,10 @@ class VM(qtest.QEMUQtestMachine):
>>                      'Found node %s under %s (but expected %s)' % \
>>                      (node['name'], path, expected_node)
>>   +    def wait_for_runstate(self, runstate: str) -> None:
>> +        while self.qmp('query-status')['return']['status'] != runstate:
>> +            pass
> 
> don't we need something like time.sleep(0.5) instead of just pass?

Hm.  Maybe not “need”?  I thought this polling would last a short time
anyway, so it wouldn’t matter if there was high CPU usage during that time.

OTOH, I don’t think a short sleep would hurt.

> Anyway:
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 
>> +
>>   index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
>>     class QMPTestCase(unittest.TestCase):
>>
> 
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]