qemu-iotests: Backing file tests
cover qemu-iotests: Backing file tests
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
Adding these tests adds a few failures for me. I'm fairly sure that these are real bugs though and not problems with the test cases:
* 018 fails for all formats on git master. This is an qemu-img bug. (Fix was posted by Akkarit Sangpetch, but corrupted by his mailer - so it's not yet included)
* 019 fails for qcow1. Not sure yet why, but likely a qcow bug.
* 020 fails with vmdk. This is a bug of the vmdk driver which stores its backing file pointer in the parent image. Will look into fixing this.
Kevin Wolf (4):
qemu-iotests: Simple backing file test
qemu-iotests: Merge backing file when converting
qemu-iotests: qemu-img convert with backing file
qemu-iotests: Commit to backing file
017 | 102 ++++++ 017.out | 1077 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 018 | 105 ++++++ 018.out | 1077 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 019 | 116 ++++++ 019.out | 1081 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 020 | 107 ++++++ 020.out | 1078 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ common.pattern | 15 + common.rc | 1 + group | 4 + 11 files changed, 4763 insertions(+), 0 deletions(-) create mode 100755 017 create mode 100644 017.out create mode 100755 018 create mode 100644 018.out create mode 100755 019 create mode 100644 019.out create mode 100755 020 create mode 100644 020.out
PATCH 1/4 qemu-iotests: Simple backing file test
--- 017 | 102 ++++++ 017.out | 1077 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common.rc | 1 + group | 1 + 4 files changed, 1181 insertions(+), 0 deletions(-) create mode 100755 017 create mode 100644 017.out
017 new file +102 -0
@@ -0,0 +1,102 @@ +#!/bin/sh +# +# Simple backing file reads +# +# Copyright (C) 2009 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# + +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Any format supporting backing files +_supported_fmt qcow qcow2 vmdk +_supported_os Linux + +TEST_OFFSETS="0 4294967296" + +_make_test_img 6G + +echo "Filling base image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset )) 512 1024 64 + + # Complete backing clusters + io writev $(( offset + 64 * 1024)) 65536 65536 1 +done +_check_test_img + +echo "Creating test image with backing file" +echo + +mv $TEST_IMG $TEST_IMG.base +_make_test_img -b $TEST_IMG.base 6G + +echo "Filling test image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1 +done +_check_test_img + +echo "Reading" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io readv $(( offset )) 512 1024 64 + io readv $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io readv $(( offset + 64 * 1024)) 65536 65536 1 + io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1 + + # Empty sectors + io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 +done +_check_test_img + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
017.out new file +1077 -0
1,077 lines not on this page · raw message
common.rc +1 -0
@@ -71,6 +71,7 @@ _cleanup_test_img() { rm -f $TEST_DIR/t.$IMGFMT rm -f $TEST_DIR/t.$IMGFMT.orig + rm -f $TEST_DIR/t.$IMGFMT.base } _check_test_img()
group +1 -0
@@ -23,3 +23,4 @@ 014 rw auto 015 rw snapshot auto 016 rw auto +017 rw backing auto
Signature · 1 line
1.6.0.6
PATCH 2/4 qemu-iotests: Merge backing file when converting
In reply to Kevin Wolf--- 018 | 105 ++++++ 018.out | 1077 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ group | 1 + 3 files changed, 1183 insertions(+), 0 deletions(-) create mode 100755 018 create mode 100644 018.out
018 new file +105 -0
@@ -0,0 +1,105 @@ +#!/bin/sh +# +# Merge backing file into test image when converting the image +# +# Copyright (C) 2009 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# + +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Any format supporting backing files +_supported_fmt qcow qcow2 vmdk +_supported_os Linux + +TEST_OFFSETS="0 4294967296" + +_make_test_img 6G + +echo "Filling base image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset )) 512 1024 64 + + # Complete backing clusters + io writev $(( offset + 64 * 1024)) 65536 65536 1 +done +_check_test_img + +echo "Creating test image with backing file" +echo + +mv $TEST_IMG $TEST_IMG.base +_make_test_img -b $TEST_IMG.base 6G + +echo "Filling test image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1 +done +_check_test_img + +mv $TEST_IMG $TEST_IMG.orig +$QEMU_IMG convert -O $IMGFMT $TEST_IMG.orig $TEST_IMG + +echo "Reading" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io readv $(( offset )) 512 1024 64 + io readv $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io readv $(( offset + 64 * 1024)) 65536 65536 1 + io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1 + + # Empty sectors + io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 +done +_check_test_img + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
018.out new file +1077 -0
1,077 lines not on this page · raw message
group +1 -0
@@ -24,3 +24,4 @@ 015 rw snapshot auto 016 rw auto 017 rw backing auto +018 rw backing auto
Signature · 1 line
1.6.0.6
PATCH 3/4 qemu-iotests: qemu-img convert with backing file
In reply to Kevin Wolf--- 019 | 116 ++++++ 019.out | 1081 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common.pattern | 15 + group | 1 + 4 files changed, 1213 insertions(+), 0 deletions(-) create mode 100755 019 create mode 100644 019.out
019 new file +116 -0
@@ -0,0 +1,116 @@ +#!/bin/sh +# +# When using a backing file for the output image in qemu-img convert, +# the backing file clusters must not copied. The data must still be +# read correctly. +# +# Copyright (C) 2009 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# + +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + rm -f $TEST_IMG.base + rm -f $TEST_IMG.orig +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Any format supporting backing files +_supported_fmt qcow qcow2 vmdk +_supported_os Linux + +TEST_OFFSETS="0 4294967296" + +_make_test_img 6G + +echo "Filling base image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset )) 512 1024 64 + + # Complete backing clusters + io writev $(( offset + 1024 * 1024)) 65536 65536 1 +done +_check_test_img + +echo "Creating test image with backing file" +echo + +mv $TEST_IMG $TEST_IMG.base +_make_test_img -b $TEST_IMG.base 6G + +echo "Filling test image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io writev $(( offset + 1024 * 1024 + 65536)) 65536 65536 1 +done +_check_test_img + +mv $TEST_IMG $TEST_IMG.orig +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG.orig $TEST_IMG + +echo "Checking if backing clusters are allocated when they shouldn't" +echo +for offset in $TEST_OFFSETS; do + # Complete backing clusters + is_allocated $(( offset + 1024 * 1024)) 65536 65536 1 +done + +echo "Reading" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io readv $(( offset )) 512 1024 64 + io readv $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io readv $(( offset + 1024 * 1024)) 65536 65536 1 + io readv $(( offset + 1024 * 1024 + 65536)) 65536 65536 1 + + # Empty sectors + io_zero readv $(( offset + 1024 * 1024 + 65536 * 4 )) 65536 65536 1 +done +_check_test_img + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
019.out new file +1081 -0
1,081 lines not on this page · raw message
common.pattern +15 -0
@@ -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
group +1 -0
@@ -25,3 +25,4 @@ 016 rw auto 017 rw backing auto 018 rw backing auto +019 rw backing auto
Signature · 1 line
1.6.0.6
PATCH 4/4 qemu-iotests: Commit to backing file
In reply to Kevin Wolf--- 020 | 107 +++++++ 020.out | 1078 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ group | 1 + 3 files changed, 1186 insertions(+), 0 deletions(-) create mode 100755 020 create mode 100644 020.out
020 new file +107 -0
@@ -0,0 +1,107 @@ +#!/bin/sh +# +# Commit changes to backing file +# +# Copyright (C) 2009 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# + +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + rm -f $TEST_IMG.base + rm -f $TEST_IMG.orig +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Any format supporting backing files +_supported_fmt qcow qcow2 vmdk +_supported_os Linux + +TEST_OFFSETS="0 4294967296" + +_make_test_img 6G + +echo "Filling base image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset )) 512 1024 64 + + # Complete backing clusters + io writev $(( offset + 64 * 1024)) 65536 65536 1 +done +_check_test_img + +echo "Creating test image with backing file" +echo + +mv $TEST_IMG $TEST_IMG.base +_make_test_img -b $TEST_IMG.base 6G + +echo "Filling test image" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io writev $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1 +done +_check_test_img + +$QEMU_IMG commit $TEST_IMG +mv $TEST_IMG.base $TEST_IMG + +echo "Reading from the backing file" +echo + +for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io readv $(( offset )) 512 1024 64 + io readv $(( offset + 512 )) 512 1024 64 + + # Complete test image clusters + io readv $(( offset + 64 * 1024)) 65536 65536 1 + io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1 + + # Empty sectors + io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 +done +_check_test_img + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
020.out new file +1078 -0
1,078 lines not on this page · raw message
group +1 -0
@@ -26,3 +26,4 @@ 017 rw backing auto 018 rw backing auto 019 rw backing auto +020 rw backing auto
Signature · 1 line
1.6.0.6
Quoted 2 lines · Kevin Wolf
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
The patches use the old FSF's address, the new one is:
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301
USA
Quoted 9 lines · Blue Swirl
Quoted 2 lines · Kevin Wolf
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
The patches use the old FSF's address, the new one is:
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301
USA
Thanks. Seems all the test cases use the old address, I've just copied the header. Should better be done in a separate patch then.
Christoph, are you going to fix the address in all files directly or do you want to have a patch?
Kevin
Quoted 5 lines · Kevin Wolf
Thanks. Seems all the test cases use the old address, I've just copied the header. Should better be done in a separate patch then.
Christoph, are you going to fix the address in all files directly or do you want to have a patch?
I'm going to put your patches in as-is (modulo any issues I might find while reviewing them), and after that I'll do one commit to change the address all over qemu-iotests.
Quoted 9 lines · Blue Swirl
Quoted 2 lines · Kevin Wolf
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
The patches use the old FSF's address, the new one is:
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301
USA
When I checked with the FSF a few months ago, about the currently recommended form of the GPL header, I was told that this is perfectly acceptable:
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Then you don't have to update the address whenever the FSF moves.
Signature · 2 lines
Ben Pfaff http://benpfaff.org
Quoted 8 lines · Ben Pfaff
When I checked with the FSF a few months ago, about the currently recommended form of the GPL header, I was told that this is perfectly acceptable:
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Then you don't have to update the address whenever the FSF moves.
Ah, that might be an even better variant.
Quoted 2 lines · Kevin Wolf
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
Thanks, I've put all the patches in.
It would be good if we could get Akkarit ASAP as I really don't want to keep failing tests for the major formats (really just raw and qcow2) around for more than nessecary.
I wonder if we'll eventually have to add an xfail mechanism for the other formats as we can't really rely on them being maintained and getting fixed ASAP.
These patches also bring two issues up I'll want to eventually fixed:
- the use of the $(( )) synatx is a bashism. We'll either need to switch to officially requiring bash and using #!/bin/bash in the first line or switch to use Posix sh synax using let or the expr helper. Given how nice $(( )) is I'd lean towards the former.
- We'll probably want to introduce standard $TEST_BACKING_IMG and similar variables aswell as shell functions for creating and dealing with them now that they get more common. Same for the .orig stuff we use when creating compressed images.
none of that is really ugent, though.
Quoted 14 lines · Christoph Hellwig
Quoted 2 lines · Kevin Wolf
This series adds some patches for backing files to qemu-iotests. It is meant to be applied on top of the recently posted patch introducing test 016.
Thanks, I've put all the patches in.
It would be good if we could get Akkarit ASAP as I really don't want to keep failing tests for the major formats (really just raw and qcow2) around for more than nessecary.
I wonder if we'll eventually have to add an xfail mechanism for the other formats as we can't really rely on them being maintained and getting fixed ASAP.
Quoted 6 lines
These patches also bring two issues up I'll want to eventually fixed:
- the use of the $(( )) synatx is a bashism. We'll either need to switch to officially requiring bash and using #!/bin/bash in the first line or switch to use Posix sh synax using let or the expr helper. Given how nice $(( )) is I'd lean towards the former.
$(()) is POSIX:
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04
Quoted 8 lines
- We'll probably want to introduce standard $TEST_BACKING_IMG and similar variables aswell as shell functions for creating and dealing with them now that they get more common. Same for the .orig stuff we use when creating compressed images.
none of that is really ugent, though.
Signature · 1 line
mailto:[email protected]