Re: [Qemu-devel] [PATCH V3 7/7] qemu-iotests: add test for qcow2 snapshot

2013-10-14 Thread Wenchao Xia

于 2013/10/1 6:28, Eric Blake 写道:

On 09/08/2013 08:58 PM, Wenchao Xia wrote:

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 Xiaxiaw...@linux.vnet.ibm.com
---
  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

+# 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

Not all platforms have errno 5 tied to EIO; but then again, you filtered
this test to run only on Linux.  Is it possible to be a bit more
generic, though?

  I think the test can be made more generic, but it is a bit hard for 
me to find out
what number should be used on all platform now. Instead, I'd like to add 
a comments

here:bind the errno correctly if you want run this case on other platform.


At any rate, more tests are always good.  I didn't read very closely;
but I also didn't see anything obviously wrong with the patch, and it is
self-validating whether the testsuite still passes after applying it.
So feel free to add:

Reviewed-by: Eric Blakeebl...@redhat.com






Re: [Qemu-devel] [PATCH V3 7/7] qemu-iotests: add test for qcow2 snapshot

2013-09-30 Thread Eric Blake
On 09/08/2013 08:58 PM, Wenchao Xia wrote:
 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 xiaw...@linux.vnet.ibm.com
 ---
  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
 

 +# 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

Not all platforms have errno 5 tied to EIO; but then again, you filtered
this test to run only on Linux.  Is it possible to be a bit more
generic, though?

At any rate, more tests are always good.  I didn't read very closely;
but I also didn't see anything obviously wrong with the patch, and it is
self-validating whether the testsuite still passes after applying it.
So feel free to add:

Reviewed-by: Eric Blake ebl...@redhat.com

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH V3 7/7] qemu-iotests: add test for qcow2 snapshot

2013-09-08 Thread Wenchao Xia
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 xiaw...@linux.vnet.ibm.com
---
 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 000..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 http://www.gnu.org/licenses/.
+#
+owner=xiaw...@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 EOF
+[inject-error]
+event = cluster_alloc
+errno = $errno
+immediately = $imm
+once = $once
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l $TEST_IMG
+_check_test_img 21
+
+
+# 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 EOF
+[inject-error]
+event = snapshot_l1_update
+errno = $errno
+immediately = $imm
+once = $once
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l $TEST_IMG
+_check_test_img 21
+
+# 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 EOF
+[inject-error]
+event = refblock_alloc
+errno = $errno
+immediately = $imm
+once = $once
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l $TEST_IMG
+_check_test_img 21
+
+# 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 EOF
+[set-state]
+state = 1
+event = cluster_alloc
+new_state = 2
+
+[inject-error]
+state = 2
+event = cluster_alloc
+errno = $errno
+immediately = $imm
+once = $once
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l $TEST_IMG
+_check_test_img 21
+
+# 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 EOF
+[set-state]
+state = 1
+event = cluster_alloc
+new_state = 2
+
+[set-state]
+state = 2
+event = cluster_alloc
+new_state = 3
+
+[inject-error]
+state = 3
+event = flush_to_os
+errno = $errno
+immediately = $imm
+once = $once
+
+[set-state]
+state = 3
+event = flush_to_os
+new_state = 4
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l $TEST_IMG
+_check_test_img 21
+
+# 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 EOF
+[inject-error]
+event = snapshot_list_update
+errno = $errno
+immediately = $imm
+once = $once
+EOF
+
+$QEMU_IMG snapshot -c snap1 $BLKDBG_TEST_IMG
+$QEMU_IMG snapshot -l