From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKyLA-0008AO-24 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 19:06:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKyL8-0006XP-Vf for qemu-devel@nongnu.org; Mon, 09 Feb 2015 19:06:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKyL8-0006XF-Oa for qemu-devel@nongnu.org; Mon, 09 Feb 2015 19:06:06 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1A0655h023008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Feb 2015 19:06:06 -0500 Message-ID: <54D94B6B.1020004@redhat.com> Date: Mon, 09 Feb 2015 17:06:03 -0700 From: Eric Blake MIME-Version: 1.0 References: <1423501897-30410-1-git-send-email-mreitz@redhat.com> <1423501897-30410-38-git-send-email-mreitz@redhat.com> In-Reply-To: <1423501897-30410-38-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rx61ui1EepEAdABLLSmRtujJhE8aC5RXX" Subject: Re: [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related QMP commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , John Snow , Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rx61ui1EepEAdABLLSmRtujJhE8aC5RXX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/09/2015 10:11 AM, Max Reitz wrote: > Signed-off-by: Max Reitz > --- > tests/qemu-iotests/118 | 653 +++++++++++++++++++++++++++++++++++++= ++++++++ > tests/qemu-iotests/118.out | 5 + > tests/qemu-iotests/group | 1 + > 3 files changed, 659 insertions(+) > create mode 100755 tests/qemu-iotests/118 > create mode 100644 tests/qemu-iotests/118.out >=20 > + > + def process_events(self): > + for event in self.vm.get_qmp_events(wait=3DTrue): > + if event['event'] =3D=3D 'DEVICE_TRAY_MOVED' and event['da= ta']['device'] =3D=3D 'drive0': Long line; I think you can wrap it as: if (event['event'] =3D=3D 'DEVICE_TRAY_MOVED' and event['data']['device'] =3D=3D 'drive0'): > +class GeneralChangeTestsBaseClass(ChangeBaseClass): > + def test_change(self): > + result =3D self.vm.qmp('change', device=3D'drive0', target=3Dn= ew_img, > + arg=3Diotests.imgfmt) Unusual indentation. [1] > + self.assert_qmp(result, 'return', {}) > + > + while not self.has_opened: > + self.process_events() > + while not self.has_closed: > + self.process_events() > + Are we guaranteed that loops like this will gracefully timeout and fail the test if the event doesn't happen, instead of hanging forever? But that's probably something affecting multiple tests, so I won't hold up review of this one. > + result =3D self.vm.qmp('query-block') > + self.assert_qmp(result, 'return[0]/tray_open', False) > + self.assert_qmp(result, 'return[0]/inserted/image/filename', n= ew_img) > + > + def test_blockdev_change_medium(self): > + result =3D self.vm.qmp('blockdev-change-medium', device=3D'dri= ve0', > + filename=3Dnew_= img, > + format=3Diotest= s.imgfmt) [1] I guess your choice of not flushing arguments to the ( is intentional= =2E The long line thing is minor, so: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rx61ui1EepEAdABLLSmRtujJhE8aC5RXX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJU2UtrAAoJEKeha0olJ0NqhMUH/R/c5dwwa7gCd55d4QjupNBy DTzDFBirBFlmTt8sf/2wBXbacpcF554Q+GZOZ3tP4fTXNW6Q5NE3aEaZ9s8puFr5 +rhzoeYYOP2pJ1cBtjhGs8io0H6H0bQXysTPU3XX4vRuvelbLwnPDomCrl+WrR3R cfg/9ZYO98S7WcxKxGoA3zuvnHznexEzOk9oIGux5fDvZxi70sAo4yJ7YVQ3c5nk tdWAOHukOMtS8yItgMZRc3q8sAv9DUqJ3AppWz066aS4dU7OK6nAHILaKCu2BTKf hvo8ZYqmsY/1irMrGvVm95lDYRVmv7YOMv4k+/Iq22KBB+Vy294xZ3kh9ynMjjc= =tpXC -----END PGP SIGNATURE----- --rx61ui1EepEAdABLLSmRtujJhE8aC5RXX--