From patchwork Tue Jan 26 10:38:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8120191 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB6EEBEEE5 for ; Tue, 26 Jan 2016 10:47:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1B412025B for ; Tue, 26 Jan 2016 10:47:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7324F20166 for ; Tue, 26 Jan 2016 10:47:49 +0000 (UTC) Received: from localhost ([::1]:43003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO1A4-0005YW-TY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Jan 2016 05:47:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO13R-00006a-Lr for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:40:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO13Q-0007gj-9h for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO13N-0007gF-10; Tue, 26 Jan 2016 05:40:53 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 9ED2949DC4; Tue, 26 Jan 2016 10:40:52 +0000 (UTC) Received: from fam-t430.redhat.com (vpn1-5-65.pek2.redhat.com [10.72.5.65]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0QAcRTQ016464; Tue, 26 Jan 2016 05:40:44 -0500 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 26 Jan 2016 18:38:24 +0800 Message-Id: <1453804705-7205-16-git-send-email-famz@redhat.com> In-Reply-To: <1453804705-7205-1-git-send-email-famz@redhat.com> References: <1453804705-7205-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, jsnow@redhat.com, Markus Armbruster , mreitz@redhat.com, vsementsov@parallels.com, Stefan Hajnoczi Subject: [Qemu-devel] [RFC PATCH 15/16] iotests: Add qbm specific test case 140 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Fam Zheng --- tests/qemu-iotests/140 | 80 +++++++++++++++++++++++++ tests/qemu-iotests/140.out | 145 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/common | 6 ++ tests/qemu-iotests/group | 1 + 4 files changed, 232 insertions(+) create mode 100755 tests/qemu-iotests/140 create mode 100644 tests/qemu-iotests/140.out diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 new file mode 100755 index 0000000..e5c3c56 --- /dev/null +++ b/tests/qemu-iotests/140 @@ -0,0 +1,80 @@ +#!/bin/bash +# +# General tests for QBM format +# +# Copyright (C) 2015 Red Hat, Inc. +# +# 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=famz@redhat.com + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + return + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qbm +_supported_proto file +_supported_os Linux + +size=128M + +echo +echo "=== Create a QBM file with no option ===" +_make_test_img $size +_img_info +cat $TEST_IMG + +for n in 0 1 3; do + echo + echo "=== Create a QBM file with $n dirty bitmap(s) ===" + echo + _make_test_img -o dirty-bitmaps=$n $size + _img_info + cat $TEST_IMG +done + + +$QEMU_IMG map $TEST_IMG + +echo +echo "=== Create a QBM file with raw backing image ===" +IMGFMT=raw TEST_IMG=$TEST_IMG.base _make_test_img $size +$QEMU_IO_PROG -f raw $TEST_IMG.base -c "write 0 $size" | _filter_qemu_io +_make_test_img -o dirty-bitmaps=1 -b $TEST_IMG.base +cat $TEST_IMG +_img_info + +$QEMU_IO $TEST_IMG -c "write 130560 131072" | _filter_qemu_io +$QEMU_IMG map $TEST_IMG + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out new file mode 100644 index 0000000..1d9cefb --- /dev/null +++ b/tests/qemu-iotests/140.out @@ -0,0 +1,145 @@ +QA output created by 140 + +=== Create a QBM file with no option === +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 128M (134217728 bytes) +cluster_size: 512 +{ + "QBM": { + "bitmaps": { + }, + "image": { + "format": "raw", + "file": "t-data.img.qbm" + }, + "version": 1, + "creator": "QEMU" + } +} + +=== Create a QBM file with 0 dirty bitmap(s) === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 dirty-bitmaps=0 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 128M (134217728 bytes) +cluster_size: 512 +{ + "QBM": { + "bitmaps": { + }, + "image": { + "format": "raw", + "file": "t-data.img.qbm" + }, + "version": 1, + "creator": "QEMU" + } +} + +=== Create a QBM file with 1 dirty bitmap(s) === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 dirty-bitmaps=1 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 128M (134217728 bytes) +cluster_size: 512 +{ + "QBM": { + "bitmaps": { + "dirty.0": { + "granularity-bytes": 65536, + "type": "dirty", + "file": "t-dirty.0.bitmap.qbm" + } + }, + "image": { + "format": "raw", + "file": "t-data.img.qbm" + }, + "version": 1, + "creator": "QEMU" + } +} + +=== Create a QBM file with 3 dirty bitmap(s) === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 dirty-bitmaps=3 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 128M (134217728 bytes) +cluster_size: 512 +{ + "QBM": { + "bitmaps": { + "dirty.1": { + "granularity-bytes": 65536, + "type": "dirty", + "file": "t-dirty.1.bitmap.qbm" + }, + "dirty.2": { + "granularity-bytes": 65536, + "type": "dirty", + "file": "t-dirty.2.bitmap.qbm" + }, + "dirty.0": { + "granularity-bytes": 65536, + "type": "dirty", + "file": "t-dirty.0.bitmap.qbm" + } + }, + "image": { + "format": "raw", + "file": "t-data.img.qbm" + }, + "version": 1, + "creator": "QEMU" + } +} +Offset Length Mapped to File + +=== Create a QBM file with raw backing image === +Formatting 'TEST_DIR/t.qbm.base', fmt=IMGFMT size=134217728 +wrote 134217728/134217728 bytes at offset 0 +128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base dirty-bitmaps=1 +{ + "QBM": { + "bitmaps": { + "allocation": { + "granularity-bytes": 65536, + "backing": { + "format": "", + "file": "/home/fam/build/last/tests/qemu-iotests/scratch/t.qbm.base" + }, + "type": "allocation", + "file": "t-allocation.bitmap.qbm" + }, + "dirty.0": { + "granularity-bytes": 65536, + "type": "dirty", + "file": "t-dirty.0.bitmap.qbm" + } + }, + "image": { + "format": "raw", + "file": "t-data.img.qbm" + }, + "version": 1, + "creator": "QEMU" + } +} +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 128M (134217728 bytes) +cluster_size: 65536 +backing file: TEST_DIR/t.IMGFMT.base +wrote 131072/131072 bytes at offset 130560 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length Mapped to File +0 0x10000 0 /home/fam/build/last/tests/qemu-iotests/scratch/t.qbm.base +0x10000 0x30000 0x10000 /home/fam/build/last/tests/qemu-iotests/scratch/t-data.img.qbm +0x40000 0x7fc0000 0x40000 /home/fam/build/last/tests/qemu-iotests/scratch/t.qbm.base +*** done diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index ff84f4b..868a5d1 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -148,6 +148,7 @@ check options -vpc test vpc -vhdx test vhdx -vmdk test vmdk + -rbm test qbm -file test file (default) -rbd test rbd -sheepdog test sheepdog @@ -221,6 +222,11 @@ testlist options xpand=false ;; + -qbm) + IMGFMT=qbm + xpand=false + ;; + -vpc) IMGFMT=vpc xpand=false diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index d6e9219..e220a00 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -141,4 +141,5 @@ 137 rw auto 138 rw auto quick 139 rw auto quick +140 rw auto quick 142 auto