qemu-iotests: test qemu-img convert with backing file for the output image

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 9e7f2f2..12f813d 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -18,6 +18,21 @@
 # USA
 #
 
+function do_is_allocated() {
+    local start=$1
+    local size=$(( $2 / 512))
+    local step=$3
+    local count=$4
+
+    for i in `seq 1 $count`; do
+        echo alloc $(( start + i * step )) $size
+    done
+}
+
+function is_allocated() {
+    do_is_allocated "$@" | $QEMU_IO $TEST_IMG | _filter_qemu_io
+}
+
 function do_io() {
     local op=$1
     local start=$2