Message ID | 20170531144331.30173-3-pbutsykin@virtuozzo.com |
---|---|
State | New |
Headers | show |
On 31.05.2017 17:43, Pavel Butsykin wrote: > Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> > --- > tests/qemu-iotests/025 | 19 +++++++++++++++++-- > tests/qemu-iotests/025.out | 12 +++++++++++- > 2 files changed, 28 insertions(+), 3 deletions(-) > > diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 > index f5e672e6b3..658601579b 100755 > --- a/tests/qemu-iotests/025 > +++ b/tests/qemu-iotests/025 > @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > . ./common.filter > . ./common.pattern > > -_supported_fmt raw qcow2 qed > +_supported_fmt raw qcow2 I'm not sure, can I so blatantly drop QED here. But this place is very suitable for reduce image case. Perhaps the alternative would be adding a new test, I just didn't want to copy the tests, which are testing almost the same thing. > _supported_proto file sheepdog rbd nfs > _supported_os Linux > > @@ -46,6 +46,7 @@ echo "=== Creating image" > echo > small_size=$((128 * 1024 * 1024)) > big_size=$((384 * 1024 * 1024)) > +bigger_size=$((512 * 1024 * 1024)) > _make_test_img $small_size > > echo > @@ -54,7 +55,20 @@ io_pattern write 0 $small_size 0 1 0xc5 > _check_test_img > > echo > -echo "=== Resizing image" > +echo "=== Growing image" > +$QEMU_IO "$TEST_IMG" <<EOF | _filter_qemu_io > +length > +truncate $bigger_size > +length > +EOF > +_check_test_img > + > +echo > +echo "=== Verifying image size after reopen" > +$QEMU_IO -c "length" "$TEST_IMG" > + > +echo > +echo "=== Reducing image" > $QEMU_IO "$TEST_IMG" <<EOF | _filter_qemu_io > length > truncate $big_size > @@ -70,6 +84,7 @@ echo > echo "=== Verifying resized image" > io_pattern read 0 $small_size 0 1 0xc5 > io_pattern read $small_size $(($big_size - $small_size)) 0 1 0 > +io_pattern read $big_size $(($bigger_size - $big_size)) 0 1 0 > > # success, all done > echo "*** done" > diff --git a/tests/qemu-iotests/025.out b/tests/qemu-iotests/025.out > index f13fc2863c..a0293711c7 100644 > --- a/tests/qemu-iotests/025.out > +++ b/tests/qemu-iotests/025.out > @@ -9,8 +9,16 @@ wrote 134217728/134217728 bytes at offset 0 > 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > No errors were found on the image. > > -=== Resizing image > +=== Growing image > 128 MiB > +512 MiB > +No errors were found on the image. > + > +=== Verifying image size after reopen > +512 MiB > + > +=== Reducing image > +512 MiB > 384 MiB > No errors were found on the image. > > @@ -24,4 +32,6 @@ read 134217728/134217728 bytes at offset 0 > === IO: pattern 0 > read 268435456/268435456 bytes at offset 134217728 > 256 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +=== IO: pattern 0 > +read failed: Input/output error > *** done >
Am 31.05.2017 um 16:54 hat Pavel Butsykin geschrieben: > On 31.05.2017 17:43, Pavel Butsykin wrote: > >Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> > >--- > > tests/qemu-iotests/025 | 19 +++++++++++++++++-- > > tests/qemu-iotests/025.out | 12 +++++++++++- > > 2 files changed, 28 insertions(+), 3 deletions(-) > > > >diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 > >index f5e672e6b3..658601579b 100755 > >--- a/tests/qemu-iotests/025 > >+++ b/tests/qemu-iotests/025 > >@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > > . ./common.filter > > . ./common.pattern > >-_supported_fmt raw qcow2 qed > >+_supported_fmt raw qcow2 > > I'm not sure, can I so blatantly drop QED here. But this place is very > suitable for reduce image case. Perhaps the alternative would be adding > a new test, I just didn't want to copy the tests, which are testing > almost the same thing. I think it's better to have a separate test case for shrinking, so that we don't damage the test coverage of qed. The resulting new patch would be a very small one, but that's okay. Kevin
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 index f5e672e6b3..658601579b 100755 --- a/tests/qemu-iotests/025 +++ b/tests/qemu-iotests/025 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter . ./common.pattern -_supported_fmt raw qcow2 qed +_supported_fmt raw qcow2 _supported_proto file sheepdog rbd nfs _supported_os Linux @@ -46,6 +46,7 @@ echo "=== Creating image" echo small_size=$((128 * 1024 * 1024)) big_size=$((384 * 1024 * 1024)) +bigger_size=$((512 * 1024 * 1024)) _make_test_img $small_size echo @@ -54,7 +55,20 @@ io_pattern write 0 $small_size 0 1 0xc5 _check_test_img echo -echo "=== Resizing image" +echo "=== Growing image" +$QEMU_IO "$TEST_IMG" <<EOF | _filter_qemu_io +length +truncate $bigger_size +length +EOF +_check_test_img + +echo +echo "=== Verifying image size after reopen" +$QEMU_IO -c "length" "$TEST_IMG" + +echo +echo "=== Reducing image" $QEMU_IO "$TEST_IMG" <<EOF | _filter_qemu_io length truncate $big_size @@ -70,6 +84,7 @@ echo echo "=== Verifying resized image" io_pattern read 0 $small_size 0 1 0xc5 io_pattern read $small_size $(($big_size - $small_size)) 0 1 0 +io_pattern read $big_size $(($bigger_size - $big_size)) 0 1 0 # success, all done echo "*** done" diff --git a/tests/qemu-iotests/025.out b/tests/qemu-iotests/025.out index f13fc2863c..a0293711c7 100644 --- a/tests/qemu-iotests/025.out +++ b/tests/qemu-iotests/025.out @@ -9,8 +9,16 @@ wrote 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. -=== Resizing image +=== Growing image 128 MiB +512 MiB +No errors were found on the image. + +=== Verifying image size after reopen +512 MiB + +=== Reducing image +512 MiB 384 MiB No errors were found on the image. @@ -24,4 +32,6 @@ read 134217728/134217728 bytes at offset 0 === IO: pattern 0 read 268435456/268435456 bytes at offset 134217728 256 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +=== IO: pattern 0 +read failed: Input/output error *** done
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> --- tests/qemu-iotests/025 | 19 +++++++++++++++++-- tests/qemu-iotests/025.out | 12 +++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-)