* [Qemu-devel] [PATCH v4 1/6] qemu-iotests: Add "-c <cache-mode>" option
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 6:31 ` Wenchao Xia
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
` (5 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, 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>
---
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..26390a6 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 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] 18+ messages in thread
* [Qemu-devel] [PATCH v4 2/6] qemu-iotests: Honour cache mode in iotests.py
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 5:35 ` Wenchao Xia
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
` (4 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, WenchaoXia, 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] 18+ messages in thread
* [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 1/6] qemu-iotests: Add "-c <cache-mode>" option Fam Zheng
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 6:05 ` Wenchao Xia
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
` (3 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, 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>
---
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] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
@ 2013-12-03 6:05 ` Wenchao Xia
2013-12-03 8:21 ` Fam Zheng
2013-12-03 9:19 ` Stefan Hajnoczi
0 siblings, 2 replies; 18+ messages in thread
From: Wenchao Xia @ 2013-12-03 6:05 UTC (permalink / raw)
To: Fam Zheng, qemu-devel; +Cc: kwolf, stefanha
This patch override only when default is specified, I am +1 with it.
I think we had discuss before, just want a double check, stefan, do you
agree with this?
> 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>
> ---
> 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"
>
Why forbid mode = writeback?
> 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"
>
same here.
> 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"
>
same question.
> 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
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-12-03 6:05 ` Wenchao Xia
@ 2013-12-03 8:21 ` Fam Zheng
2013-12-03 9:28 ` Kevin Wolf
2013-12-03 9:19 ` Stefan Hajnoczi
1 sibling, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-12-03 8:21 UTC (permalink / raw)
To: Wenchao Xia, qemu-devel; +Cc: kwolf, stefanha
On 2013年12月03日 14:05, Wenchao Xia wrote:
>
> Why forbid mode = writeback?
>
These test cases used to run with only possibly "writethrough", or "none".
And they don't work with writeback, at least in my case. So I didn't add
other modes here.
Fam
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-12-03 8:21 ` Fam Zheng
@ 2013-12-03 9:28 ` Kevin Wolf
2013-12-03 10:33 ` Fam Zheng
0 siblings, 1 reply; 18+ messages in thread
From: Kevin Wolf @ 2013-12-03 9:28 UTC (permalink / raw)
To: Fam Zheng; +Cc: Wenchao Xia, stefanha, qemu-devel
Am 03.12.2013 um 09:21 hat Fam Zheng geschrieben:
> On 2013年12月03日 14:05, Wenchao Xia wrote:
>
> >
> > Why forbid mode = writeback?
> >
>
> These test cases used to run with only possibly "writethrough", or "none".
> And they don't work with writeback, at least in my case. So I didn't add
> other modes here.
I suspect that the tests allowing writethrough might also work with
directsync. Did you give that one a try?
026 has different output for wt and wb modes, this is why writeback
fails. It should probably check against 026.out.nocache (which would
have to be renamed as 026.out.wb) instead of 026.out. That's something
for a separate series, though.
Kevin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-12-03 9:28 ` Kevin Wolf
@ 2013-12-03 10:33 ` Fam Zheng
0 siblings, 0 replies; 18+ messages in thread
From: Fam Zheng @ 2013-12-03 10:33 UTC (permalink / raw)
To: Kevin Wolf; +Cc: Wenchao Xia, stefanha, qemu-devel
On 2013年12月03日 17:28, Kevin Wolf wrote:
> Am 03.12.2013 um 09:21 hat Fam Zheng geschrieben:
>> On 2013年12月03日 14:05, Wenchao Xia wrote:
>>
>>>
>>> Why forbid mode = writeback?
>>>
>>
>> These test cases used to run with only possibly "writethrough", or "none".
>> And they don't work with writeback, at least in my case. So I didn't add
>> other modes here.
>
> I suspect that the tests allowing writethrough might also work with
> directsync. Did you give that one a try?
>
I guess so. Except for my /tmp is tmpfs and complains about O_DIRECT. It
works for me with "TMPDIR=/var/tmp".
> 026 has different output for wt and wb modes, this is why writeback
> fails. It should probably check against 026.out.nocache (which would
> have to be renamed as 026.out.wb) instead of 026.out. That's something
> for a separate series, though.
>
Yes, good idea. I'll do this and the directsync including in the next
series.
Fam
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes
2013-12-03 6:05 ` Wenchao Xia
2013-12-03 8:21 ` Fam Zheng
@ 2013-12-03 9:19 ` Stefan Hajnoczi
1 sibling, 0 replies; 18+ messages in thread
From: Stefan Hajnoczi @ 2013-12-03 9:19 UTC (permalink / raw)
To: Wenchao Xia; +Cc: kwolf, Fam Zheng, qemu-devel
On Tue, Dec 03, 2013 at 02:05:32PM +0800, Wenchao Xia wrote:
> This patch override only when default is specified, I am +1 with it.
> I think we had discuss before, just want a double check, stefan, do you
> agree with this?
Yes, I'm happy with this.
I just want to avoid test cases with custom code that silently changes
settings. As long as the default cache mode is declarative it's fine:
_default_cache_mode "writethrough"
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH v4 4/6] qemu-iotests: Change default cache mode to "writeback"
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
` (2 preceding siblings ...)
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 6:28 ` Wenchao Xia
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
` (2 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, WenchaoXia, stefanha
So that the tests can run faster.
Signed-off-by: Fam Zheng <famz@redhat.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 26390a6..804ac92 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] 18+ messages in thread
* [Qemu-devel] [PATCH v4 5/6] qemu-iotests: Clean up spaces in usage output
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
` (3 preceding siblings ...)
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 6:28 ` Wenchao Xia
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
2013-12-03 9:56 ` [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Kevin Wolf
6 siblings, 1 reply; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, 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 804ac92..55a6f72 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 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] 18+ messages in thread
* [Qemu-devel] [PATCH v4 6/6] qemu-iotests: Split qcow2 only cases in 048
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
` (4 preceding siblings ...)
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
@ 2013-11-26 1:43 ` Fam Zheng
2013-12-03 9:56 ` [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Kevin Wolf
6 siblings, 0 replies; 18+ messages in thread
From: Fam Zheng @ 2013-11-26 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, 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>
---
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..0952d44
--- /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] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback"
2013-11-26 1:43 [Qemu-devel] [PATCH v4 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
` (5 preceding siblings ...)
2013-11-26 1:43 ` [Qemu-devel] [PATCH v4 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng
@ 2013-12-03 9:56 ` Kevin Wolf
6 siblings, 0 replies; 18+ messages in thread
From: Kevin Wolf @ 2013-12-03 9:56 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, stefanha, WenchaoXia
Am 26.11.2013 um 02:43 hat Fam Zheng geschrieben:
> This series adds cache mode option in the iotests framework. Test cases are
> updated to make use of cache mode and mask supported modes.
>
> 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
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 18+ messages in thread