From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWW60-0005Cy-BQ for qemu-devel@nongnu.org; Wed, 16 Oct 2013 14:45:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWW5u-0008Tf-Bp for qemu-devel@nongnu.org; Wed, 16 Oct 2013 14:45:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWW5u-0008Sj-3o for qemu-devel@nongnu.org; Wed, 16 Oct 2013 14:45:18 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9GIjGHm021788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Oct 2013 14:45:16 -0400 Message-ID: <525EDEB9.5030603@redhat.com> Date: Wed, 16 Oct 2013 20:45:13 +0200 From: Max Reitz MIME-Version: 1.0 References: <1381804911-3664-1-git-send-email-famz@redhat.com> In-Reply-To: <1381804911-3664-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: fix 030 for faster machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com On 2013-10-15 04:41, Fam Zheng wrote: > If the block job completes too fast, the test can fail. Change the > numbers so the qmp events are more stably captured by the script. > > A sleep is removed for the same reason. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/030 | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 > index ae56f3b..188b182 100755 > --- a/tests/qemu-iotests/030 > +++ b/tests/qemu-iotests/030 > @@ -403,14 +403,13 @@ class TestStreamStop(iotests.QMPTestCase): > result =3D self.vm.qmp('block-stream', device=3D'drive0') > self.assert_qmp(result, 'return', {}) > =20 > - time.sleep(0.1) Hm, I'm not sure whether removing the sleep actually removes the=20 underlying race condition=E2=80=A6 It should work in most cases and the=20 foreseeable future, though. > events =3D self.vm.get_qmp_events(wait=3DFalse) > self.assertEqual(events, [], 'unexpected QMP event: %s' % eve= nts) > =20 > self.cancel_and_wait() > =20 > class TestSetSpeed(iotests.QMPTestCase): > - image_len =3D 80 * 1024 * 1024 # MB > + image_len =3D 512 * 1024 * 1024 # MB > =20 > def setUp(self): > qemu_img('create', backing_img, str(TestSetSpeed.image_len)) > @@ -457,23 +456,23 @@ class TestSetSpeed(iotests.QMPTestCase): > self.assert_qmp(result, 'return[0]/device', 'drive0') > self.assert_qmp(result, 'return[0]/speed', 0) > =20 > - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0= ', speed=3D8 * 1024 * 1024) > + result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0= ', speed=3D8 * 1024) So the limit was already 8 MB/s? Doesn't this mean that the job should=20 have taken 10 seconds anyway? Sounds to me like the block job speed is=20 basically disregarded anyway. If I re-add the sleep you removed in this patch, this test fails again=20 for me. This further suggests block-job-set-speed to be kind of a no-op=20 and the changes concerning the image length and the block job speed not=20 really contributing to fixing the test. So I think removing the sleep is all that would have to be done right=20 now. OTOH, this is not really a permanent fix, either (the fundamental=20 race condition remains). Furthermore, I guess there is some reason for=20 having a sleep there - else it would not exist in the first place (and=20 it apparently already caused problems some time ago which were "fixed"=20 by replacing the previous "sleep(1)" by "sleep(0.1)"). All in all, if someone can assure me of the uneccessity of the sleep in=20 question, I think removing it is all that's needed. Max > self.assert_qmp(result, 'return', {}) > =20 > # Ensure the speed we set was accepted > result =3D self.vm.qmp('query-block-jobs') > self.assert_qmp(result, 'return[0]/device', 'drive0') > - self.assert_qmp(result, 'return[0]/speed', 8 * 1024 * 1024) > + self.assert_qmp(result, 'return[0]/speed', 8 * 1024) > =20 > self.cancel_and_wait() > =20 > # Check setting speed in block-stream works > - result =3D self.vm.qmp('block-stream', device=3D'drive0', spee= d=3D4 * 1024 * 1024) > + result =3D self.vm.qmp('block-stream', device=3D'drive0', spee= d=3D4 * 1024) > self.assert_qmp(result, 'return', {}) > =20 > result =3D self.vm.qmp('query-block-jobs') > self.assert_qmp(result, 'return[0]/device', 'drive0') > - self.assert_qmp(result, 'return[0]/speed', 4 * 1024 * 1024) > + self.assert_qmp(result, 'return[0]/speed', 4 * 1024) > =20 > self.cancel_and_wait() > =20