From nobody Thu May 2 16:28:26 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510259558368811.2264017258435; Thu, 9 Nov 2017 12:32:38 -0800 (PST) Received: from localhost ([::1]:38676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtUm-0003FK-Hv for importer@patchew.org; Thu, 09 Nov 2017 15:32:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtTD-0002Ld-MI for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtTC-0003jV-Pz for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38332) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCtT9-0003gl-T2; Thu, 09 Nov 2017 15:30:36 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DB01C04AC7C; Thu, 9 Nov 2017 20:30:35 +0000 (UTC) Received: from localhost (ovpn-204-42.brq.redhat.com [10.40.204.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C68F61F24; Thu, 9 Nov 2017 20:30:32 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 9 Nov 2017 21:30:21 +0100 Message-Id: <20171109203025.27493-2-mreitz@redhat.com> In-Reply-To: <20171109203025.27493-1-mreitz@redhat.com> References: <20171109203025.27493-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 09 Nov 2017 20:30:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/5] iotests: Make 030 less flaky X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch fixes two race conditions in 030: 1. The first is in TestENOSPC.test_enospc(). After resuming the job, querying it to confirm it is no longer paused may fail because in the meantime it might have completed already. The same was fixed in TestEIO.test_ignore() already (in commit 2c3b44da07d341557a8203cc509ea07fe3605e11). 2. The second is in TestSetSpeed.test_set_speed_invalid(): Here, a stream job is started on a drive without any break points, with a block-job-set-speed invoked subsequently. However, without any break points, the job might have completed in the meantime (on tmpfs at least); or it might complete before cancel_and_wait() which expects the job to still exist. This can be fixed like everywhere else by pausing the drive (installing break points) before starting the job and letting cancel_and_wait() resume it. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/030 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 18838948fa..457984b8e9 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -666,6 +666,7 @@ class TestENOSPC(TestErrors): if event['event'] =3D=3D 'BLOCK_JOB_ERROR': self.assert_qmp(event, 'data/device', 'drive0') self.assert_qmp(event, 'data/operation', 'read') + error =3D True =20 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/paused', True) @@ -676,9 +677,11 @@ class TestENOSPC(TestErrors): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block-jobs') + if result =3D=3D {'return': []}: + # Race; likely already finished. Check. + continue self.assert_qmp(result, 'return[0]/paused', False) self.assert_qmp(result, 'return[0]/io-status', 'ok') - error =3D True elif event['event'] =3D=3D 'BLOCK_JOB_COMPLETED': self.assertTrue(error, 'job completed unexpectedly') self.assert_qmp(event, 'data/type', 'stream') @@ -792,13 +795,14 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 + self.vm.pause_drive('drive0') result =3D self.vm.qmp('block-stream', device=3D'drive0') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D-1) self.assert_qmp(result, 'error/class', 'GenericError') =20 - self.cancel_and_wait() + self.cancel_and_wait(resume=3DTrue) =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed']) --=20 2.13.6 From nobody Thu May 2 16:28:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510259644338747.3903419366975; Thu, 9 Nov 2017 12:34:04 -0800 (PST) Received: from localhost ([::1]:38680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtWG-0004Jo-Gt for importer@patchew.org; Thu, 09 Nov 2017 15:33:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtTL-0002S4-KE for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtTK-0003r7-S1 for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCtTG-0003lQ-HH; Thu, 09 Nov 2017 15:30:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B00A2356EA; Thu, 9 Nov 2017 20:30:41 +0000 (UTC) Received: from localhost (ovpn-204-42.brq.redhat.com [10.40.204.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2AC5660FAA; Thu, 9 Nov 2017 20:30:36 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 9 Nov 2017 21:30:22 +0100 Message-Id: <20171109203025.27493-3-mreitz@redhat.com> In-Reply-To: <20171109203025.27493-1-mreitz@redhat.com> References: <20171109203025.27493-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 09 Nov 2017 20:30:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/5] iotests: Add missing 'blkdebug::' in 040 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 040 tries to invoke pause_drive() on a drive that does not use blkdebug. Good idea, but let's use blkdebug to make it actually work. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/040 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index c284d08796..90b5b4f2ad 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -289,7 +289,7 @@ class TestSetSpeed(ImageCommitTestCase): qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % mid_img, test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 0 512', test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= mid_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.vm =3D iotests.VM().add_drive('blkdebug::' + test_img) self.vm.launch() =20 def tearDown(self): --=20 2.13.6 From nobody Thu May 2 16:28:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510259661202342.21625636961903; Thu, 9 Nov 2017 12:34:21 -0800 (PST) Received: from localhost ([::1]:38682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtWh-0004bG-C6 for importer@patchew.org; Thu, 09 Nov 2017 15:34:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtTO-0002Tt-8q for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtTN-0003sh-0D for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCtTJ-0003oM-Kv; Thu, 09 Nov 2017 15:30:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5984800A8; Thu, 9 Nov 2017 20:30:44 +0000 (UTC) Received: from localhost (ovpn-204-42.brq.redhat.com [10.40.204.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5400760FA2; Thu, 9 Nov 2017 20:30:44 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 9 Nov 2017 21:30:23 +0100 Message-Id: <20171109203025.27493-4-mreitz@redhat.com> In-Reply-To: <20171109203025.27493-1-mreitz@redhat.com> References: <20171109203025.27493-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 09 Nov 2017 20:30:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/5] iotests: Make 055 less flaky X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" First of all, test 055 does a valiant job of invoking pause_drive() sometimes, but that is worth nothing without blkdebug. So the first thing to do is to sprinkle a couple of "blkdebug::" in there -- with the exception of the transaction tests, because the blkdebug break points make the transaction QMP command hang (which is bad). In that case, we can get away with throttling the block job that it effectively is paused. Then, 055 usually does not pause the drive before starting a block job that should be cancelled. This means that the backup job might be completed already before block-job-cancel is invoked; thus making the test either fail (currently) or moot if cancel_and_wait() ignored this condition. Fix this by pausing the drive before starting the job. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/055 | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index e1206caf9b..8a5d9fd269 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -48,7 +48,7 @@ class TestSingleDrive(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) =20 - self.vm =3D iotests.VM().add_drive(test_img) + self.vm =3D iotests.VM().add_drive('blkdebug::' + test_img) self.vm.add_drive(blockdev_target_img, interface=3D"none") if iotests.qemu_default_machine =3D=3D 'pc': self.vm.add_drive(None, 'media=3Dcdrom', 'ide') @@ -65,10 +65,11 @@ class TestSingleDrive(iotests.QMPTestCase): def do_test_cancel(self, cmd, target): self.assert_no_active_block_jobs() =20 + self.vm.pause_drive('drive0') result =3D self.vm.qmp(cmd, device=3D'drive0', target=3Dtarget, sy= nc=3D'full') self.assert_qmp(result, 'return', {}) =20 - event =3D self.cancel_and_wait() + event =3D self.cancel_and_wait(resume=3DTrue) self.assert_qmp(event, 'data/type', 'backup') =20 def test_cancel_drive_backup(self): @@ -166,7 +167,7 @@ class TestSetSpeed(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) =20 - self.vm =3D iotests.VM().add_drive(test_img) + self.vm =3D iotests.VM().add_drive('blkdebug::' + test_img) self.vm.add_drive(blockdev_target_img, interface=3D"none") self.vm.launch() =20 @@ -246,6 +247,8 @@ class TestSetSpeed(iotests.QMPTestCase): def test_set_speed_invalid_blockdev_backup(self): self.do_test_set_speed_invalid('blockdev-backup', 'drive1') =20 +# Note: We cannot use pause_drive() here, or the transaction command +# would stall. Instead, we limit the block job speed here. class TestSingleTransaction(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) @@ -271,7 +274,8 @@ class TestSingleTransaction(iotests.QMPTestCase): 'type': cmd, 'data': { 'device': 'drive0', 'target': target, - 'sync': 'full' }, + 'sync': 'full', + 'speed': 64 * 1024 }, } ]) =20 @@ -289,12 +293,12 @@ class TestSingleTransaction(iotests.QMPTestCase): def do_test_pause(self, cmd, target, image): self.assert_no_active_block_jobs() =20 - self.vm.pause_drive('drive0') result =3D self.vm.qmp('transaction', actions=3D[{ 'type': cmd, 'data': { 'device': 'drive0', 'target': target, - 'sync': 'full' }, + 'sync': 'full', + 'speed': 64 * 1024 }, } ]) self.assert_qmp(result, 'return', {}) @@ -302,7 +306,9 @@ class TestSingleTransaction(iotests.QMPTestCase): result =3D self.vm.qmp('block-job-pause', device=3D'drive0') self.assert_qmp(result, 'return', {}) =20 - self.vm.resume_drive('drive0') + result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) + self.assert_qmp(result, 'return', {}) + self.pause_job('drive0') =20 result =3D self.vm.qmp('query-block-jobs') @@ -461,7 +467,7 @@ class TestDriveCompression(iotests.QMPTestCase): pass =20 def do_prepare_drives(self, fmt, args, attach_target): - self.vm =3D iotests.VM().add_drive(test_img) + self.vm =3D iotests.VM().add_drive('blkdebug::' + test_img) =20 qemu_img('create', '-f', fmt, blockdev_target_img, str(TestDriveCompression.image_len), *args) @@ -500,10 +506,11 @@ class TestDriveCompression(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 + self.vm.pause_drive('drive0') result =3D self.vm.qmp(cmd, device=3D'drive0', sync=3D'full', comp= ress=3DTrue, **args) self.assert_qmp(result, 'return', {}) =20 - event =3D self.cancel_and_wait() + event =3D self.cancel_and_wait(resume=3DTrue) self.assert_qmp(event, 'data/type', 'backup') =20 self.vm.shutdown() --=20 2.13.6 From nobody Thu May 2 16:28:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15102597406651001.9598972625397; Thu, 9 Nov 2017 12:35:40 -0800 (PST) Received: from localhost ([::1]:38688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtXv-0005Nt-IH for importer@patchew.org; Thu, 09 Nov 2017 15:35:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtTP-0002VD-KP for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtTO-0003ty-N1 for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCtTM-0003rx-Ev; Thu, 09 Nov 2017 15:30:48 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D58EC0567A2; Thu, 9 Nov 2017 20:30:47 +0000 (UTC) Received: from localhost (ovpn-204-42.brq.redhat.com [10.40.204.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02CCE6266B; Thu, 9 Nov 2017 20:30:46 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 9 Nov 2017 21:30:24 +0100 Message-Id: <20171109203025.27493-5-mreitz@redhat.com> In-Reply-To: <20171109203025.27493-1-mreitz@redhat.com> References: <20171109203025.27493-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 09 Nov 2017 20:30:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/5] iotests: Make 083 less flaky X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 083 has (at least) two issues: 1. By launching the nbd-fault-injector in background, it may not be scheduled until the first grep on its output file is executed. However, until then, that file may not have been created yet -- so it either does not exist yet (thus making the grep emit an error), or it does exist but contains stale data (thus making the rest of the test case work connect to a wrong address). Fix this by explicitly overwriting the output file before executing nbd-fault-injector. 2. The nbd-fault-injector prints things other than "Listening on...". It also prints a "Closing connection" message from time to time. We currently invoke sed on the whole file in the hope of it only containing the "Listening on..." line yet. That hope is sometimes shattered by the brutal reality of race conditions, so invoke grep before sed. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- tests/qemu-iotests/083 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083 index 0306f112da..3c1adbf0fb 100755 --- a/tests/qemu-iotests/083 +++ b/tests/qemu-iotests/083 @@ -86,6 +86,7 @@ EOF =20 rm -f "$TEST_DIR/nbd.sock" =20 + echo > "$TEST_DIR/nbd-fault-injector.out" $PYTHON nbd-fault-injector.py $extra_args "$nbd_addr" "$TEST_DIR/nbd-faul= t-injector.conf" >"$TEST_DIR/nbd-fault-injector.out" 2>&1 & =20 # Wait for server to be ready @@ -94,7 +95,8 @@ EOF done =20 # Extract the final address (port number has now been assigned in tcp cas= e) - nbd_addr=3D$(sed 's/Listening on \(.*\)$/\1/' "$TEST_DIR/nbd-fault-inject= or.out") + nbd_addr=3D$(sed -n 's/^Listening on //p' \ + "$TEST_DIR/nbd-fault-injector.out") =20 if [ "$proto" =3D "tcp" ]; then nbd_url=3D"nbd+tcp://$nbd_addr/$export_name" --=20 2.13.6 From nobody Thu May 2 16:28:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510259818706777.353543528983; Thu, 9 Nov 2017 12:36:58 -0800 (PST) Received: from localhost ([::1]:38692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtZ9-00061U-V5 for importer@patchew.org; Thu, 09 Nov 2017 15:36:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtTW-0002bD-Jk for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtTV-000412-Pe for qemu-devel@nongnu.org; Thu, 09 Nov 2017 15:30:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59958) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCtTT-0003xC-19; Thu, 09 Nov 2017 15:30:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 373F0DA312; Thu, 9 Nov 2017 20:30:54 +0000 (UTC) Received: from localhost (ovpn-204-42.brq.redhat.com [10.40.204.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E7F75D9CD; Thu, 9 Nov 2017 20:30:49 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 9 Nov 2017 21:30:25 +0100 Message-Id: <20171109203025.27493-6-mreitz@redhat.com> In-Reply-To: <20171109203025.27493-1-mreitz@redhat.com> References: <20171109203025.27493-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 09 Nov 2017 20:30:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/5] iotests: Make 136 less flaky X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 136 executes some AIO requests without a final aio_flush; then it advances the virtual clock and thus expects the last access time of the device to be less than the current time when queried (i.e. idle_time_ns to be greater than 0). However, without the aio_flush, some requests may be settled after the clock_step invocation. In that case, idle_time_ns would be 0 and the test fails. Fix this by adding an aio_flush if any AIO request other than some other aio_flush has been executed. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/136 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 4b994897af..88b97ea7c6 100644 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -238,6 +238,18 @@ sector =3D "%d" for i in range(failed_wr_ops): ops.append("aio_write %d 512" % bad_offset) =20 + # We need an extra aio_flush to settle all outstanding AIO + # operations before we can advance the virtual clock, so that + # the last access happens before clock_step and idle_time_ns + # will be greater than 0 + extra_flush =3D 0 + if rd_ops + wr_ops + invalid_rd_ops + invalid_wr_ops + \ + failed_rd_ops + failed_wr_ops > 0: + extra_flush =3D 1 + + if extra_flush > 0: + ops.append("aio_flush") + if failed_wr_ops > 0: highest_offset =3D max(highest_offset, bad_offset + 512) =20 @@ -251,7 +263,7 @@ sector =3D "%d" self.total_wr_bytes +=3D wr_ops * wr_size self.total_wr_ops +=3D wr_ops self.total_wr_merged +=3D wr_merged - self.total_flush_ops +=3D flush_ops + self.total_flush_ops +=3D flush_ops + extra_flush self.invalid_rd_ops +=3D invalid_rd_ops self.invalid_wr_ops +=3D invalid_wr_ops self.failed_rd_ops +=3D failed_rd_ops --=20 2.13.6