From nobody Sat May 18 10:48:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558023157; cv=none; d=zoho.com; s=zohoarc; b=lB/DCM/H3zhJM1cSeAH1tei6gsYBtzgSluJrJyHuLeQOxxhJtrNDKC6oANEzukGgL8xdQNlEM5nTHurCiOsbaaGiQgyuy4Xy+BdwRcvl25tDTmC36Y9EBeUdUSwyngd3Ehig/4LSSjfKkSkCVm7N0fMQMS9J4t9G3VpMpVslXFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558023157; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=da8GBgam2BX821i665wmiw0B2XPazN42HDVAJmGOte4=; b=jyuYSuKnM9lQB9rEb1NWVXbmbyHS6yhKJgr+kBo5CvmgD/ae8yvYNkcvQNjz7iVr/5KZk8UJKwmCwLaJX2AMRcD6DWKEQCZR+9Ltumnq8BjqnROgWOg6PrsBlmeuY1tPBmId+8/b6IAsaonZjeCx9A8VTStrs8YoqzpaenJGPpM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558023157899626.4260626620885; Thu, 16 May 2019 09:12:37 -0700 (PDT) Received: from localhost ([127.0.0.1]:60652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRIza-0006fI-AE for importer@patchew.org; Thu, 16 May 2019 12:12:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRIyb-0006Jp-SB for qemu-devel@nongnu.org; Thu, 16 May 2019 12:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRIya-0004RG-Pi for qemu-devel@nongnu.org; Thu, 16 May 2019 12:11:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50458) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRIyY-0004Ng-Cg; Thu, 16 May 2019 12:11:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAACF3DBC2; Thu, 16 May 2019 16:11:17 +0000 (UTC) Received: from localhost (ovpn-204-34.brq.redhat.com [10.40.204.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D9E41001DE6; Thu, 16 May 2019 16:11:16 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 16 May 2019 18:11:14 +0200 Message-Id: <20190516161114.27596-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 16 May 2019 16:11:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] iotests: Fix intermittent failure in 219 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, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In 219, we wait for the job to make progress before we emit its status. This makes the output reliable. Unfortunately, there is a bug: We do not wait for any more progress if the job has already reached its total-progress. Right after the job has been started, it is possible that total-progress is still 0, though. In that case, we may skip the first progress-making step and keep ending up 64 kB short. To fix that bug, we cab simply wait for total-progress to reach 4 MB (the image size) after starting the job. Reported-by: Karen Mezick Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1686651 Signed-off-by: Max Reitz Reviewed-by: John Snow --- tests/qemu-iotests/219 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219 index c03bbdb294..e0c51662c0 100755 --- a/tests/qemu-iotests/219 +++ b/tests/qemu-iotests/219 @@ -23,6 +23,8 @@ import iotests =20 iotests.verify_image_format(supported_fmts=3D['qcow2']) =20 +img_size =3D 4 * 1024 * 1024 + def pause_wait(vm, job_id): with iotests.Timeout(3, "Timeout waiting for job to pause"): while True: @@ -62,6 +64,8 @@ def test_pause_resume(vm): iotests.log(vm.qmp('query-jobs')) =20 def test_job_lifecycle(vm, job, job_args, has_ready=3DFalse): + global img_size + iotests.log('') iotests.log('') iotests.log('Starting block job: %s (auto-finalize: %s; auto-dismiss: = %s)' % @@ -84,6 +88,10 @@ def test_job_lifecycle(vm, job, job_args, has_ready=3DFa= lse): iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE'= ))) iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE'= ))) =20 + # Wait for total-progress to stabilize + while vm.qmp('query-jobs')['return'][0]['total-progress'] < img_size: + pass + # RUNNING state: # pause/resume should work, complete/finalize/dismiss should error out iotests.log('') @@ -173,9 +181,8 @@ with iotests.FilePath('disk.img') as disk_path, \ iotests.FilePath('copy.img') as copy_path, \ iotests.VM() as vm: =20 - img_size =3D '4M' - iotests.qemu_img_create('-f', iotests.imgfmt, disk_path, img_size) - iotests.qemu_io('-c', 'write 0 %s' % (img_size), + iotests.qemu_img_create('-f', iotests.imgfmt, disk_path, str(img_size)) + iotests.qemu_io('-c', 'write 0 %i' % (img_size), '-f', iotests.imgfmt, disk_path) =20 iotests.log('Launching VM...') --=20 2.21.0