diff options
author | Fam Zheng <famz@redhat.com> | 2013-12-04 09:07:00 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-12-04 11:55:13 +0100 |
commit | f210a83c1f809516acd9179d02d8c986c5db24cd (patch) | |
tree | 19e9b16ddd9516efb7004f61f4068994c4afed5e /tests | |
parent | 58cc2ae1e3f9f8cd6830a0af116c51c3355710d3 (diff) |
qemu-iotests: Add _default_cache_mode and _supported_cache_modes
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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/qemu-iotests/026 | 3 | ||||
-rwxr-xr-x | tests/qemu-iotests/039 | 3 | ||||
-rwxr-xr-x | tests/qemu-iotests/052 | 4 | ||||
-rw-r--r-- | 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 ebe29d0168..c9c5f83936 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 8bade92a80..6abf47267f 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 f5f9683e68..4d4e411339 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 7f6245770a..47cef6dbe4 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 |