From patchwork Mon Sep 9 02:58:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 273476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7047C2C0126 for ; Mon, 9 Sep 2013 13:02:43 +1000 (EST) Received: from localhost ([::1]:47419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIrkP-00037G-CG for incoming@patchwork.ozlabs.org; Sun, 08 Sep 2013 23:02:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIrgS-0005V6-Fl for qemu-devel@nongnu.org; Sun, 08 Sep 2013 22:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VIrgE-0000in-2h for qemu-devel@nongnu.org; Sun, 08 Sep 2013 22:58:36 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:41860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIrgD-0000hy-Gg for qemu-devel@nongnu.org; Sun, 08 Sep 2013 22:58:22 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Sep 2013 08:16:29 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp08.in.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 9 Sep 2013 08:16:28 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id CE603E004F for ; Mon, 9 Sep 2013 08:29:05 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r892wFCP43516022 for ; Mon, 9 Sep 2013 08:28:15 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r892wGKf008064 for ; Mon, 9 Sep 2013 08:28:17 +0530 Received: from RH64wenchao ([9.181.129.59]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r892w6dp007807; Mon, 9 Sep 2013 08:28:15 +0530 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Mon, 9 Sep 2013 10:58:02 +0800 Message-Id: <1378695482-29805-8-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1378695482-29805-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1378695482-29805-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13090902-2000-0000-0000-00000DA48A4D X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.8 Cc: kwolf@redhat.com, pbonzini@redhat.com, mreitz@redhat.com, Wenchao Xia , stefanha@gmail.com Subject: [Qemu-devel] [PATCH V3 7/7] qemu-iotests: add test for qcow2 snapshot 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This test will focus on the low level procedure of qcow2 snapshot operations, now it covers only the create operation. Overlap error paths are not checked since no good way to trigger those errors. Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake --- tests/qemu-iotests/063 | 229 ++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/063.out | 37 +++++++ tests/qemu-iotests/group | 1 + 3 files changed, 267 insertions(+), 0 deletions(-) create mode 100755 tests/qemu-iotests/063 create mode 100644 tests/qemu-iotests/063.out diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063 new file mode 100755 index 0000000..f3f6e16 --- /dev/null +++ b/tests/qemu-iotests/063 @@ -0,0 +1,229 @@ +#!/bin/bash +# +# qcow2 internal snapshot test +# +# Copyright (C) 2013 IBM, 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 . +# +owner=xiawenc@linux.vnet.ibm.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + rm $TEST_DIR/blkdebug.conf +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# only test qcow2 +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +IMGOPTS="compat=1.1" + +CLUSTER_SIZE=65536 + +SIZE=1G + +BLKDBG_TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG" + +errno=5 + +once=on + +imm=off + + +# Start test, note that the injected errors are related to qcow2's snapshot +# logic closely, see qcow2-snapshot.c for more details. + +# path 1: fail in L1 table allocation for snapshot +echo +echo "Path 1: fail in allocation of L1 table" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + + +# path 2: fail in update new L1 table +echo +echo "Path 2: fail in overlap check before update L1 table for snapshot" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 3: fail in update refcount block before write snapshot list +echo +echo "Path 3: fail in update refcount block before write snapshot list" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 4: fail in snapshot list allocation, it is possible +# qcow2_alloc_clusters() not fail immediately since cache hit, but in any +# case, no error should be found in image check. +echo +echo "Path 4: fail in snapshot list allocation" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 5: fail in flush after snapshot list allocation, flush is related with +# cache status, if no cache available then the flush may not trigger a error +# in bdrv_flush(), but no error should be found in image check. +echo +echo "Path 5: fail in flush after snapshot list allocation" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 6: fail in snapshot list update +echo +echo "Path 6: fail in snapshot list update" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 7: fail in flush after snapshot list update, no good way to trigger it, +# since the cache is empty and makes flush do nothing in that call, so leave +# this path not tested + +# path 8: fail in update qcow2 header +echo +echo "Path 8: fail in update qcow2 header" + +_make_test_img $SIZE + +cat > $TEST_DIR/blkdebug.conf <&1 + +# path 9: fail in overlap check before update L1 table for snapshot +# path 10: fail in overlap check before update snapshot list +# Since those clusters are allocated at runtime, there is no good way to +# make them overlap in this script, so skip those two paths now. + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/063.out b/tests/qemu-iotests/063.out new file mode 100644 index 0000000..c387bfa --- /dev/null +++ b/tests/qemu-iotests/063.out @@ -0,0 +1,37 @@ +QA output created by 063 + +Path 1: fail in allocation of L1 table +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 2: fail in overlap check before update L1 table for snapshot +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 3: fail in update refcount block before write snapshot list +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 4: fail in snapshot list allocation +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 5: fail in flush after snapshot list allocation +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 6: fail in snapshot list update +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. + +Path 8: fail in update qcow2 header +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +qemu-img: Could not create snapshot 'snap1': -5 (Input/output error) +No errors were found on the image. +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index b696242..316b1dd 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -66,3 +66,4 @@ 059 rw auto 060 rw auto 062 rw auto +063 rw auto