From nobody Sun May 5 00:42:24 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497621603080584.8034076699109; Fri, 16 Jun 2017 07:00:03 -0700 (PDT) Received: from localhost ([::1]:59034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLrn7-00089Q-Go for importer@patchew.org; Fri, 16 Jun 2017 10:00:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLrm5-0007Pp-4H for qemu-devel@nongnu.org; Fri, 16 Jun 2017 09:58:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLrm4-0007xp-3u for qemu-devel@nongnu.org; Fri, 16 Jun 2017 09:58:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51332) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLrlz-0007w0-As; Fri, 16 Jun 2017 09:58:51 -0400 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 0BFA7804E2; Fri, 16 Jun 2017 13:58:50 +0000 (UTC) Received: from localhost (unknown [10.40.205.88]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4652181EFB; Fri, 16 Jun 2017 13:58:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0BFA7804E2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0BFA7804E2 From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 16 Jun 2017 15:58:47 +0200 Message-Id: <20170616135847.17726-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.27]); Fri, 16 Jun 2017 13:58:50 +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] iotests: Add test for failing qemu-img commit 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- In order to pass, this depends on "fix: avoid an infinite loop or a dangling pointer problem in img_commit" (http://lists.nongnu.org/archive/html/qemu-block/2017-06/msg00443.html) and on the "block: Don't compare strings in bdrv_reopen_prepare()" series (http://lists.nongnu.org/archive/html/qemu-block/2017-06/msg00424.html). --- tests/qemu-iotests/020 | 27 +++++++++++++++++++++++++++ tests/qemu-iotests/020.out | 17 +++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 index 7a11110..83d5ef0 100755 --- a/tests/qemu-iotests/020 +++ b/tests/qemu-iotests/020 @@ -110,6 +110,33 @@ for offset in $TEST_OFFSETS; do io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 done _check_test_img +_cleanup +TEST_IMG=3D$TEST_IMG_SAVE + +echo +echo 'Testing failing commit' +echo + +# Create an image with a null backing file to which committing will fail (= with +# ENOSPC so we can distinguish the result from some generic EIO which may = be +# generated anywhere in the block layer) +_make_test_img -b "json:{'driver': 'raw', + 'file': { + 'driver': 'blkdebug', + 'inject-error': [{ + 'event': 'write_aio', + 'errno': 28, + 'once': true + }], + 'image': { + 'driver': 'null-co' + }}}" + +# Just write anything so comitting will not be a no-op +$QEMU_IO -c 'writev 0 64k' "$TEST_IMG" | _filter_qemu_io + +$QEMU_IMG commit "$TEST_IMG" +_cleanup_test_img =20 # success, all done echo "*** done" diff --git a/tests/qemu-iotests/020.out b/tests/qemu-iotests/020.out index 42f6c1b..165b70a 100644 --- a/tests/qemu-iotests/020.out +++ b/tests/qemu-iotests/020.out @@ -1075,4 +1075,21 @@ read 65536/65536 bytes at offset 4295098368 read 65536/65536 bytes at offset 4295294976 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. + +Testing failing commit + +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 backing_fil= e=3Djson:{'driver': 'raw',, + 'file': { + 'driver': 'blkdebug',, + 'inject-error': [{ + 'event': 'write_aio',, + 'errno': 28,, + 'once': true + }],, + 'image': { + 'driver': 'null-co' + }}} +wrote 65536/65536 bytes at offset 0 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-img: Block job failed: No space left on device *** done --=20 2.9.4