qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC v4 10/13] iotests: add event_wait to VM clas


From: John Snow
Subject: Re: [Qemu-devel] [PATCH RFC v4 10/13] iotests: add event_wait to VM class
Date: Thu, 07 May 2015 15:45:02 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0


On 02/27/2015 12:24 PM, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: John Snow <address@hidden>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
>  tests/qemu-iotests/iotests.py | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 75640b2..294b158 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -203,6 +203,13 @@ class VM(object):
>          self._qmp.clear_events()
>          return events
>  
> +    def event_wait(self, name='BLOCK_JOB_COMPLETED', maxwait=10):
> +        for _ in range(maxwait):
> +            for event in self.get_qmp_events(wait=True):
> +                if event['event'] == name:
> +                    return event
> +            return None
> +
>  index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
>  
>  class QMPTestCase(unittest.TestCase):
> 

For v5, I have already included this upstream and expanded it slightly
to include a proper timeout mechanism as well as a new "match" parameter
that accepts a dict that can be used as a "filter" to only select events
for which 'match' is a recursive subset.

This patch can likely be dropped again.



reply via email to

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