qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Jun Li <junmuzi@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, juli@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 3/3] qcow2: Add qemu-iotests for qcow2 shrinking
Date: Fri, 21 Nov 2014 14:01:43 +0100	[thread overview]
Message-ID: <546F37B7.2080800@redhat.com> (raw)
In-Reply-To: <1414336849-21179-4-git-send-email-junmuzi@gmail.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 <junmuzi@gmail.com>
> ---
>   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 <http://www.gnu.org/licenses/>.
> +#
> +
> +# 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

  reply	other threads:[~2014-11-21 13:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 15:20 [Qemu-devel] [PATCH v5 0/3] qcow2: Patch for shrinking qcow2 disk image Jun Li
2014-10-26 15:20 ` [Qemu-devel] [PATCH v5 1/3] qcow2: Add qcow2_shrink_l1_and_l2_table for qcow2 shrinking Jun Li
2014-11-21 10:56   ` Max Reitz
2014-11-24 17:49     ` Eric Blake
2015-01-03 12:23     ` Jun Li
2015-01-15 18:47       ` Max Reitz
2015-01-19 13:16         ` Jun Li
2015-01-22 19:14           ` Max Reitz
2015-01-27 14:06             ` Jun Li
2014-10-26 15:20 ` [Qemu-devel] [PATCH v5 2/3] qcow2: add update refcount table realization for update_refcount Jun Li
2014-11-21 12:41   ` Max Reitz
2014-11-24 18:11     ` Eric Blake
2014-10-26 15:20 ` [Qemu-devel] [PATCH v5 3/3] qcow2: Add qemu-iotests for qcow2 shrinking Jun Li
2014-11-21 13:01   ` Max Reitz [this message]
2014-11-10  8:36 ` [Qemu-devel] [PATCH v5 0/3] qcow2: Patch for shrinking qcow2 disk image Jun Li
2014-11-10  9:17   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546F37B7.2080800@redhat.com \
    --to=mreitz@redhat.com \
    --cc=famz@redhat.com \
    --cc=juli@redhat.com \
    --cc=junmuzi@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).