Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
On Thu, 2019-11-07 at 10:20 +0100, Max Reitz wrote: > On 06.11.19 16:47, Maxim Levitsky wrote: > > On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote: > > > Tests should not overwrite all user-supplied image options, but only add > > > to it (which will effectively overwrite conflicting values). Accomplish > > > this by passing options to _make_test_img via -o instead of $IMGOPTS. > > > > > > For some tests, there is no functional change because they already only > > > appended options to IMGOPTS. For these, this patch is just a > > > simplification. > > > > > > For others, this is a change, so they now heed user-specified $IMGOPTS. > > > Some of those tests do not work with all image options, though, so we > > > need to disable them accordingly. > > > > > > Signed-off-by: Max Reitz > > > --- > > > tests/qemu-iotests/031 | 9 --- > > > tests/qemu-iotests/039 | 24 ++ > > > tests/qemu-iotests/059 | 18 ++--- > > > tests/qemu-iotests/060 | 6 ++--- > > > tests/qemu-iotests/061 | 57 ++ > > > tests/qemu-iotests/079 | 3 +-- > > > tests/qemu-iotests/106 | 2 +- > > > tests/qemu-iotests/108 | 2 +- > > > tests/qemu-iotests/112 | 32 > > > tests/qemu-iotests/115 | 3 +-- > > > tests/qemu-iotests/121 | 6 ++--- > > > tests/qemu-iotests/125 | 2 +- > > > tests/qemu-iotests/137 | 2 +- > > > tests/qemu-iotests/138 | 3 +-- > > > tests/qemu-iotests/175 | 2 +- > > > tests/qemu-iotests/190 | 2 +- > > > tests/qemu-iotests/191 | 3 +-- > > > tests/qemu-iotests/220 | 4 ++- > > > tests/qemu-iotests/243 | 6 +++-- > > > tests/qemu-iotests/244 | 10 +--- > > > tests/qemu-iotests/250 | 3 +-- > > > tests/qemu-iotests/265 | 2 +- > > > 22 files changed, 100 insertions(+), 101 deletions(-) > > [...] > > > > @@ -161,7 +161,7 @@ _cleanup_test_img > > > > > > echo > > > echo "=== Testing 4TB monolithicFlat creation and IO ===" > > > -IMGOPTS="subformat=monolithicFlat" _make_test_img 4T > > > +_make_test_img -o "subformat=monolithicFlat" 4T > > > _img_info > > > $QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io > > > $QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io > > > @@ -170,7 +170,7 @@ _cleanup_test_img > > > echo > > > echo "=== Testing qemu-img map on extents ===" > > > for fmt in monolithicSparse twoGbMaxExtentSparse; do > > > -IMGOPTS="subformat=$fmt" _make_test_img 31G > > > +_make_test_img -o "subformat=$fmt" 31G > > > $QEMU_IO -c "write 65024 1k" "$TEST_IMG" | _filter_qemu_io > > > $QEMU_IO -c "write 2147483136 1k" "$TEST_IMG" | _filter_qemu_io > > > $QEMU_IO -c "write 5G 1k" "$TEST_IMG" | _filter_qemu_io > > > > Looks good. Another test that pokes at guessed locations... :-) > > Actually, no. These are writes on the format, not the file itself. The > monolithicSparse subformat will store everything in a single file, > whereas twoGbMaxExtentSparse will create one file per 2 GB of guest > disk. So the locations are chosen accordingly to that 2 GB limit ((1) > something somewhere in the first extent, (2) something that wraps around > the first 2 GB limit, so hits extents #0 and #1, and (3) something in > the middle of extent #2.) > > (The following qemu-img map call then verifies that it lands in the > different files for twoGbMaxExtentSparse, and that monolithicSparse is > at least indeed sparsely allocated.) > > Max Good to know, I missed this one. Best regards, Maxim Levitsky
Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
On 06.11.19 16:47, Maxim Levitsky wrote: > On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote: >> Tests should not overwrite all user-supplied image options, but only add >> to it (which will effectively overwrite conflicting values). Accomplish >> this by passing options to _make_test_img via -o instead of $IMGOPTS. >> >> For some tests, there is no functional change because they already only >> appended options to IMGOPTS. For these, this patch is just a >> simplification. >> >> For others, this is a change, so they now heed user-specified $IMGOPTS. >> Some of those tests do not work with all image options, though, so we >> need to disable them accordingly. >> >> Signed-off-by: Max Reitz >> --- >> tests/qemu-iotests/031 | 9 --- >> tests/qemu-iotests/039 | 24 ++ >> tests/qemu-iotests/059 | 18 ++--- >> tests/qemu-iotests/060 | 6 ++--- >> tests/qemu-iotests/061 | 57 ++ >> tests/qemu-iotests/079 | 3 +-- >> tests/qemu-iotests/106 | 2 +- >> tests/qemu-iotests/108 | 2 +- >> tests/qemu-iotests/112 | 32 >> tests/qemu-iotests/115 | 3 +-- >> tests/qemu-iotests/121 | 6 ++--- >> tests/qemu-iotests/125 | 2 +- >> tests/qemu-iotests/137 | 2 +- >> tests/qemu-iotests/138 | 3 +-- >> tests/qemu-iotests/175 | 2 +- >> tests/qemu-iotests/190 | 2 +- >> tests/qemu-iotests/191 | 3 +-- >> tests/qemu-iotests/220 | 4 ++- >> tests/qemu-iotests/243 | 6 +++-- >> tests/qemu-iotests/244 | 10 +--- >> tests/qemu-iotests/250 | 3 +-- >> tests/qemu-iotests/265 | 2 +- >> 22 files changed, 100 insertions(+), 101 deletions(-) [...] >> @@ -161,7 +161,7 @@ _cleanup_test_img >> >> echo >> echo "=== Testing 4TB monolithicFlat creation and IO ===" >> -IMGOPTS="subformat=monolithicFlat" _make_test_img 4T >> +_make_test_img -o "subformat=monolithicFlat" 4T >> _img_info >> $QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io >> $QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io >> @@ -170,7 +170,7 @@ _cleanup_test_img >> echo >> echo "=== Testing qemu-img map on extents ===" >> for fmt in monolithicSparse twoGbMaxExtentSparse; do >> -IMGOPTS="subformat=$fmt" _make_test_img 31G >> +_make_test_img -o "subformat=$fmt" 31G >> $QEMU_IO -c "write 65024 1k" "$TEST_IMG" | _filter_qemu_io >> $QEMU_IO -c "write 2147483136 1k" "$TEST_IMG" | _filter_qemu_io >> $QEMU_IO -c "write 5G 1k" "$TEST_IMG" | _filter_qemu_io > > Looks good. Another test that pokes at guessed locations... :-) Actually, no. These are writes on the format, not the file itself. The monolithicSparse subformat will store everything in a single file, whereas twoGbMaxExtentSparse will create one file per 2 GB of guest disk. So the locations are chosen accordingly to that 2 GB limit ((1) something somewhere in the first extent, (2) something that wraps around the first 2 GB limit, so hits extents #0 and #1, and (3) something in the middle of extent #2.) (The following qemu-img map call then verifies that it lands in the different files for twoGbMaxExtentSparse, and that monolithicSparse is at least indeed sparsely allocated.) Max signature.asc Description: OpenPGP digital signature
Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote: > Tests should not overwrite all user-supplied image options, but only add > to it (which will effectively overwrite conflicting values). Accomplish > this by passing options to _make_test_img via -o instead of $IMGOPTS. > > For some tests, there is no functional change because they already only > appended options to IMGOPTS. For these, this patch is just a > simplification. > > For others, this is a change, so they now heed user-specified $IMGOPTS. > Some of those tests do not work with all image options, though, so we > need to disable them accordingly. > > Signed-off-by: Max Reitz > --- > tests/qemu-iotests/031 | 9 --- > tests/qemu-iotests/039 | 24 ++ > tests/qemu-iotests/059 | 18 ++--- > tests/qemu-iotests/060 | 6 ++--- > tests/qemu-iotests/061 | 57 ++ > tests/qemu-iotests/079 | 3 +-- > tests/qemu-iotests/106 | 2 +- > tests/qemu-iotests/108 | 2 +- > tests/qemu-iotests/112 | 32 > tests/qemu-iotests/115 | 3 +-- > tests/qemu-iotests/121 | 6 ++--- > tests/qemu-iotests/125 | 2 +- > tests/qemu-iotests/137 | 2 +- > tests/qemu-iotests/138 | 3 +-- > tests/qemu-iotests/175 | 2 +- > tests/qemu-iotests/190 | 2 +- > tests/qemu-iotests/191 | 3 +-- > tests/qemu-iotests/220 | 4 ++- > tests/qemu-iotests/243 | 6 +++-- > tests/qemu-iotests/244 | 10 +--- > tests/qemu-iotests/250 | 3 +-- > tests/qemu-iotests/265 | 2 +- > 22 files changed, 100 insertions(+), 101 deletions(-) > > diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 > index a3c25ec237..c44fcf91bb 100755 > --- a/tests/qemu-iotests/031 > +++ b/tests/qemu-iotests/031 > @@ -40,19 +40,22 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > # This tests qcow2-specific low-level functionality > _supported_fmt qcow2 > _supported_proto file > +# We want to test compat=0.10, which does not support refcount widths > +# other than 16 > +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' In theory the test could be cloned to only restrict refcount_bits to 16 for the 0.10 version but this is probably not worth it given the nature of the test. > > CLUSTER_SIZE=65536 > > # qcow2.py output depends on the exact options used, so override the command > # line here as an exception > -for IMGOPTS in "compat=0.10" "compat=1.1"; do > +for compat in "compat=0.10" "compat=1.1"; do > > echo > -echo = Testing with -o $IMGOPTS = > +echo = Testing with -o $compat = > echo > echo === Create image with unknown header extension === > echo > -_make_test_img 64M > +_make_test_img -o $compat 64M > $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test > header extension" > $PYTHON qcow2.py "$TEST_IMG" dump-header > _check_test_img > > diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 > index 325da63a4c..99563bf126 100755 > --- a/tests/qemu-iotests/039 > +++ b/tests/qemu-iotests/039 > @@ -50,8 +50,7 @@ size=128M > echo > echo "== Checking that image is clean on shutdown ==" > > -IMGOPTS="compat=1.1,lazy_refcounts=on" > -_make_test_img $size > +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size > > $QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io > > @@ -62,8 +61,7 @@ _check_test_img > echo > echo "== Creating a dirty image file ==" > > -IMGOPTS="compat=1.1,lazy_refcounts=on" > -_make_test_img $size > +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size > > _NO_VALGRIND \ > $QEMU_IO -c "write -P 0x5a 0 512" \ > @@ -98,8 +96,7 @@ $QEMU_IO -c "read -P 0x5a 0 512" "$TEST_IMG" | > _filter_qemu_io > echo > echo "== Opening a dirty image read/write should repair it ==" > > -IMGOPTS="compat=1.1,lazy_refcounts=on" > -_make_test_img $size > +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size > > _NO_VALGRIND \ > $QEMU_IO -c "write -P 0x5a 0 512" \ > @@ -117,8 +114,7 @@ $PYTHON qcow2.py "$TEST_IMG" dump-header | grep > incompatible_features > echo > echo "== Creating an image file with lazy_refcounts=off ==" > > -IMGOPTS="compat=1.1,lazy_refcounts=off" > -_make_test_img $size > +_make_test_img -o "compat=1.1,lazy_refcounts=off" $size > > _NO_VALGRIND \ > $QEMU_IO -c "write -P 0x5a 0 512" \ > @@ -132,11 +128,9 @@ _check_test_img > echo > echo "== Committing to a backing file with lazy_refcounts=on ==" > > -IMGOPTS="compat=1.1,lazy_refcounts=on" > -TEST_IMG="$TEST_IMG".base _make_test_img $size > +TEST_IMG="$TEST_IMG".base _make_test_img -o "compat=1.1,lazy_refcounts=on" > $size > > -IMGOPTS="compat=1.1,lazy_refcounts=on,backing_file=$TEST_IMG.base" > -_make_test_img $size > +_make_test_img -o "compat=1.1,lazy_refcounts=on,backing_file=$TEST_IMG.base" > $size > > $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io > $QEMU_IMG commit "$TEST_IMG" > @@ -151,8 +145,7 @@ TEST_IMG="$TEST_IMG".base _check_test_img > echo
[PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
Tests should not overwrite all user-supplied image options, but only add to it (which will effectively overwrite conflicting values). Accomplish this by passing options to _make_test_img via -o instead of $IMGOPTS. For some tests, there is no functional change because they already only appended options to IMGOPTS. For these, this patch is just a simplification. For others, this is a change, so they now heed user-specified $IMGOPTS. Some of those tests do not work with all image options, though, so we need to disable them accordingly. Signed-off-by: Max Reitz --- tests/qemu-iotests/031 | 9 --- tests/qemu-iotests/039 | 24 ++ tests/qemu-iotests/059 | 18 ++--- tests/qemu-iotests/060 | 6 ++--- tests/qemu-iotests/061 | 57 ++ tests/qemu-iotests/079 | 3 +-- tests/qemu-iotests/106 | 2 +- tests/qemu-iotests/108 | 2 +- tests/qemu-iotests/112 | 32 tests/qemu-iotests/115 | 3 +-- tests/qemu-iotests/121 | 6 ++--- tests/qemu-iotests/125 | 2 +- tests/qemu-iotests/137 | 2 +- tests/qemu-iotests/138 | 3 +-- tests/qemu-iotests/175 | 2 +- tests/qemu-iotests/190 | 2 +- tests/qemu-iotests/191 | 3 +-- tests/qemu-iotests/220 | 4 ++- tests/qemu-iotests/243 | 6 +++-- tests/qemu-iotests/244 | 10 +--- tests/qemu-iotests/250 | 3 +-- tests/qemu-iotests/265 | 2 +- 22 files changed, 100 insertions(+), 101 deletions(-) diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 index a3c25ec237..c44fcf91bb 100755 --- a/tests/qemu-iotests/031 +++ b/tests/qemu-iotests/031 @@ -40,19 +40,22 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 _supported_proto file +# We want to test compat=0.10, which does not support refcount widths +# other than 16 +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' CLUSTER_SIZE=65536 # qcow2.py output depends on the exact options used, so override the command # line here as an exception -for IMGOPTS in "compat=0.10" "compat=1.1"; do +for compat in "compat=0.10" "compat=1.1"; do echo -echo = Testing with -o $IMGOPTS = +echo = Testing with -o $compat = echo echo === Create image with unknown header extension === echo -_make_test_img 64M +_make_test_img -o $compat 64M $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension" $PYTHON qcow2.py "$TEST_IMG" dump-header _check_test_img diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 index 325da63a4c..99563bf126 100755 --- a/tests/qemu-iotests/039 +++ b/tests/qemu-iotests/039 @@ -50,8 +50,7 @@ size=128M echo echo "== Checking that image is clean on shutdown ==" -IMGOPTS="compat=1.1,lazy_refcounts=on" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size $QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io @@ -62,8 +61,7 @@ _check_test_img echo echo "== Creating a dirty image file ==" -IMGOPTS="compat=1.1,lazy_refcounts=on" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size _NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ @@ -98,8 +96,7 @@ $QEMU_IO -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io echo echo "== Opening a dirty image read/write should repair it ==" -IMGOPTS="compat=1.1,lazy_refcounts=on" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=on" $size _NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ @@ -117,8 +114,7 @@ $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features echo echo "== Creating an image file with lazy_refcounts=off ==" -IMGOPTS="compat=1.1,lazy_refcounts=off" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=off" $size _NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ @@ -132,11 +128,9 @@ _check_test_img echo echo "== Committing to a backing file with lazy_refcounts=on ==" -IMGOPTS="compat=1.1,lazy_refcounts=on" -TEST_IMG="$TEST_IMG".base _make_test_img $size +TEST_IMG="$TEST_IMG".base _make_test_img -o "compat=1.1,lazy_refcounts=on" $size -IMGOPTS="compat=1.1,lazy_refcounts=on,backing_file=$TEST_IMG.base" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=on,backing_file=$TEST_IMG.base" $size $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io $QEMU_IMG commit "$TEST_IMG" @@ -151,8 +145,7 @@ TEST_IMG="$TEST_IMG".base _check_test_img echo echo "== Changing lazy_refcounts setting at runtime ==" -IMGOPTS="compat=1.1,lazy_refcounts=off" -_make_test_img $size +_make_test_img -o "compat=1.1,lazy_refcounts=off" $size _NO_VALGRIND \ $QEMU_IO -c "reopen -o lazy-refcounts=on" \ @@ -164,8 +157,7 @@ $QEMU_IO -c "reopen -o lazy-refcounts=on" \ $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features _check_test_img -IMGOPTS="compat=1.1,lazy_refcounts=on" -_make_test_img $size +_make_test_img -o