From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPdH-0007ya-6D for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiPdB-0005y0-JN for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:27 -0400 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]:38231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPdA-0005xU-Qo for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:21 -0400 Received: by mail-pa0-f51.google.com with SMTP id kq14so1446193pab.38 for ; Sun, 26 Oct 2014 08:21:16 -0700 (PDT) From: Jun Li Date: Sun, 26 Oct 2014 23:20:49 +0800 Message-Id: <1414336849-21179-4-git-send-email-junmuzi@gmail.com> In-Reply-To: <1414336849-21179-1-git-send-email-junmuzi@gmail.com> References: <1414336849-21179-1-git-send-email-junmuzi@gmail.com> Subject: [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: qemu-devel@nongnu.org Cc: kwolf@redhat.com, juli@redhat.com, famz@redhat.com, Jun Li , stefanha@redhat.com 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 + +# shrinking image +$QEMU_IMG resize "$TEST_IMG" -10M + +_check_test_img + +# shrinking image +$QEMU_IMG resize "$TEST_IMG" -100M +#cp $TEST_IMG /tmp/resized.img + +_check_test_img + +# 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 -- 1.9.3