summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-04-22 08:08:22 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-22 08:08:22 -0500
commitf1ab7a5acf08dcc11638b22660ed87d5f6d633c2 (patch)
tree4feebf5c7cb407a13225d4c3cf1870914140a719 /tests/qemu-iotests
parent25690739f1f067b6d8b2e616d87b1d976db0db92 (diff)
parent7da94ca741e01a80afd65e107cc2cee160d1b2d2 (diff)
downloadqemu-f1ab7a5acf08dcc11638b22660ed87d5f6d633c2.tar.gz
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Kevin Wolf (16) and Stefan Hajnoczi (4) # Via Kevin Wolf * kwolf/for-anthony: qemu-iotests: add 053 unaligned compressed image size test block: Allow overriding backing.file.filename block: Remove filename parameter from .bdrv_file_open() vvfat: Use bdrv_open options instead of filename sheepdog: Use bdrv_open options instead of filename rbd: Use bdrv_open options instead of filename iscsi: Use bdrv_open options instead of filename gluster: Use bdrv_open options instead of filename curl: Use bdrv_open options instead of filename blkverify: Use bdrv_open options instead of filename blkdebug: Use bdrv_open options instead of filename raw-win32: Use bdrv_open options instead of filename raw-posix: Use bdrv_open options instead of filename block: Enable filename option block: Add driver-specific options for backing files block: Fail gracefully when using a format driver on protocol level qemu-iotests: Fix _filter_qemu qemu-img: do not zero-pad the compressed write buffer qcow: allow sub-cluster compressed write to last cluster qcow2: allow sub-cluster compressed write to last cluster Message-id: 1366630294-18984-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'tests/qemu-iotests')
-rwxr-xr-xtests/qemu-iotests/0517
-rw-r--r--tests/qemu-iotests/051.out10
-rwxr-xr-xtests/qemu-iotests/05373
-rw-r--r--tests/qemu-iotests/053.out17
-rw-r--r--tests/qemu-iotests/common.filter2
-rw-r--r--tests/qemu-iotests/group1
6 files changed, 109 insertions, 1 deletions
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 8b51de3f31..8039e23ab3 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -142,6 +142,13 @@ run_qemu -drive media=cdrom,cache=writethrough
run_qemu -drive media=cdrom,cache=unsafe
run_qemu -drive media=cdrom,cache=invalid_value
+echo
+echo === Specifying the protocol layer ===
+echo
+
+run_qemu -drive file=$TEST_IMG,file.driver=file
+run_qemu -drive file=$TEST_IMG,file.driver=qcow2
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index 48456d5b07..3d1ac7b7da 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -159,4 +159,14 @@ qququiquit
Testing: -drive media=cdrom,cache=invalid_value
QEMU_PROG: -drive media=cdrom,cache=invalid_value: invalid cache option
+
+=== Specifying the protocol layer ===
+
+Testing: -drive file=TEST_DIR/t.qcow2,file.driver=file
+qququiquit
+
+Testing: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: Can't use 'qcow2' as a block driver for the protocol level
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk image TEST_DIR/t.qcow2: Invalid argument
+
*** done
diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
new file mode 100755
index 0000000000..bc56992582
--- /dev/null
+++ b/tests/qemu-iotests/053
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# Test qemu-img convert when image length is not a multiple of cluster size
+#
+# 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=stefanha@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+_cleanup()
+{
+ rm -f $TEST_IMG.orig
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt qcow2 qcow
+_supported_proto file
+_supported_os Linux
+
+echo
+echo "== Creating single sector image =="
+
+_make_test_img 512
+$QEMU_IO -c "write -P0xa 0 512" $TEST_IMG | _filter_qemu_io
+mv $TEST_IMG $TEST_IMG.orig
+
+echo
+echo "== Converting the image, compressed =="
+
+$QEMU_IMG convert -c -O $IMGFMT $TEST_IMG.orig $TEST_IMG
+_check_test_img
+
+echo
+echo "== Checking compressed image virtual disk size =="
+
+_img_info | grep '^virtual size:'
+
+echo
+echo "== Verifying the compressed image =="
+
+$QEMU_IO -c "read -P0xa 0 512" $TEST_IMG | _filter_qemu_io
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
+
diff --git a/tests/qemu-iotests/053.out b/tests/qemu-iotests/053.out
new file mode 100644
index 0000000000..16464e6dde
--- /dev/null
+++ b/tests/qemu-iotests/053.out
@@ -0,0 +1,17 @@
+QA output created by 053
+
+== Creating single sector image ==
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=512
+wrote 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== Converting the image, compressed ==
+No errors were found on the image.
+
+== Checking compressed image virtual disk size ==
+virtual size: 512 (512 bytes)
+
+== Verifying the compressed image ==
+read 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index bc5f250cab..dcf6391ea2 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -155,7 +155,7 @@ _filter_qemu_io()
# replace occurrences of QEMU_PROG with "qemu"
_filter_qemu()
{
- sed -e "s#$(basename $QEMU_PROG)#QEMU_PROG#g"
+ sed -e "s#^$(basename $QEMU_PROG):#QEMU_PROG:#"
}
# make sure this script returns success
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 324bacbcd4..68eabdaab9 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -59,3 +59,4 @@
050 rw auto backing quick
051 rw auto
052 rw auto backing
+053 rw auto