qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback"
@ 2013-12-04  1:06 Fam Zheng
  2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

This series adds cache mode option in the iotests framework. Test cases are
updated to make use of cache mode and mask supported modes.

v6: [05] Recover disappeared two lines. (Benoît)
    Added Wenchao's reviewed-by lines to other patches.

v5: Fix help test for "-c mode". (Wenchao)

v4: Address Stefan's comments:
    Add _default_cache_mode.
    Split last two cases in 048 to 074.
    Use long option "--cache" instead of "-t" for qemu-io.

v3: Change _unsupported_qemu_io_options to _supported_cache_modes.
    Change default mode to "writeback".
    Clean up some whitespaces in the end of series.
    Fix "026.out.nocache" case.
    Fix 048 case on tmpfs.


Fam Zheng (6):
  qemu-iotests: Add "-c <cache-mode>" option
  qemu-iotests: Honour cache mode in iotests.py
  qemu-iotests: Add _default_cache_mode and _supported_cache_modes
  qemu-iotests: Change default cache mode to "writeback"
  qemu-iotests: Clean up spaces in usage output
  qemu-iotests: Split qcow2 only cases in 048

 tests/qemu-iotests/026        |  3 +-
 tests/qemu-iotests/039        |  3 +-
 tests/qemu-iotests/048        | 27 --------------
 tests/qemu-iotests/048.out    | 16 --------
 tests/qemu-iotests/052        |  4 +-
 tests/qemu-iotests/074        | 86 +++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/074.out    | 18 +++++++++
 tests/qemu-iotests/check      |  2 +-
 tests/qemu-iotests/common     | 37 ++++++++++++++-----
 tests/qemu-iotests/common.rc  | 25 ++++++++-----
 tests/qemu-iotests/iotests.py |  3 +-
 11 files changed, 155 insertions(+), 69 deletions(-)
 create mode 100644 tests/qemu-iotests/074
 create mode 100644 tests/qemu-iotests/074.out

-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 1/6] qemu-iotests: Add "-c <cache-mode>" option
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
@ 2013-12-04  1:06 ` Fam Zheng
  2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

The option sets cache mode used in the tests. "-nocache" is changed to
an alias to "-c none", and internally passes "-t none" to qemu-io.

Python scripts will make use of option this in the next commit.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/qemu-iotests/check  |  2 +-
 tests/qemu-iotests/common | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index f5f328f..dc0105c 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -242,7 +242,7 @@ do
             fi
 
             reference=$seq.out
-            if (echo $QEMU_IO_OPTIONS | grep -s -- '--nocache' > /dev/null); then
+            if [ "$CACHEMODE" = "none" ]; then
                 [ -f $seq.out.nocache ] && reference=$seq.out.nocache
             fi
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 8cde7f1..4743c9e 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -42,13 +42,16 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+cachemode=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 export IMGFMT=raw
 export IMGFMT_GENERIC=true
 export IMGPROTO=file
 export IMGOPTS=""
+export CACHEMODE="writethrough"
 export QEMU_IO_OPTIONS=""
+export CACHEMODE_IS_DEFAULT=true
 
 for r
 do
@@ -113,7 +116,12 @@ s/ .*//p
         IMGOPTS="$r"
         imgopts=false
         continue
-
+    elif $cachemode
+    then
+        CACHEMODE="$r"
+        CACHEMODE_IS_DEFAULT=false
+        cachemode=false
+        continue
     fi
 
     xpand=true
@@ -147,6 +155,7 @@ check options
     -o options          -o options to pass to qemu-img create/convert
     -T                        output timestamps
     -r                         randomize test order
+    -c mode             cache mode
 
 testlist options
     -g group[,group...]        include tests from these groups
@@ -219,7 +228,8 @@ testlist options
             xpand=false
             ;;
         -nocache)
-            QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache"
+            CACHEMODE="none"
+            CACHEMODE_IS_DEFAULT=false
             xpand=false
             ;;
 
@@ -258,6 +268,10 @@ testlist options
             imgopts=true
             xpand=false
             ;;
+        -c)
+            cachemode=true
+            xpand=false
+            ;;
         -r)        # randomize test order
             randomize=true
             xpand=false
@@ -334,6 +348,9 @@ BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
 
 done
 
+# Set qemu-io cache mode with $CACHEMODE we have
+QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
+
 # Set default options for qemu-img create -o if they were not specified
 _set_default_imgopts
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 2/6] qemu-iotests: Honour cache mode in iotests.py
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
  2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
@ 2013-12-04  1:06 ` Fam Zheng
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

This will allow overriding cache mode from the "-c mode" option.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/qemu-iotests/iotests.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index fb10ff4..c84a1a5 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -37,6 +37,7 @@ qemu_args = os.environ.get('QEMU', 'qemu').strip().split(' ')
 imgfmt = os.environ.get('IMGFMT', 'raw')
 imgproto = os.environ.get('IMGPROTO', 'file')
 test_dir = os.environ.get('TEST_DIR', '/var/tmp')
+cachemode = os.environ.get('CACHEMODE')
 
 socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
 
@@ -96,7 +97,7 @@ class VM(object):
         '''Add a virtio-blk drive to the VM'''
         options = ['if=virtio',
                    'format=%s' % imgfmt,
-                   'cache=none',
+                   'cache=%s' % cachemode,
                    'file=%s' % path,
                    'id=drive%d' % self._num_drives]
         if opts:
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
  2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
  2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
@ 2013-12-04  1:07 ` Fam Zheng
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

This replaces _unsupported_qemu_io_options and check for support of
current cache mode, and allow to provide a default if user didn't
specify.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/qemu-iotests/026       |  3 ++-
 tests/qemu-iotests/039       |  3 ++-
 tests/qemu-iotests/052       |  4 ++--
 tests/qemu-iotests/common.rc | 25 +++++++++++++++----------
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index ebe29d0..c9c5f83 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 _supported_os Linux
-
+_default_cache_mode "writethrough"
+_supported_cache_modes "writethrough" "none"
 
 echo "Errors while writing 128 kB"
 echo
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index 8bade92..6abf472 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 _supported_os Linux
-_unsupported_qemu_io_options --nocache
+_default_cache_mode "writethrough"
+_supported_cache_modes "writethrough"
 
 size=128M
 
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index f5f9683..4d4e411 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -41,8 +41,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt generic
 _supported_proto generic
 _supported_os Linux
-_unsupported_qemu_io_options --nocache
-
+_default_cache_mode "writethrough"
+_supported_cache_modes "writethrough"
 
 size=128M
 _make_test_img $size
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 7f62457..47cef6d 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -387,18 +387,23 @@ _supported_os()
     _notrun "not suitable for this OS: $HOSTOS"
 }
 
-_unsupported_qemu_io_options()
+_supported_cache_modes()
 {
-    for bad_opt
-    do
-        for opt in $QEMU_IO_OPTIONS
-        do
-            if [ "$bad_opt" = "$opt" ]
-            then
-                _notrun "not suitable for qemu-io option: $bad_opt"
-            fi
-        done
+    for mode; do
+        if [ "$mode" = "$CACHEMODE" ]; then
+            return
+        fi
     done
+    _notrun "not suitable for cache mode: $CACHEMODE"
+}
+
+_default_cache_mode()
+{
+    if $CACHEMODE_IS_DEFAULT; then
+        CACHEMODE="$1"
+        QEMU_IO="$QEMU_IO --cache $1"
+        return
+    fi
 }
 
 # this test requires that a specified command (executable) exists
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 4/6] qemu-iotests: Change default cache mode to "writeback"
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
                   ` (2 preceding siblings ...)
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
@ 2013-12-04  1:07 ` Fam Zheng
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

So that the tests can run faster.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/qemu-iotests/common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 4743c9e..b2a0944 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -49,7 +49,7 @@ export IMGFMT=raw
 export IMGFMT_GENERIC=true
 export IMGPROTO=file
 export IMGOPTS=""
-export CACHEMODE="writethrough"
+export CACHEMODE="writeback"
 export QEMU_IO_OPTIONS=""
 export CACHEMODE_IS_DEFAULT=true
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
                   ` (3 preceding siblings ...)
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
@ 2013-12-04  1:07 ` Fam Zheng
  2013-12-04  5:24   ` Benoît Canet
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
  2013-12-04 13:30 ` [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Stefan Hajnoczi
  6 siblings, 1 reply; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

Whitespace changes to align columns.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/common | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index b2a0944..8b4e22c 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -132,7 +132,7 @@ s/ .*//p
             echo "Usage: $0 [options] [testlist]"'
 
 common options
-    -v                        verbose
+    -v                  verbose
 
 check options
     -raw                test raw (default)
@@ -148,20 +148,20 @@ check options
     -sheepdog           test sheepdog
     -nbd                test nbd
     -ssh                test ssh
-    -xdiff                graphical mode diff
-    -nocache                use O_DIRECT on backing file
-    -misalign                misalign memory allocations
-    -n                        show me, do not run tests
+    -xdiff              graphical mode diff
+    -nocache            use O_DIRECT on backing file
+    -misalign           misalign memory allocations
+    -n                  show me, do not run tests
     -o options          -o options to pass to qemu-img create/convert
-    -T                        output timestamps
-    -r                         randomize test order
+    -T                  output timestamps
+    -r                  randomize test order
     -c mode             cache mode
 
 testlist options
     -g group[,group...]        include tests from these groups
     -x group[,group...]        exclude tests from these groups
     NNN                        include test NNN
-    NNN-NNN                include test range (eg. 012-021)
+    NNN-NNN                    include test range (eg. 012-021)
 '
             exit 0
             ;;
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH v6 6/6] qemu-iotests: Split qcow2 only cases in 048
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
                   ` (4 preceding siblings ...)
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
@ 2013-12-04  1:07 ` Fam Zheng
  2013-12-04 12:45   ` [Qemu-devel] [PATCH] qemu-iotests: 074 fixups Stefan Hajnoczi
  2013-12-04 13:30 ` [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Stefan Hajnoczi
  6 siblings, 1 reply; 11+ messages in thread
From: Fam Zheng @ 2013-12-04  1:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, WenchaoXia, stefanha

Format "raw" doesn't always work on certain file systems (e.g. tmpfs).
Use qcow2 to make the allocation status explicit and split into a new
case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/qemu-iotests/048     | 27 ---------------
 tests/qemu-iotests/048.out | 16 ---------
 tests/qemu-iotests/074     | 86 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/074.out | 18 ++++++++++
 4 files changed, 104 insertions(+), 43 deletions(-)
 create mode 100644 tests/qemu-iotests/074
 create mode 100644 tests/qemu-iotests/074.out

diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
index 9def7fc..65da46d 100755
--- a/tests/qemu-iotests/048
+++ b/tests/qemu-iotests/048
@@ -81,32 +81,5 @@ cp "$TEST_IMG" "$TEST_IMG2"
 io_pattern write 512 512 0 1 101
 _compare
 
-# Test cluster allocated in one, with IO error
-cat > "$TEST_DIR/blkdebug.conf"<<EOF
-[inject-error]
-event = "read_aio"
-errno = "5"
-once ="off"
-EOF
-_make_test_img $size
-cp "$TEST_IMG" "$TEST_IMG2"
-io_pattern write 512 512 0 1 102
-TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG" _compare 2>&1 |\
-    _filter_testdir | _filter_imgfmt
-
-# Test cluster allocated in one, with different sizes and IO error in the part
-# that exists only in one image
-cat > "$TEST_DIR/blkdebug.conf"<<EOF
-[inject-error]
-event = "read_aio"
-errno = "5"
-once ="off"
-EOF
-_make_test_img $size
-TEST_IMG="$TEST_IMG2" _make_test_img 0
-io_pattern write 512 512 0 1 102
-TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG" _compare 2>&1 |\
-    _filter_testdir | _filter_imgfmt
-
 # Cleanup
 status=0
diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
index d141e05..1aea6eb 100644
--- a/tests/qemu-iotests/048.out
+++ b/tests/qemu-iotests/048.out
@@ -37,20 +37,4 @@ qemu-io> wrote 512/512 bytes at offset 512
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> Content mismatch at offset 512!
 1
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
-=== IO: pattern 102
-qemu-io> wrote 512/512 bytes at offset 512
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
-qemu-img: Error while reading offset 0: Input/output error
-4
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
-Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=0 
-=== IO: pattern 102
-qemu-io> wrote 512/512 bytes at offset 512
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
-qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
-Warning: Image size mismatch!
-4
 Cleanup
diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
new file mode 100644
index 0000000..aba126c
--- /dev/null
+++ b/tests/qemu-iotests/074
@@ -0,0 +1,86 @@
+#!/bin/bash
+##
+## qemu-img compare test (qcow2 only ones)
+##
+##
+## Copyright (C) 2013 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 <http://www.gnu.org/licenses/>.
+##
+#
+# creator
+owner=famz@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+status=1        # failure is the default!
+
+_cleanup()
+{
+    echo "Cleanup"
+    _cleanup_test_img
+    rm "${TEST_IMG2}"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_compare()
+{
+    $QEMU_IMG compare "$@" "$TEST_IMG" "${TEST_IMG2}"
+    echo $?
+}
+
+# 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
+TEST_IMG2=$TEST_IMG.2
+CLUSTER_SIZE=4096
+size=1024M
+
+# Test cluster allocated in one, with IO error
+cat > "$TEST_DIR/blkdebug.conf"<<EOF
+[inject-error]
+event = "read_aio"
+errno = "5"
+once ="off"
+EOF
+_make_test_img $size
+cp "$TEST_IMG" "$TEST_IMG2"
+io_pattern write 512 512 0 1 102
+TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG" _compare 2>&1 |\
+    _filter_testdir | _filter_imgfmt
+
+# Test cluster allocated in one, with different sizes and IO error in the part
+# that exists only in one image
+cat > "$TEST_DIR/blkdebug.conf"<<EOF
+[inject-error]
+event = "read_aio"
+errno = "5"
+once ="off"
+EOF
+_make_test_img $size
+TEST_IMG="$TEST_IMG2" _make_test_img 0
+io_pattern write 512 512 0 1 102
+TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG" _compare 2>&1 |\
+    _filter_testdir | _filter_imgfmt
+
+# Cleanup
+status=0
diff --git a/tests/qemu-iotests/074.out b/tests/qemu-iotests/074.out
new file mode 100644
index 0000000..3deb594
--- /dev/null
+++ b/tests/qemu-iotests/074.out
@@ -0,0 +1,18 @@
+QA output created by 048
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+=== IO: pattern 102
+qemu-io> wrote 512/512 bytes at offset 512
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
+qemu-img: Error while reading offset 0: Input/output error
+4
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=0
+=== IO: pattern 102
+qemu-io> wrote 512/512 bytes at offset 512
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
+qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
+Warning: Image size mismatch!
+4
+Cleanup
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
@ 2013-12-04  5:24   ` Benoît Canet
  0 siblings, 0 replies; 11+ messages in thread
From: Benoît Canet @ 2013-12-04  5:24 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, Benoît Canet, qemu-devel, stefanha, WenchaoXia

Le Wednesday 04 Dec 2013 à 09:07:02 (+0800), Fam Zheng a écrit :
> Whitespace changes to align columns.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/qemu-iotests/common | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index b2a0944..8b4e22c 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -132,7 +132,7 @@ s/ .*//p
>              echo "Usage: $0 [options] [testlist]"'
>  
>  common options
> -    -v                        verbose
> +    -v                  verbose
>  
>  check options
>      -raw                test raw (default)
> @@ -148,20 +148,20 @@ check options
>      -sheepdog           test sheepdog
>      -nbd                test nbd
>      -ssh                test ssh
> -    -xdiff                graphical mode diff
> -    -nocache                use O_DIRECT on backing file
> -    -misalign                misalign memory allocations
> -    -n                        show me, do not run tests
> +    -xdiff              graphical mode diff
> +    -nocache            use O_DIRECT on backing file
> +    -misalign           misalign memory allocations
> +    -n                  show me, do not run tests
>      -o options          -o options to pass to qemu-img create/convert
> -    -T                        output timestamps
> -    -r                         randomize test order
> +    -T                  output timestamps
> +    -r                  randomize test order
>      -c mode             cache mode
>  
>  testlist options
>      -g group[,group...]        include tests from these groups
>      -x group[,group...]        exclude tests from these groups
>      NNN                        include test NNN
> -    NNN-NNN                include test range (eg. 012-021)
> +    NNN-NNN                    include test range (eg. 012-021)
>  '
>              exit 0
>              ;;
> -- 
> 1.8.4.2
> 

First time I found a bug while reviewing !!

Reviewed-by: Benoit Canet <benoit@irqsave.net>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH] qemu-iotests: 074 fixups
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
@ 2013-12-04 12:45   ` Stefan Hajnoczi
  2013-12-04 12:52     ` Fam Zheng
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Hajnoczi @ 2013-12-04 12:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Fam Zheng, Stefan Hajnoczi

A few things missing from the previous patch:
 * add 074 to the group file
 * label new output "074" instead of "048"
 * remove "qemu-io> " prompts from output (qemu.git/master merge
   conflict)

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Fam: can I squash these missing things into your patch?

 tests/qemu-iotests/074     |  0
 tests/qemu-iotests/074.out | 10 +++++-----
 tests/qemu-iotests/group   |  1 +
 3 files changed, 6 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 tests/qemu-iotests/074

diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
old mode 100644
new mode 100755
diff --git a/tests/qemu-iotests/074.out b/tests/qemu-iotests/074.out
index 3deb594..8fba5ae 100644
--- a/tests/qemu-iotests/074.out
+++ b/tests/qemu-iotests/074.out
@@ -1,17 +1,17 @@
-QA output created by 048
+QA output created by 074
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 === IO: pattern 102
-qemu-io> wrote 512/512 bytes at offset 512
+wrote 512/512 bytes at offset 512
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
+qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
 qemu-img: Error while reading offset 0: Input/output error
 4
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=0
 === IO: pattern 102
-qemu-io> wrote 512/512 bytes at offset 512
+wrote 512/512 bytes at offset 512
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-io> qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
+qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
 qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT: Input/output error
 Warning: Image size mismatch!
 4
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 303e0f3..ed10720 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -77,3 +77,4 @@
 069 rw auto
 070 rw auto
 073 rw auto
+074 rw auto
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: 074 fixups
  2013-12-04 12:45   ` [Qemu-devel] [PATCH] qemu-iotests: 074 fixups Stefan Hajnoczi
@ 2013-12-04 12:52     ` Fam Zheng
  0 siblings, 0 replies; 11+ messages in thread
From: Fam Zheng @ 2013-12-04 12:52 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Kevin Wolf

On 2013年12月04日 20:45, Stefan Hajnoczi wrote:
> A few things missing from the previous patch:
>   * add 074 to the group file
>   * label new output "074" instead of "048"
>   * remove "qemu-io> " prompts from output (qemu.git/master merge
>     conflict)
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> Fam: can I squash these missing things into your patch?
>

Of course. Thanks.

Fam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback"
  2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
                   ` (5 preceding siblings ...)
  2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
@ 2013-12-04 13:30 ` Stefan Hajnoczi
  6 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2013-12-04 13:30 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, Benoît Canet, qemu-devel, stefanha, WenchaoXia

On Wed, Dec 04, 2013 at 09:06:57AM +0800, Fam Zheng wrote:
> This series adds cache mode option in the iotests framework. Test cases are
> updated to make use of cache mode and mask supported modes.
> 
> v6: [05] Recover disappeared two lines. (Benoît)
>     Added Wenchao's reviewed-by lines to other patches.
> 
> v5: Fix help test for "-c mode". (Wenchao)
> 
> v4: Address Stefan's comments:
>     Add _default_cache_mode.
>     Split last two cases in 048 to 074.
>     Use long option "--cache" instead of "-t" for qemu-io.
> 
> v3: Change _unsupported_qemu_io_options to _supported_cache_modes.
>     Change default mode to "writeback".
>     Clean up some whitespaces in the end of series.
>     Fix "026.out.nocache" case.
>     Fix 048 case on tmpfs.
> 
> 
> Fam Zheng (6):
>   qemu-iotests: Add "-c <cache-mode>" option
>   qemu-iotests: Honour cache mode in iotests.py
>   qemu-iotests: Add _default_cache_mode and _supported_cache_modes
>   qemu-iotests: Change default cache mode to "writeback"
>   qemu-iotests: Clean up spaces in usage output
>   qemu-iotests: Split qcow2 only cases in 048
> 
>  tests/qemu-iotests/026        |  3 +-
>  tests/qemu-iotests/039        |  3 +-
>  tests/qemu-iotests/048        | 27 --------------
>  tests/qemu-iotests/048.out    | 16 --------
>  tests/qemu-iotests/052        |  4 +-
>  tests/qemu-iotests/074        | 86 +++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/074.out    | 18 +++++++++
>  tests/qemu-iotests/check      |  2 +-
>  tests/qemu-iotests/common     | 37 ++++++++++++++-----
>  tests/qemu-iotests/common.rc  | 25 ++++++++-----
>  tests/qemu-iotests/iotests.py |  3 +-
>  11 files changed, 155 insertions(+), 69 deletions(-)
>  create mode 100644 tests/qemu-iotests/074
>  create mode 100644 tests/qemu-iotests/074.out

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-04 13:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04  1:06 [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
2013-12-04  1:06 ` [Qemu-devel] [PATCH v6 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
2013-12-04  5:24   ` Benoît Canet
2013-12-04  1:07 ` [Qemu-devel] [PATCH v6 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
2013-12-04 12:45   ` [Qemu-devel] [PATCH] qemu-iotests: 074 fixups Stefan Hajnoczi
2013-12-04 12:52     ` Fam Zheng
2013-12-04 13:30 ` [Qemu-devel] [PATCH v6 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Stefan Hajnoczi

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).