Verify that after block streaming, if there are base files in different relative directories that the resulting top-level image contains a correct relative pathname to its backing file.
Signed-off-by: Jeff Cody <jc...@redhat.com> --- tests/qemu-iotests/031 | 75 ++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/031.out | 16 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 92 insertions(+), 0 deletions(-) create mode 100755 tests/qemu-iotests/031 create mode 100644 tests/qemu-iotests/031.out diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 new file mode 100755 index 0000000..60c14fa --- /dev/null +++ b/tests/qemu-iotests/031 @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Check for correct relative pathnames when block streaming images that +# have relative pathnames for the backing filenames. +# +# Copyright (C) 2012 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=jc...@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +test_img_base="$TEST_DIR/foo/base.raw" +test_img_1="$TEST_DIR/foo/test-1.img" +test_img_2="$TEST_DIR/foobar/test-2.img" + +_cleanup() +{ + rm -f $test_img_2 + rm -f $test_img_1 + rm -f $test_img_base + rmdir $TEST_DIR/foo + rmdir $TEST_DIR/foobar + true +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# currently only qcow2 allows for consistency checks using qemu-img +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +echo +echo "creating image" + +mkdir -p $TEST_DIR/{foo,foobar} | sed -e s#$TEST_DIR#TEST_DIR#g +$QEMU_IMG create -f raw $test_img_base 4M | sed -e s#$TEST_DIR#TEST_DIR#g +$QEMU_IMG create -f qcow2 -b "base.raw" $test_img_1 4M | sed -e s#$TEST_DIR#TEST_DIR#g +$QEMU_IMG create -f qcow2 -b "../foo/test-1.img" $test_img_2 4M | sed -e s#$TEST_DIR#TEST_DIR#g + +$QEMU -hda $TEST_IMG -monitor stdio >/dev/null 2>&1 <<EOF +block_stream ide0-hd0 base.raw +quit +EOF + +echo +echo "checking image for errors" +$QEMU_IMG check -f qcow2 $test_img_2 2>&1 +$QEMU_IMG info $test_img_2 2>&1 | sed -e s#$TEST_DIR#TEST_DIR#g + +# success, all done +echo "*** done" +status=0 diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out new file mode 100644 index 0000000..5f6dbe9 --- /dev/null +++ b/tests/qemu-iotests/031.out @@ -0,0 +1,16 @@ +QA output created by 031 + +creating image +Formatting 'TEST_DIR/foo/base.raw', fmt=raw size=4194304 +Formatting 'TEST_DIR/foo/test-1.img', fmt=qcow2 size=4194304 backing_file='base.raw' encryption=off cluster_size=65536 +Formatting 'TEST_DIR/foobar/test-2.img', fmt=qcow2 size=4194304 backing_file='../foo/test-1.img' encryption=off cluster_size=65536 + +checking image for errors +No errors were found on the image. +image: TEST_DIR/foobar/test-2.img +file format: qcow2 +virtual size: 4.0M (4194304 bytes) +disk size: 196K +cluster_size: 65536 +backing file: ../foo/test-1.img (actual path: TEST_DIR/foobar/../foo/test-1.img) +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index b549f10..f7ee37b 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -37,3 +37,4 @@ 028 rw backing auto 029 rw auto quick 030 rw auto +031 rw auto -- 1.7.9.rc2.1.g69204