From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBuMx-0007Jm-9Z for qemu-devel@nongnu.org; Wed, 23 Dec 2015 20:07:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBuMw-0005Wh-84 for qemu-devel@nongnu.org; Wed, 23 Dec 2015 20:07:03 -0500 References: <1450850347-5291-1-git-send-email-famz@redhat.com> <1450850347-5291-6-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <567B452C.5020603@redhat.com> Date: Thu, 24 Dec 2015 02:06:52 +0100 MIME-Version: 1.0 In-Reply-To: <1450850347-5291-6-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cNk1b36iBiUsdM7ivfVHLeVuHxspHrx0q" Subject: Re: [Qemu-devel] [PATCH v3 5/5] iotests: Add test cases for blockdev-mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Markus Armbruster , Stefan Hajnoczi , pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cNk1b36iBiUsdM7ivfVHLeVuHxspHrx0q Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 23.12.2015 06:59, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/041 | 100 ++++++++++++++++++++++++++++++++++---= -------- > tests/qemu-iotests/041.out | 4 +- > 2 files changed, 79 insertions(+), 25 deletions(-) Reviewed-by: Max Reitz Some comments below. > diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 > index 05b5962..bcdefb2 100755 > --- a/tests/qemu-iotests/041 > +++ b/tests/qemu-iotests/041 [...] > @@ -172,30 +174,82 @@ class TestSingleDrive(iotests.QMPTestCase): > if iotests.qemu_default_machine !=3D 'pc': > return > =20 > - result =3D self.vm.qmp('drive-mirror', device=3D'drive1', # CD= -ROM > - sync=3D'full', target=3Dtarget_img) > - self.assert_qmp(result, 'error/class', 'GenericError') > + result =3D self.vm.qmp(self.qmp_cmd, device=3D'ide1-cd0', sync= =3D'full', > + target=3Dself.qmp_target) > + self.assert_qmp(result, 'error/class', self.not_found_error) > =20 > def test_image_not_found(self): > - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync= =3D'full', > - mode=3D'existing', target=3Dtarget_img) > + result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D= 'full', > + mode=3D'existing', target=3Dself.qmp_targ= et) > self.assert_qmp(result, 'error/class', 'GenericError') > =20 > def test_device_not_found(self): > - result =3D self.vm.qmp('drive-mirror', device=3D'nonexistent',= sync=3D'full', > - target=3Dtarget_img) > - self.assert_qmp(result, 'error/class', 'DeviceNotFound') > + result =3D self.vm.qmp(self.qmp_cmd, device=3D'nonexistent', s= ync=3D'full', > + target=3Dself.qmp_target) > + self.assert_qmp(result, 'error/class', self.not_found_error) > + > +class TestSingleBlockdev(TestSingleDrive): > + qmp_cmd =3D 'blockdev-mirror' > + qmp_target =3D 'node1' > + not_found_error =3D 'GenericError' > + > + def setUp(self): > + TestSingleDrive.setUp(self) > + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D= %s' % backing_img, target_img) > + args =3D {'options': > + {'driver': iotests.imgfmt, > + 'node-name': 'node1', Could be qmp_target instead. > + 'file': { 'filename': target_img, 'driver': 'file'= } } } > + result =3D self.vm.qmp("blockdev-add", **args) > + self.assert_qmp(result, 'return', {}) > + > + test_large_cluster =3D None > + test_image_not_found =3D None > + test_small_buffer2 =3D None > + > +class TestBlockdevAttached(iotests.QMPTestCase): > + image_len =3D 1 * 1024 * 1024 # MB > + > + def setUp(self): > + iotests.create_image(backing_img, self.image_len) > + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D= %s' % backing_img, test_img) > + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D= %s' % backing_img, target_img) > + self.vm =3D iotests.VM().add_drive(test_img) > + self.vm.launch() > + > + def tearDown(self): > + self.vm.shutdown() > + os.remove(test_img) > + os.remove(target_img) > + > + def test_blockdev_attached(self): > + self.assert_no_active_block_jobs() > + args =3D {'options': > + {'driver': iotests.imgfmt, > + "id": "drive1", The double quotes look a bit out of place. > + 'file': { 'filename': target_img, 'driver': 'file'= } } } > + result =3D self.vm.qmp("blockdev-add", **args) > + self.assert_qmp(result, 'return', {}) > + result =3D self.vm.qmp('blockdev-mirror', device=3D'drive0', s= ync=3D'full', > + target=3D'drive1') > + self.assert_qmp(result, 'error/class', 'GenericError') > =20 > class TestSingleDriveZeroLength(TestSingleDrive): > image_len =3D 0 > test_small_buffer2 =3D None > test_large_cluster =3D None > =20 > +class TestSingleBlockdevZeroLength(TestSingleBlockdev): > + image_len =3D 0 > + > class TestSingleDriveUnalignedLength(TestSingleDrive): > image_len =3D 1025 * 1024 > test_small_buffer2 =3D None > test_large_cluster =3D None > =20 > +class TestSingleBlockdevUnalignedLength(TestSingleBlockdev): > + image_len =3D 1025 * 1024 > + > class TestMirrorNoBacking(iotests.QMPTestCase): > image_len =3D 2 * 1024 * 1024 # MB > =20 > diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out > index 24093bc..b67d050 100644 > --- a/tests/qemu-iotests/041.out > +++ b/tests/qemu-iotests/041.out > @@ -1,5 +1,5 @@ > -...................................................... > +......................................................................= =2E..... > ----------------------------------------------------------------------= > -Ran 54 tests > +Ran 76 tests > =20 > OK >=20 --cNk1b36iBiUsdM7ivfVHLeVuHxspHrx0q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWe0UsAAoJEDuxQgLoOKyt9SsH/13F5rOYMMJSVKZ/JYHZYftl WaKF/61Y89uGJFR8KEQj4YSyfpseh2CQJLlw0IiY2ZPdYGC6NL8F6zPXFw8Fnr8g aU3sxi1I2ghuiIlbRj1A1XSWPUTPWjRaL9TgXafLLqcgueVgYLa7wEm2ozouzfL/ SlhUJqmvbAQedshSvC6NkmXKXeDi1XzChypycKeJJDqbrMi7OqVVpzPUweqOouNU DaxV9vP1c0jKNYxUG9ozMoohcZ94urhLU5p4g8uPOLyTjeC8/wmtDVGpXW1GAXn7 cgPzeBTYPHwMwXFnSbjdoQxCErJ8zGZehJFV1dcvZEnAD+oJIj3RsfH8RNe4fAg= =kLtT -----END PGP SIGNATURE----- --cNk1b36iBiUsdM7ivfVHLeVuHxspHrx0q--