* [Qemu-devel] [PATCH v2 1/2] qemu-iotests: Add "-c <cache-mode>" option
2013-11-19 6:45 [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Fam Zheng
@ 2013-11-19 6:45 ` Fam Zheng
2013-11-19 6:45 ` [Qemu-devel] [PATCH v2 2/2] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2013-11-19 6:45 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Wenchao Xia, 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>
---
tests/qemu-iotests/common | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 8cde7f1..5314314 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -42,12 +42,14 @@ 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=""
for r
@@ -113,7 +115,11 @@ s/ .*//p
IMGOPTS="$r"
imgopts=false
continue
-
+ elif $cachemode
+ then
+ CACHEMODE="$r"
+ cachemode=false
+ continue
fi
xpand=true
@@ -147,6 +153,7 @@ check options
-o options -o options to pass to qemu-img create/convert
-T output timestamps
-r randomize test order
+ -c cache mode
testlist options
-g group[,group...] include tests from these groups
@@ -219,7 +226,7 @@ testlist options
xpand=false
;;
-nocache)
- QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache"
+ CACHEMODE="none"
xpand=false
;;
@@ -258,6 +265,10 @@ testlist options
imgopts=true
xpand=false
;;
+ -c)
+ cachemode=true
+ xpand=false
+ ;;
-r) # randomize test order
randomize=true
xpand=false
@@ -334,6 +345,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 -t $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] 5+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] qemu-iotests: Honour cache mode in iotests.py
2013-11-19 6:45 [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Fam Zheng
2013-11-19 6:45 ` [Qemu-devel] [PATCH v2 1/2] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
@ 2013-11-19 6:45 ` Fam Zheng
2013-11-19 10:10 ` [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Kevin Wolf
2013-11-19 10:21 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2013-11-19 6:45 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Wenchao Xia, stefanha
This will allow overriding cache mode from the "-c mode" option.
Signed-off-by: Fam Zheng <famz@redhat.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] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests
2013-11-19 6:45 [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Fam Zheng
2013-11-19 6:45 ` [Qemu-devel] [PATCH v2 1/2] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
2013-11-19 6:45 ` [Qemu-devel] [PATCH v2 2/2] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
@ 2013-11-19 10:10 ` Kevin Wolf
2013-11-19 10:21 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2013-11-19 10:10 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, stefanha, Wenchao Xia
Am 19.11.2013 um 07:45 hat Fam Zheng geschrieben:
> The first patch adds "-c <mode>" option to ./check and convert "-nocache" to an
> alias to "-c none". The mode is used in qemu-io.
>
> The second patch modifies iotests.py to use the cache mode option in qemu drive
> command line.
>
> Fam Zheng (2):
> qemu-iotests: Add "-c <cache-mode>" option
> qemu-iotests: Honour cache mode in iotests.py
>
> tests/qemu-iotests/common | 18 ++++++++++++++++--
> tests/qemu-iotests/iotests.py | 3 ++-
> 2 files changed, 18 insertions(+), 3 deletions(-)
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests
2013-11-19 6:45 [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Fam Zheng
` (2 preceding siblings ...)
2013-11-19 10:10 ` [Qemu-devel] [PATCH v2 0/2] Add cache mode option to qemu-iotests Kevin Wolf
@ 2013-11-19 10:21 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2013-11-19 10:21 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, stefanha, Wenchao Xia
Am 19.11.2013 um 07:45 hat Fam Zheng geschrieben:
> The first patch adds "-c <mode>" option to ./check and convert "-nocache" to an
> alias to "-c none". The mode is used in qemu-io.
>
> The second patch modifies iotests.py to use the cache mode option in qemu drive
> command line.
Okay, I gave it some testing, too, and it looks like we need some
additional changes. There are some test cases that use:
_unsupported_qemu_io_options --nocache
Which obviously doesn't work any more. We need to replace it by a check
against $CACHEMODE (or, perhaps preferably, even override it
automatically, so that test cases aren't left out just because of the
cache mode)
Test case 026 uses the option of having a 026.out.nocache, which differs
from the normal output. I suspect the correct differentiation is here
between writethrough and writeback modes. And of course, grepping for
'--nocache' to detect the condition doesn't work any more.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread