From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqRjJ-0007TY-Dx for qemu-devel@nongnu.org; Thu, 07 May 2015 15:45:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqRjF-0001T7-4m for qemu-devel@nongnu.org; Thu, 07 May 2015 15:45:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqRjF-0001RV-0P for qemu-devel@nongnu.org; Thu, 07 May 2015 15:45:05 -0400 Message-ID: <554BC0BE.1010901@redhat.com> Date: Thu, 07 May 2015 15:45:02 -0400 From: John Snow MIME-Version: 1.0 References: <1425057891-29848-1-git-send-email-vsementsov@parallels.com> <1425057891-29848-11-git-send-email-vsementsov@parallels.com> In-Reply-To: <1425057891-29848-11-git-send-email-vsementsov@parallels.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC v4 10/13] iotests: add event_wait to VM class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, quintela@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, amit.shah@redhat.com, den@openvz.org On 02/27/2015 12:24 PM, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: John Snow > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > 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.