From patchwork Fri Feb 27 17:24:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 444397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 60C75140119 for ; Sat, 28 Feb 2015 05:17:27 +1100 (AEDT) Received: from localhost ([::1]:38069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRPTZ-0007av-FH for incoming@patchwork.ozlabs.org; Fri, 27 Feb 2015 13:17:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRPQ1-0007sC-L7 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:13:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRPPx-0007mJ-1B for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:13:45 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:25787 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRPPw-0006AA-N9 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:13:40 -0500 Received: from kvm.sw.ru ([10.30.22.153]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t1RHPQra032420; Fri, 27 Feb 2015 20:25:27 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Date: Fri, 27 Feb 2015 20:24:48 +0300 Message-Id: <1425057891-29848-11-git-send-email-vsementsov@parallels.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425057891-29848-1-git-send-email-vsementsov@parallels.com> References: <1425057891-29848-1-git-send-email-vsementsov@parallels.com> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: kwolf@redhat.com, peter.maydell@linaro.org, quintela@redhat.com, dgilbert@redhat.com, vsementsov@parallels.com, stefanha@redhat.com, den@openvz.org, amit.shah@redhat.com, pbonzini@redhat.com, John Snow Subject: [Qemu-devel] [PATCH RFC v4 10/13] iotests: add event_wait to VM class X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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):