From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrnqV-00071s-Co for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:02:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrnqP-0004sY-Ei for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:01:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrnqP-0004sS-7j for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:01:49 -0500 Message-ID: <546F37B7.2080800@redhat.com> Date: Fri, 21 Nov 2014 14:01:43 +0100 From: Max Reitz MIME-Version: 1.0 References: <1414336849-21179-1-git-send-email-junmuzi@gmail.com> <1414336849-21179-4-git-send-email-junmuzi@gmail.com> In-Reply-To: <1414336849-21179-4-git-send-email-junmuzi@gmail.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 3/3] qcow2: Add qemu-iotests for qcow2 shrinking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Li , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, juli@redhat.com, stefanha@redhat.com On 2014-10-26 at 16:20, Jun Li wrote: > Add qemu-iotests for qcow2 shrinking. > e.g: > $ ./check -qcow2 110 > > Signed-off-by: Jun Li > --- > tests/qemu-iotests/110 | 76 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/110.out | 13 ++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 90 insertions(+) > create mode 100755 tests/qemu-iotests/110 > create mode 100644 tests/qemu-iotests/110.out > > diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110 > new file mode 100755 > index 0000000..c2145a2 > --- /dev/null > +++ b/tests/qemu-iotests/110 > @@ -0,0 +1,76 @@ > +#!/bin/bash > +# > +# Tests qcow2 shrinking > +# > +# Copyright (C) 2014 Jun Li (junmuzi@gmail.com) > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > +# > + > +# creator > +owner=junmuzi@gmail.com > + > +seq="$(basename $0)" > +echo "QA output created by $seq" > + > +here="$PWD" > +tmp=/tmp/$$ > +status=1 # failure is the default! > + > +_cleanup() > +{ > + _cleanup_test_img > +} > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +# get standard environment, filters and checks > +. ./common.rc > +. ./common.filter > +. ./common.pattern > + > +_supported_fmt qcow2 > +_supported_proto file > +_supported_os Linux > + > + > +# Setup test basic parameters > +IMG_SIZE=500M > +CLUSTER_SIZE=64k > + > +echo > +echo '=== Test qcow2 shrinking ===' > +echo > + > +_make_test_img $IMG_SIZE > +io_pattern write 0 500M 65536 1 110 > +#cp $TEST_IMG /tmp/before-resized.img This line should be removed. > + > +# shrinking image > +$QEMU_IMG resize "$TEST_IMG" -10M > + > +_check_test_img Just testing whether the image is consistent is not enough. Please try to read the pattern back ("io_pattern read 0 490M 65536 1 110") to compare whether the data is still there. > + > +# shrinking image > +$QEMU_IMG resize "$TEST_IMG" -100M > +#cp $TEST_IMG /tmp/resized.img This line should be removed, too. > + > +_check_test_img And here should be another "io_pattern read 0 390M 65536 1 110". Max > + > +# success, all done > +echo "*** done" > + > +# Cleanup > +_cleanup_test_img > + > +status=0 > diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out > new file mode 100644 > index 0000000..e54388b > --- /dev/null > +++ b/tests/qemu-iotests/110.out > @@ -0,0 +1,13 @@ > +QA output created by 110 > + > +=== Test qcow2 shrinking === > + > +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=524288000 > +=== IO: pattern 110 > +wrote 524288000/524288000 bytes at offset 0 > +500 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +Image resized. > +No errors were found on the image. > +Image resized. > +No errors were found on the image. > +*** done > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 9bbd5d3..de467ff 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -109,3 +109,4 @@ > 105 rw auto quick > 107 rw auto quick > 108 rw auto quick > +110 rw auto quick