From nobody Mon Feb 9 23:01:03 2026 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; dkim=fail; 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 1529376392713304.3398109472121; Mon, 18 Jun 2018 19:46:32 -0700 (PDT) Received: from localhost ([::1]:38745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6fA-0007AF-1W for importer@patchew.org; Mon, 18 Jun 2018 22:46:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5iU-00026l-Ay for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5iT-0000AH-Br for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:54 -0400 Received: from mail-ot0-x241.google.com ([2607:f8b0:4003:c0f::241]:44064) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5iT-0000A8-6m; Mon, 18 Jun 2018 21:45:53 -0400 Received: by mail-ot0-x241.google.com with SMTP id w13-v6so20758279ote.11; Mon, 18 Jun 2018 18:45:53 -0700 (PDT) Received: from localhost ([2600:1700:70:e488:b0ee:9bda:ee6f:91be]) by smtp.gmail.com with ESMTPSA id d13-v6sm6999667oth.34.2018.06.18.18.45.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:45:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CuzL4gGZ/HcuguXkeauX1d8SD/HS4vDlr1t6UCInqYs=; b=ni6JL2hKUdOyF0PJhMZIfl66DietzQ/F7wZ5uNXkjmVLPR31FL6ZZziOqFpbAQoJCV DAerDoOoLvGbWeV/mkM+lQcj6AlsP3S9XzcRwIKM6NaCCA+iO50V2wXFPebFwFiQABZ7 l9c59n+Smlz+etoE/jMULP/amDsjWVRnUz9npLyV3IaKP3CbfvfHBg6BWeSvZDc54AEX QbH2qF+I/nI9D8HHhnk7mCELNZPt7NRj7oFstzGnRKXu0BeFTJp6sr3H3wZWi8DEb7TN JXfR83C+orT3CcoRaroT6WL2mKuTm+tZrCd3dvqqmJzm2j54DtZaJAy615BCb84Bm7dS 239Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CuzL4gGZ/HcuguXkeauX1d8SD/HS4vDlr1t6UCInqYs=; b=DrOSdrXQseklhxkz07K9xt8jPvaAC9FkZ15aiKR+n4J44muNxuB8YY016pVcJJsZq3 mqMcJHM+qMo6DzcLwiA5PZOhqn8qE7iU48g2pBxaUEB33xh5cb4NAxm8/LH58hLpMQgY pdp9x0Fdxs8WCtwW6IXBclyESDAPoeKzWJcNHMeW6rONzyFj8iFq2/dGEkOqnY8qoBbt gp5Lq3g4Mr2ocfSjZdDGCn5TRgPT1hFu7ROsljMPkK8LLYVVUAhWkekARDwinqAQpoyC KOgeySnqOijBEU/PkzJJlBmTYd/OBZVM+ARoZ4feoGToJ9zf5h48pmp2S/nZP6LB2zb7 Yh5Q== X-Gm-Message-State: APt69E3iNnK12ec4yl5Nu5XC48s3Vahvv37msDGafJd5uywZBmdCOD/l ctvkov6q2QT/GPWTK3n23VoUepuf X-Google-Smtp-Source: ADUXVKKrDR068ulyoVRaIUTbMiwbM1QQXOGqAgGUwuhuNkwMEhRdv0wOkIPhntJTC+kmwcfUJUusuA== X-Received: by 2002:a9d:b3b:: with SMTP id a56-v6mr9583983ota.272.1529372752048; Mon, 18 Jun 2018 18:45:52 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:15 -0500 Message-Id: <20180619014319.28272-50-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::241 Subject: [Qemu-devel] [PATCH 049/113] iotests: Test preallocated truncate of 2G image 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: qemu-stable@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Max Reitz Signed-off-by: Max Reitz Message-id: 20180228131315.30194-3-mreitz@redhat.com Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Signed-off-by: Max Reitz (cherry picked from commit 733d1dce0f3c8ab7b79a173f6482781d3718f844) Signed-off-by: Michael Roth --- tests/qemu-iotests/106 | 24 ++++++++++++++++++++++++ tests/qemu-iotests/106.out | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106 index bfe71f4e60..5e51f88a78 100755 --- a/tests/qemu-iotests/106 +++ b/tests/qemu-iotests/106 @@ -86,6 +86,30 @@ for growth_mode in falloc full off; do $QEMU_IMG resize -f "$IMGFMT" --shrink --preallocation=3D$growth_mode = "$TEST_IMG" -${GROWTH_SIZE}K done =20 +echo +echo '=3D=3D=3D Testing image growth on 2G empty image =3D=3D=3D' + +for growth_mode in falloc full; do + echo + echo "--- growth_mode=3D$growth_mode ---" + + # Maybe we want to do an lseek() to the end of the file before the + # preallocation; if the file has a length of 2 GB, that would + # return an integer that overflows to negative when put into a + # plain int. We should use the correct type for the result, and + # this tests we do. + + _make_test_img 2G + $QEMU_IMG resize -f "$IMGFMT" --preallocation=3D$growth_mode "$TEST_IM= G" +${GROWTH_SIZE}K + + actual_size=3D$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk s= ize') + actual_size=3D$(echo "$actual_size" | sed -e 's/^[^0-9]*\([0-9]\+\).*$= /\1/') + + if [ $actual_size -lt $GROWTH_SIZE ]; then + echo "ERROR: Image should have at least ${GROWTH_SIZE}K, but has $= {actual_size}K" + fi +done + # success, all done echo '*** done' rm -f $seq.full diff --git a/tests/qemu-iotests/106.out b/tests/qemu-iotests/106.out index 0a42312301..c459957660 100644 --- a/tests/qemu-iotests/106.out +++ b/tests/qemu-iotests/106.out @@ -47,4 +47,14 @@ qemu-img: Preallocation can only be used for growing ima= ges =20 --- growth_mode=3Doff --- Image resized. + +=3D=3D=3D Testing image growth on 2G empty image =3D=3D=3D + +--- growth_mode=3Dfalloc --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2147483648 +Image resized. + +--- growth_mode=3Dfull --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2147483648 +Image resized. *** done --=20 2.11.0