Message ID | 1424272761-27554-3-git-send-email-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
On 2015-02-18 at 10:19, Kevin Wolf wrote: > This adds a regression test for some problems that the qemu-img convert > rewrite just fixed. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > tests/qemu-iotests/122 | 83 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/122.out | 30 +++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 114 insertions(+) > create mode 100755 tests/qemu-iotests/122 > create mode 100644 tests/qemu-iotests/122.out > > diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122 > new file mode 100755 > index 0000000..e0c472f > --- /dev/null > +++ b/tests/qemu-iotests/122 > @@ -0,0 +1,83 @@ > +#!/bin/bash > +# > +# Test some qemu-img convert cases > +# > +# Copyright (C) 2015 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=kwolf@redhat.com > + > +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 > + > +_supported_fmt qcow2 > +_supported_proto generic > +_supported_os Linux > + > + > +TEST_IMG=$TEST_IMG.base _make_test_img 64M > +$QEMU_IO -c "write -P 0x11 0 64M" $TEST_IMG.base 2>&1 | _filter_qemu_io | _filter_testdir > + > + > +echo > +echo "=== Check allocation status regression with -B ===" > +echo > + > +_make_test_img -b $TEST_IMG.base > +$QEMU_IO -c "write -P 0x22 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir > +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig > +$QEMU_IMG map $TEST_IMG.orig | _filter_qemu_img_map > + > + > +echo > +echo "=== Check that zero clusters are kept in overlay ===" > +echo > + > +_make_test_img -b $TEST_IMG.base > + > +$QEMU_IO -c "write -P 0 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir > +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig > +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir > +$QEMU_IMG convert -O $IMGFMT -c -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig > +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir > + > +$QEMU_IO -c "write -z 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir > +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig > +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir > +$QEMU_IMG convert -O $IMGFMT -c -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig > +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir > + > +# TODO -B + -S 0 -> full allocation with no use of the backing file Also, -S 0 with -B (that is, with has_zero_init) and concatenation, please. But even without those: Reviewed-by: Max Reitz <mreitz@redhat.com> > + > +# success, all done > +echo '*** done' > +rm -f $seq.full > +status=0 > diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out > new file mode 100644 > index 0000000..6124099 > --- /dev/null > +++ b/tests/qemu-iotests/122.out > @@ -0,0 +1,30 @@ > +QA output created by 122 > +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 > +wrote 67108864/67108864 bytes at offset 0 > +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > + > +=== Check allocation status regression with -B === > + > +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' > +wrote 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +Offset Length File > +0 0x300000 TEST_DIR/t.IMGFMT.orig > +0x300000 0x3d00000 TEST_DIR/t.IMGFMT.base > + > +=== Check that zero clusters are kept in overlay === > + > +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' > +wrote 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +read 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +read 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +wrote 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +read 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +read 3145728/3145728 bytes at offset 0 > +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +*** done > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 4b2b93b..28c78e5 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -117,3 +117,4 @@ > 113 rw auto quick > 114 rw auto quick > 116 rw auto quick > +122 rw auto quick
On 2015-02-18 at 10:19, Kevin Wolf wrote: > This adds a regression test for some problems that the qemu-img convert > rewrite just fixed. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > tests/qemu-iotests/122 | 83 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/122.out | 30 +++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 114 insertions(+) > create mode 100755 tests/qemu-iotests/122 > create mode 100644 tests/qemu-iotests/122.out [snip] > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 4b2b93b..28c78e5 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -117,3 +117,4 @@ > 113 rw auto quick > 114 rw auto quick > 116 rw auto quick > +122 rw auto quick This test takes 17 s on my HDD, and 7 s in tmpfs. Are you sure it should be added to the "quick" group? Other than that, looks good. Max
On 2015-03-19 at 10:41, Max Reitz wrote: > On 2015-02-18 at 10:19, Kevin Wolf wrote: >> This adds a regression test for some problems that the qemu-img convert >> rewrite just fixed. >> >> Signed-off-by: Kevin Wolf <kwolf@redhat.com> >> --- >> tests/qemu-iotests/122 | 83 >> ++++++++++++++++++++++++++++++++++++++++++++++ >> tests/qemu-iotests/122.out | 30 +++++++++++++++++ >> tests/qemu-iotests/group | 1 + >> 3 files changed, 114 insertions(+) >> create mode 100755 tests/qemu-iotests/122 >> create mode 100644 tests/qemu-iotests/122.out > > [snip] > >> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group >> index 4b2b93b..28c78e5 100644 >> --- a/tests/qemu-iotests/group >> +++ b/tests/qemu-iotests/group >> @@ -117,3 +117,4 @@ >> 113 rw auto quick >> 114 rw auto quick >> 116 rw auto quick >> +122 rw auto quick > > This test takes 17 s on my HDD, and 7 s in tmpfs. Are you sure it > should be added to the "quick" group? > > Other than that, looks good. > > Max Argh, disregard that, I had the wrong version open. Sorry. Max
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122 new file mode 100755 index 0000000..e0c472f --- /dev/null +++ b/tests/qemu-iotests/122 @@ -0,0 +1,83 @@ +#!/bin/bash +# +# Test some qemu-img convert cases +# +# Copyright (C) 2015 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=kwolf@redhat.com + +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 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + + +TEST_IMG=$TEST_IMG.base _make_test_img 64M +$QEMU_IO -c "write -P 0x11 0 64M" $TEST_IMG.base 2>&1 | _filter_qemu_io | _filter_testdir + + +echo +echo "=== Check allocation status regression with -B ===" +echo + +_make_test_img -b $TEST_IMG.base +$QEMU_IO -c "write -P 0x22 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig +$QEMU_IMG map $TEST_IMG.orig | _filter_qemu_img_map + + +echo +echo "=== Check that zero clusters are kept in overlay ===" +echo + +_make_test_img -b $TEST_IMG.base + +$QEMU_IO -c "write -P 0 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir +$QEMU_IMG convert -O $IMGFMT -c -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir + +$QEMU_IO -c "write -z 0 3M" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir +$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir +$QEMU_IMG convert -O $IMGFMT -c -B $TEST_IMG.base $TEST_IMG $TEST_IMG.orig +$QEMU_IO -c "read -P 0 0 3M" $TEST_IMG.orig 2>&1 | _filter_qemu_io | _filter_testdir + +# TODO -B + -S 0 -> full allocation with no use of the backing file + +# success, all done +echo '*** done' +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out new file mode 100644 index 0000000..6124099 --- /dev/null +++ b/tests/qemu-iotests/122.out @@ -0,0 +1,30 @@ +QA output created by 122 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 +wrote 67108864/67108864 bytes at offset 0 +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=== Check allocation status regression with -B === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' +wrote 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length File +0 0x300000 TEST_DIR/t.IMGFMT.orig +0x300000 0x3d00000 TEST_DIR/t.IMGFMT.base + +=== Check that zero clusters are kept in overlay === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' +wrote 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 3145728/3145728 bytes at offset 0 +3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 4b2b93b..28c78e5 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -117,3 +117,4 @@ 113 rw auto quick 114 rw auto quick 116 rw auto quick +122 rw auto quick
This adds a regression test for some problems that the qemu-img convert rewrite just fixed. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- tests/qemu-iotests/122 | 83 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/122.out | 30 +++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 114 insertions(+) create mode 100755 tests/qemu-iotests/122 create mode 100644 tests/qemu-iotests/122.out