All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/21] iotests: Allow ./check -o data_file
@ 2019-10-15 14:27 Max Reitz
  2019-10-15 14:27 ` [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts Max Reitz
                   ` (22 more replies)
  0 siblings, 23 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Hi,

The cover letter from v1 (explaining the motivation behind this series
and the general structure) is here:

https://lists.nongnu.org/archive/html/qemu-block/2019-09/msg01323.html


For v2, I’ve tried to address Maxim’s comments:
- Patch 1 through 3: New
- Patch 4: Only print feature bits instead of blacklisting stuff that we
           don’t need
- Patch 5:
  - Fix typo
  - Add comment why 098 needs compat=1.1
- Patch 16: Use _check_test_img
- Patch 17: Use the new _filter_json_filename
- Patch 18: Rethink the incompatible feature filter approach: Instead of
            filtering out the data_file bit, just check whether the
            dirty bit is present (because that is all we want to know)
- Patch 19: Use the new _filter_json_filename
- Patch 20: Rebase conflicts due to the changes to patch 5
- Patch 21:
  - Add and use _get_data_file
  - Add a comment how the data_file_filter in _filter_qemu_img_map works


git-backport-diff against v1:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/21:[down] 'iotests/qcow2.py: Add dump-header-exts'
002/21:[down] 'iotests/qcow2.py: Split feature fields into bits'
003/21:[down] 'iotests: Add _filter_json_filename'
004/21:[0060] [FC] 'iotests: Filter refcount_order in 036'
005/21:[0003] [FC] 'iotests: Replace IMGOPTS by _unsupported_imgopts'
006/21:[----] [--] 'iotests: Drop compat=1.1 in 050'
007/21:[----] [--] 'iotests: Let _make_test_img parse its parameters'
008/21:[----] [--] 'iotests: Add -o and --no-opts to _make_test_img'
009/21:[----] [--] 'iotests: Inject space into -ocompat=0.10 in 051'
010/21:[----] [--] 'iotests: Replace IMGOPTS= by -o'
011/21:[----] [--] 'iotests: Replace IMGOPTS='' by --no-opts'
012/21:[----] [--] 'iotests: Drop IMGOPTS use in 267'
013/21:[----] [--] 'iotests: Avoid qemu-img create'
014/21:[----] [--] 'iotests: Use _rm_test_img for deleting test images'
015/21:[----] [--] 'iotests: Avoid cp/mv of test images'
016/21:[0004] [FC] 'iotests: Make 091 work with data_file'
017/21:[0004] [FC] 'iotests: Make 110 work with data_file'
018/21:[0002] [FC] 'iotests: Make 137 work with data_file'
019/21:[0004] [FC] 'iotests: Make 198 work with data_file'
020/21:[0002] [FC] 'iotests: Disable data_file where it cannot be used'
021/21:[0034] [FC] 'iotests: Allow check -o data_file'


Max Reitz (21):
  iotests/qcow2.py: Add dump-header-exts
  iotests/qcow2.py: Split feature fields into bits
  iotests: Add _filter_json_filename
  iotests: Filter refcount_order in 036
  iotests: Replace IMGOPTS by _unsupported_imgopts
  iotests: Drop compat=1.1 in 050
  iotests: Let _make_test_img parse its parameters
  iotests: Add -o and --no-opts to _make_test_img
  iotests: Inject space into -ocompat=0.10 in 051
  iotests: Replace IMGOPTS= by -o
  iotests: Replace IMGOPTS='' by --no-opts
  iotests: Drop IMGOPTS use in 267
  iotests: Avoid qemu-img create
  iotests: Use _rm_test_img for deleting test images
  iotests: Avoid cp/mv of test images
  iotests: Make 091 work with data_file
  iotests: Make 110 work with data_file
  iotests: Make 137 work with data_file
  iotests: Make 198 work with data_file
  iotests: Disable data_file where it cannot be used
  iotests: Allow check -o data_file

 tests/qemu-iotests/005           |  2 +-
 tests/qemu-iotests/007           |  5 ++-
 tests/qemu-iotests/014           |  2 +
 tests/qemu-iotests/015           |  5 ++-
 tests/qemu-iotests/019           |  6 +--
 tests/qemu-iotests/020           |  6 +--
 tests/qemu-iotests/024           | 10 ++---
 tests/qemu-iotests/026           |  5 ++-
 tests/qemu-iotests/028           |  2 +-
 tests/qemu-iotests/029           |  7 ++--
 tests/qemu-iotests/031           |  9 ++--
 tests/qemu-iotests/031.out       | 36 ++++++++--------
 tests/qemu-iotests/036           | 15 ++++---
 tests/qemu-iotests/036.out       | 66 ++++-------------------------
 tests/qemu-iotests/039           | 27 +++++-------
 tests/qemu-iotests/039.out       | 22 +++++-----
 tests/qemu-iotests/043           |  4 +-
 tests/qemu-iotests/046           |  2 +
 tests/qemu-iotests/048           |  4 +-
 tests/qemu-iotests/050           |  8 +---
 tests/qemu-iotests/051           |  7 ++--
 tests/qemu-iotests/053           |  4 +-
 tests/qemu-iotests/058           |  7 ++--
 tests/qemu-iotests/059           | 20 ++++-----
 tests/qemu-iotests/060           | 12 +++---
 tests/qemu-iotests/060.out       | 20 ++++-----
 tests/qemu-iotests/061           | 61 ++++++++++++++-------------
 tests/qemu-iotests/061.out       | 72 ++++++++++++++++----------------
 tests/qemu-iotests/062           |  3 +-
 tests/qemu-iotests/063           | 18 ++++----
 tests/qemu-iotests/063.out       |  3 +-
 tests/qemu-iotests/066           |  3 +-
 tests/qemu-iotests/067           |  6 ++-
 tests/qemu-iotests/068           |  4 +-
 tests/qemu-iotests/069           |  2 +-
 tests/qemu-iotests/071           |  7 +++-
 tests/qemu-iotests/073           |  2 +
 tests/qemu-iotests/074           |  4 +-
 tests/qemu-iotests/079           |  3 +-
 tests/qemu-iotests/080           |  7 ++--
 tests/qemu-iotests/081           |  6 +--
 tests/qemu-iotests/085           | 18 ++++----
 tests/qemu-iotests/085.out       |  8 ++--
 tests/qemu-iotests/088           |  2 +-
 tests/qemu-iotests/090           |  2 +
 tests/qemu-iotests/091           |  2 +-
 tests/qemu-iotests/091.out       |  2 -
 tests/qemu-iotests/092           |  2 +-
 tests/qemu-iotests/094           |  4 +-
 tests/qemu-iotests/095           |  5 ++-
 tests/qemu-iotests/098           |  6 ++-
 tests/qemu-iotests/099           | 10 +++--
 tests/qemu-iotests/103           |  5 ++-
 tests/qemu-iotests/106           |  2 +-
 tests/qemu-iotests/108           |  8 ++--
 tests/qemu-iotests/109           |  4 +-
 tests/qemu-iotests/110           | 11 +++--
 tests/qemu-iotests/110.out       |  4 +-
 tests/qemu-iotests/111           |  3 +-
 tests/qemu-iotests/112           | 37 ++++++++--------
 tests/qemu-iotests/114           |  2 +
 tests/qemu-iotests/115           |  3 +-
 tests/qemu-iotests/121           |  9 ++--
 tests/qemu-iotests/122           |  6 ++-
 tests/qemu-iotests/123           |  4 +-
 tests/qemu-iotests/125           |  2 +-
 tests/qemu-iotests/137           | 17 +++++---
 tests/qemu-iotests/137.out       |  6 +--
 tests/qemu-iotests/138           |  5 ++-
 tests/qemu-iotests/141           |  4 +-
 tests/qemu-iotests/142           |  2 +-
 tests/qemu-iotests/144           |  4 +-
 tests/qemu-iotests/153           | 12 ++----
 tests/qemu-iotests/156           | 10 ++++-
 tests/qemu-iotests/159           |  2 +-
 tests/qemu-iotests/160           |  3 +-
 tests/qemu-iotests/161           |  4 +-
 tests/qemu-iotests/170           |  2 +-
 tests/qemu-iotests/172           |  6 +--
 tests/qemu-iotests/173           |  3 +-
 tests/qemu-iotests/174           |  2 +-
 tests/qemu-iotests/175           |  2 +-
 tests/qemu-iotests/176           |  7 +++-
 tests/qemu-iotests/178           |  6 +--
 tests/qemu-iotests/182           |  2 +-
 tests/qemu-iotests/183           |  2 +-
 tests/qemu-iotests/185           |  4 +-
 tests/qemu-iotests/187           |  6 +--
 tests/qemu-iotests/190           |  4 +-
 tests/qemu-iotests/191           | 11 ++---
 tests/qemu-iotests/195           |  2 +-
 tests/qemu-iotests/197           |  6 +--
 tests/qemu-iotests/198           |  6 ++-
 tests/qemu-iotests/198.out       |  4 +-
 tests/qemu-iotests/200           |  7 ++--
 tests/qemu-iotests/201           |  6 +--
 tests/qemu-iotests/214           |  3 +-
 tests/qemu-iotests/215           |  6 +--
 tests/qemu-iotests/217           |  3 +-
 tests/qemu-iotests/220           |  5 ++-
 tests/qemu-iotests/225           |  2 +-
 tests/qemu-iotests/229           |  3 +-
 tests/qemu-iotests/232           |  4 +-
 tests/qemu-iotests/243           | 10 +++--
 tests/qemu-iotests/244           | 15 ++++---
 tests/qemu-iotests/247           |  4 +-
 tests/qemu-iotests/249           |  4 +-
 tests/qemu-iotests/250           |  5 ++-
 tests/qemu-iotests/252           |  2 +-
 tests/qemu-iotests/265           |  2 +-
 tests/qemu-iotests/267           | 17 +++++---
 tests/qemu-iotests/common.filter | 47 ++++++++++++++++++++-
 tests/qemu-iotests/common.rc     | 63 ++++++++++++++++++++++++----
 tests/qemu-iotests/qcow2.py      | 23 ++++++++--
 114 files changed, 599 insertions(+), 451 deletions(-)

-- 
2.21.0



^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:37   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits Max Reitz
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

This is useful for tests that want to whitelist fields from dump-header
(with grep) but still print all header extensions.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/qcow2.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index b392972d1b..d813b4fc81 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -154,6 +154,10 @@ def cmd_dump_header(fd):
     h.dump()
     h.dump_extensions()
 
+def cmd_dump_header_exts(fd):
+    h = QcowHeader(fd)
+    h.dump_extensions()
+
 def cmd_set_header(fd, name, value):
     try:
         value = int(value, 0)
@@ -230,6 +234,7 @@ def cmd_set_feature_bit(fd, group, bit):
 
 cmds = [
     [ 'dump-header',          cmd_dump_header,          0, 'Dump image header and header extensions' ],
+    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],
     [ 'set-header',           cmd_set_header,           2, 'Set a field in the header'],
     [ 'add-header-ext',       cmd_add_header_ext,       2, 'Add a header extension' ],
     [ 'add-header-ext-stdio', cmd_add_header_ext_stdio, 1, 'Add a header extension, data from stdin' ],
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
  2019-10-15 14:27 ` [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:37   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 03/21] iotests: Add _filter_json_filename Max Reitz
                   ` (20 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Print the feature fields as a set of bits so that filtering is easier.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/031.out  | 36 +++++++++----------
 tests/qemu-iotests/036.out  | 18 +++++-----
 tests/qemu-iotests/039.out  | 22 ++++++------
 tests/qemu-iotests/060.out  | 20 +++++------
 tests/qemu-iotests/061.out  | 72 ++++++++++++++++++-------------------
 tests/qemu-iotests/137.out  |  2 +-
 tests/qemu-iotests/qcow2.py | 18 +++++++---
 7 files changed, 99 insertions(+), 89 deletions(-)

diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out
index 68a74d03b9..d535e407bc 100644
--- a/tests/qemu-iotests/031.out
+++ b/tests/qemu-iotests/031.out
@@ -18,9 +18,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -46,9 +46,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -74,9 +74,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -109,9 +109,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -142,9 +142,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -175,9 +175,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out
index e489b44386..15229a9604 100644
--- a/tests/qemu-iotests/036.out
+++ b/tests/qemu-iotests/036.out
@@ -16,9 +16,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x8000000000000000
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     [63]
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -50,9 +50,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x8000000000000000
+incompatible_features     []
+compatible_features       []
+autoclear_features        [63]
 refcount_order            4
 header_length             104
 
@@ -78,9 +78,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
index 2e356d51b6..bdafa3ace3 100644
--- a/tests/qemu-iotests/039.out
+++ b/tests/qemu-iotests/039.out
@@ -4,7 +4,7 @@ QA output created by 039
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-incompatible_features     0x0
+incompatible_features     []
 No errors were found on the image.
 
 == Creating a dirty image file ==
@@ -12,7 +12,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x1
+incompatible_features     [0]
 ERROR cluster 5 refcount=0 reference=1
 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
 
@@ -22,7 +22,7 @@ Data may be corrupted, or further writes to the image may corrupt it.
 == Read-only access must still work ==
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-incompatible_features     0x1
+incompatible_features     [0]
 
 == Repairing the image file must succeed ==
 ERROR cluster 5 refcount=0 reference=1
@@ -36,7 +36,7 @@ The following inconsistencies were found and repaired:
 
 Double checking the fixed image now...
 No errors were found on the image.
-incompatible_features     0x0
+incompatible_features     []
 
 == Data should still be accessible after repair ==
 read 512/512 bytes at offset 0
@@ -47,21 +47,21 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x1
+incompatible_features     [0]
 ERROR cluster 5 refcount=0 reference=1
 Rebuilding refcount structure
 Repairing cluster 1 refcount=1 reference=0
 Repairing cluster 2 refcount=1 reference=0
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-incompatible_features     0x0
+incompatible_features     []
 
 == Creating an image file with lazy_refcounts=off ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x0
+incompatible_features     []
 No errors were found on the image.
 
 == Committing to a backing file with lazy_refcounts=on ==
@@ -70,8 +70,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Image committed.
-incompatible_features     0x0
-incompatible_features     0x0
+incompatible_features     []
+incompatible_features     []
 No errors were found on the image.
 No errors were found on the image.
 
@@ -80,7 +80,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x1
+incompatible_features     [0]
 ERROR cluster 5 refcount=0 reference=1
 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
 
@@ -90,6 +90,6 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x0
+incompatible_features     []
 No errors were found on the image.
 *** done
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
index 0f6b0658a1..d27692a33c 100644
--- a/tests/qemu-iotests/060.out
+++ b/tests/qemu-iotests/060.out
@@ -7,10 +7,10 @@ ERROR cluster 3 refcount=1 reference=3
 
 1 errors were found on the image.
 Data may be corrupted, or further writes to the image may corrupt it.
-incompatible_features     0x0
+incompatible_features     []
 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with active L1 table); further corruption events will be suppressed
 write failed: Input/output error
-incompatible_features     0x2
+incompatible_features     [1]
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 virtual size: 64 MiB (67108864 bytes)
@@ -33,10 +33,10 @@ ERROR cluster 2 refcount=1 reference=2
 
 2 errors were found on the image.
 Data may be corrupted, or further writes to the image may corrupt it.
-incompatible_features     0x0
+incompatible_features     []
 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed
 write failed: Input/output error
-incompatible_features     0x2
+incompatible_features     [1]
 ERROR refcount block 0 refcount=2
 ERROR cluster 2 refcount=1 reference=2
 Rebuilding refcount structure
@@ -49,10 +49,10 @@ The following inconsistencies were found and repaired:
 
 Double checking the fixed image now...
 No errors were found on the image.
-incompatible_features     0x0
+incompatible_features     []
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-incompatible_features     0x0
+incompatible_features     []
 
 === Testing cluster data reference into inactive L2 table ===
 
@@ -69,10 +69,10 @@ Data may be corrupted, or further writes to the image may corrupt it.
 
 1 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
-incompatible_features     0x0
+incompatible_features     []
 qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with inactive L2 table); further corruption events will be suppressed
 write failed: Input/output error
-incompatible_features     0x2
+incompatible_features     [1]
 ERROR cluster 4 refcount=1 reference=2
 Leaked cluster 9 refcount=1 reference=0
 Repairing cluster 4 refcount=1 reference=2
@@ -85,10 +85,10 @@ The following inconsistencies were found and repaired:
 
 Double checking the fixed image now...
 No errors were found on the image.
-incompatible_features     0x0
+incompatible_features     []
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-incompatible_features     0x0
+incompatible_features     []
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 No errors were found on the image.
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index d6a7c2af95..8b3091a412 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -18,9 +18,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x1
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       [0]
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -42,9 +42,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -76,9 +76,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x1
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       [0]
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -100,9 +100,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -132,9 +132,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x1
-compatible_features       0x1
-autoclear_features        0x0
+incompatible_features     [0]
+compatible_features       [0]
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -161,9 +161,9 @@ refcount_table_offset     0x80000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -187,9 +187,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x40000000000
-autoclear_features        0x40000000000
+incompatible_features     []
+compatible_features       [42]
+autoclear_features        [42]
 refcount_order            4
 header_length             104
 
@@ -211,9 +211,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -237,9 +237,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             72
 
@@ -256,9 +256,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x1
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       [0]
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -290,9 +290,9 @@ refcount_table_offset     0x10000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x1
-compatible_features       0x1
-autoclear_features        0x0
+incompatible_features     [0]
+compatible_features       [0]
+autoclear_features        []
 refcount_order            4
 header_length             104
 
@@ -319,9 +319,9 @@ refcount_table_offset     0x80000
 refcount_table_clusters   1
 nb_snapshots              0
 snapshot_offset           0x0
-incompatible_features     0x0
-compatible_features       0x0
-autoclear_features        0x0
+incompatible_features     []
+compatible_features       []
+autoclear_features        []
 refcount_order            4
 header_length             104
 
diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
index 1c6569eb2c..bd4523a853 100644
--- a/tests/qemu-iotests/137.out
+++ b/tests/qemu-iotests/137.out
@@ -36,7 +36,7 @@ qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     0x0
+incompatible_features     []
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index d813b4fc81..91e4420b9f 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -42,9 +42,9 @@ class QcowHeader:
         [ uint64_t, '%#x',  'snapshot_offset' ],
 
         # Version 3 header fields
-        [ uint64_t, '%#x',  'incompatible_features' ],
-        [ uint64_t, '%#x',  'compatible_features' ],
-        [ uint64_t, '%#x',  'autoclear_features' ],
+        [ uint64_t, 'mask', 'incompatible_features' ],
+        [ uint64_t, 'mask', 'compatible_features' ],
+        [ uint64_t, 'mask', 'autoclear_features' ],
         [ uint32_t, '%d',   'refcount_order' ],
         [ uint32_t, '%d',   'header_length' ],
     ];
@@ -130,7 +130,17 @@ class QcowHeader:
 
     def dump(self):
         for f in QcowHeader.fields:
-            print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
+            value = self.__dict__[f[2]]
+            if f[1] == 'mask':
+                bits = []
+                for bit in range(64):
+                    if value & (1 << bit):
+                        bits.append(bit)
+                value_str = str(bits)
+            else:
+                value_str = f[1] % value
+
+            print("%-25s" % f[2], value_str)
         print("")
 
     def dump_extensions(self):
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 03/21] iotests: Add _filter_json_filename
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
  2019-10-15 14:27 ` [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts Max Reitz
  2019-10-15 14:27 ` [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:44   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 04/21] iotests: Filter refcount_order in 036 Max Reitz
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/common.filter | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 9f418b4881..63bc6f6f26 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -227,5 +227,29 @@ _filter_qmp_empty_return()
     grep -v '{"return": {}}'
 }
 
+_filter_json_filename()
+{
+    $PYTHON -c 'import sys
+result, *fnames = sys.stdin.read().split("json:{")
+depth = 0
+for fname in fnames:
+    depth += 1 # For the opening brace in the split separator
+    for chr_i, chr in enumerate(fname):
+        if chr == "{":
+            depth += 1
+        elif chr == "}":
+            depth -= 1
+            if depth == 0:
+                break
+
+    # json:{} filenames may be nested; filter out everything from
+    # inside the outermost one
+    if depth == 0:
+        chr_i += 1 # First character past the filename
+        result += "json:{ /* filtered */ }" + fname[chr_i:]
+
+sys.stdout.write(result)'
+}
+
 # make sure this script returns success
 true
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 04/21] iotests: Filter refcount_order in 036
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (2 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 03/21] iotests: Add _filter_json_filename Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:45   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts Max Reitz
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

This test can run just fine with other values for refcount_bits, so we
should filter the value from qcow2.py's dump-header.  In fact, we can
filter everything but the feature bits and header extensions, because
that is what the test is about.

(036 currently ignores user-specified image options, but that will be
fixed in the next patch.)

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/036     |  9 ++++---
 tests/qemu-iotests/036.out | 48 --------------------------------------
 2 files changed, 6 insertions(+), 51 deletions(-)

diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index f06ff67408..5f929ad3be 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -55,7 +55,8 @@ $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
 
 # Without feature table
 $PYTHON qcow2.py "$TEST_IMG" del-header-ext 0x6803f857
-$PYTHON qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
+$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
 _img_info
 
 # With feature table containing bit 63
@@ -103,14 +104,16 @@ echo === Create image with unknown autoclear feature bit ===
 echo
 _make_test_img 64M
 $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
-$PYTHON qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
+$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
 
 echo
 echo === Repair image ===
 echo
 _check_test_img -r all
 
-$PYTHON qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
+$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
 
 # success, all done
 echo "*** done"
diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out
index 15229a9604..0b52b934e1 100644
--- a/tests/qemu-iotests/036.out
+++ b/tests/qemu-iotests/036.out
@@ -3,25 +3,9 @@ QA output created by 036
 === Image with unknown incompatible feature bit ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-magic                     0x514649fb
-version                   3
-backing_file_offset       0x0
-backing_file_size         0x0
-cluster_bits              16
-size                      67108864
-crypt_method              0
-l1_size                   1
-l1_table_offset           0x30000
-refcount_table_offset     0x10000
-refcount_table_clusters   1
-nb_snapshots              0
-snapshot_offset           0x0
 incompatible_features     [63]
 compatible_features       []
 autoclear_features        []
-refcount_order            4
-header_length             104
-
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): Unknown incompatible feature: 8000000000000000
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): Test feature
 
@@ -37,25 +21,9 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): tes
 === Create image with unknown autoclear feature bit ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-magic                     0x514649fb
-version                   3
-backing_file_offset       0x0
-backing_file_size         0x0
-cluster_bits              16
-size                      67108864
-crypt_method              0
-l1_size                   1
-l1_table_offset           0x30000
-refcount_table_offset     0x10000
-refcount_table_clusters   1
-nb_snapshots              0
-snapshot_offset           0x0
 incompatible_features     []
 compatible_features       []
 autoclear_features        [63]
-refcount_order            4
-header_length             104
-
 Header extension:
 magic                     0x6803f857
 length                    192
@@ -65,25 +33,9 @@ data                      <binary>
 === Repair image ===
 
 No errors were found on the image.
-magic                     0x514649fb
-version                   3
-backing_file_offset       0x0
-backing_file_size         0x0
-cluster_bits              16
-size                      67108864
-crypt_method              0
-l1_size                   1
-l1_table_offset           0x30000
-refcount_table_offset     0x10000
-refcount_table_clusters   1
-nb_snapshots              0
-snapshot_offset           0x0
 incompatible_features     []
 compatible_features       []
 autoclear_features        []
-refcount_order            4
-header_length             104
-
 Header extension:
 magic                     0x6803f857
 length                    192
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (3 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 04/21] iotests: Filter refcount_order in 036 Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:45   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 06/21] iotests: Drop compat=1.1 in 050 Max Reitz
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Some tests require compat=1.1 and thus set IMGOPTS='compat=1.1'
globally.  That is not how it should be done; instead, they should
simply set _unsupported_imgopts to compat=0.10 (compat=1.1 is the
default anyway).

This makes the tests heed user-specified $IMGOPTS.  Some do not work
with all image options, though, so we need to disable them accordingly.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/036 | 3 +--
 tests/qemu-iotests/060 | 4 ++--
 tests/qemu-iotests/062 | 3 ++-
 tests/qemu-iotests/066 | 3 ++-
 tests/qemu-iotests/068 | 3 ++-
 tests/qemu-iotests/098 | 4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index 5f929ad3be..bbaf0ef45b 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -43,9 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qcow2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto file
-
 # Only qcow2v3 and later supports feature bits
-IMGOPTS="compat=1.1"
+_unsupported_imgopts 'compat=0.10'
 
 echo
 echo === Image with unknown incompatible feature bit ===
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index b91d8321bb..9c2ef42522 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -48,6 +48,8 @@ _filter_io_error()
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# These tests only work for compat=1.1 images with refcount_bits=16
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
 rt_offset=65536  # 0x10000 (XXX: just an assumption)
 rb_offset=131072 # 0x20000 (XXX: just an assumption)
@@ -55,8 +57,6 @@ l1_offset=196608 # 0x30000 (XXX: just an assumption)
 l2_offset=262144 # 0x40000 (XXX: just an assumption)
 l2_offset_after_snapshot=524288 # 0x80000 (XXX: just an assumption)
 
-IMGOPTS="compat=1.1"
-
 OPEN_RW="open -o overlap-check=all $TEST_IMG"
 # Overlap checks are done before write operations only, therefore opening an
 # image read-only makes the overlap-check option irrelevant
diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
index d5f818fcce..ac0d2a9a3b 100755
--- a/tests/qemu-iotests/062
+++ b/tests/qemu-iotests/062
@@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qocw2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto generic
+# We need zero clusters and snapshots
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
 
-IMGOPTS="compat=1.1"
 IMG_SIZE=64M
 
 echo
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
index 28f8c98412..00eb80d89e 100755
--- a/tests/qemu-iotests/066
+++ b/tests/qemu-iotests/066
@@ -39,9 +39,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qocw2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto generic
+# We need zero clusters and snapshots
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
 
 # Intentionally create an unaligned image
-IMGOPTS="compat=1.1"
 IMG_SIZE=$((64 * 1024 * 1024 + 512))
 
 echo
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
index 22f5ca3ba6..65650fca9a 100755
--- a/tests/qemu-iotests/068
+++ b/tests/qemu-iotests/068
@@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qocw2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto generic
+# Internal snapshots are (currently) impossible with refcount_bits=1
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
 
-IMGOPTS="compat=1.1"
 IMG_SIZE=128K
 
 case "$QEMU_DEFAULT_MACHINE" in
diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
index 1c1d1c468f..700068b328 100755
--- a/tests/qemu-iotests/098
+++ b/tests/qemu-iotests/098
@@ -40,8 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
-
-IMGOPTS="compat=1.1"
+# The code path we want to test here only works for compat=1.1 images
+_unsupported_imgopts 'compat=0.10'
 
 for event in l1_update empty_image_prepare reftable_update refblock_alloc; do
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 06/21] iotests: Drop compat=1.1 in 050
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (4 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 07/21] iotests: Let _make_test_img parse its parameters Max Reitz
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

IMGOPTS can never be empty for qcow2, because the check scripts adds
compat=1.1 unless the user specified any compat option themselves.
Thus, this block does not do anything and can be dropped.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/050 | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
index 211fc00797..272ecab195 100755
--- a/tests/qemu-iotests/050
+++ b/tests/qemu-iotests/050
@@ -41,10 +41,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2 qed
 _supported_proto file
 
-if test "$IMGFMT" = qcow2 && test $IMGOPTS = ""; then
-  IMGOPTS=compat=1.1
-fi
-
 echo
 echo "== Creating images =="
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 07/21] iotests: Let _make_test_img parse its parameters
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (5 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 06/21] iotests: Drop compat=1.1 in 050 Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 08/21] iotests: Add -o and --no-opts to _make_test_img Max Reitz
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

This will allow us to add more options than just -b.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/common.rc | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 12b4751848..3e7adc4834 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -282,12 +282,12 @@ _make_test_img()
     # extra qemu-img options can be added by tests
     # at least one argument (the image size) needs to be added
     local extra_img_options=""
-    local image_size=$*
     local optstr=""
     local img_name=""
     local use_backing=0
     local backing_file=""
     local object_options=""
+    local misc_params=()
 
     if [ -n "$TEST_IMG_FILE" ]; then
         img_name=$TEST_IMG_FILE
@@ -303,11 +303,23 @@ _make_test_img()
         optstr=$(_optstr_add "$optstr" "key-secret=keysec0")
     fi
 
-    if [ "$1" = "-b" ]; then
-        use_backing=1
-        backing_file=$2
-        image_size=$3
-    fi
+    for param; do
+        if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
+            backing_file=$param
+            continue
+        fi
+
+        case "$param" in
+            -b)
+                use_backing=1
+                ;;
+
+            *)
+                misc_params=("${misc_params[@]}" "$param")
+                ;;
+        esac
+    done
+
     if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
         optstr=$(_optstr_add "$optstr" "cluster_size=$CLUSTER_SIZE")
     fi
@@ -323,9 +335,9 @@ _make_test_img()
     # XXX(hch): have global image options?
     (
      if [ $use_backing = 1 ]; then
-        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
+        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" "${misc_params[@]}" 2>&1
      else
-        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
+        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" "${misc_params[@]}" 2>&1
      fi
     ) | _filter_img_create
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 08/21] iotests: Add -o and --no-opts to _make_test_img
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (6 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 07/21] iotests: Let _make_test_img parse its parameters Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 09/21] iotests: Inject space into -ocompat=0.10 in 051 Max Reitz
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Blindly overriding IMGOPTS is suboptimal as this discards user-specified
options.  Whatever options the test needs should simply be appended.

Some tests do this (with IMGOPTS=$(_optstr_add "$IMGOPTS" "...")), but
that is cumbersome.  It’s simpler to just give _make_test_img an -o
parameter with which tests can add options.

Some tests actually must override the user-specified options, though,
for example when creating an image in a different format than the test
$IMGFMT.  For such cases, --no-opts allows clearing the current option
list.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/common.rc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 3e7adc4834..f3784077de 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -287,6 +287,7 @@ _make_test_img()
     local use_backing=0
     local backing_file=""
     local object_options=""
+    local opts_param=false
     local misc_params=()
 
     if [ -n "$TEST_IMG_FILE" ]; then
@@ -307,6 +308,10 @@ _make_test_img()
         if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
             backing_file=$param
             continue
+        elif $opts_param; then
+            optstr=$(_optstr_add "$optstr" "$param")
+            opts_param=false
+            continue
         fi
 
         case "$param" in
@@ -314,6 +319,14 @@ _make_test_img()
                 use_backing=1
                 ;;
 
+            -o)
+                opts_param=true
+                ;;
+
+            --no-opts)
+                optstr=""
+                ;;
+
             *)
                 misc_params=("${misc_params[@]}" "$param")
                 ;;
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 09/21] iotests: Inject space into -ocompat=0.10 in 051
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (7 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 08/21] iotests: Add -o and --no-opts to _make_test_img Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o Max Reitz
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

It did not matter before, but now that _make_test_img understands -o, we
should use it properly here.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/051 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 53bcdbc911..9cd1d60d45 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -157,7 +157,7 @@ echo
 echo === With version 2 images enabling lazy refcounts must fail ===
 echo
 
-_make_test_img -ocompat=0.10 $size
+_make_test_img -o compat=0.10 $size
 
 run_qemu -drive file="$TEST_IMG",format=qcow2,lazy-refcounts=on
 run_qemu -drive file="$TEST_IMG",format=qcow2,lazy-refcounts=off
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (8 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 09/21] iotests: Inject space into -ocompat=0.10 in 051 Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:47   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 11/21] iotests: Replace IMGOPTS='' by --no-opts Max Reitz
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

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 <mreitz@redhat.com>
---
 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 "compat=1.1,lazy_refcounts=on" $size
 
 _NO_VALGRIND \
 $QEMU_IO -c "reopen -o lazy-refcounts=off" \
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 10bfbaecec..3941c3f0c2 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -70,18 +70,18 @@ poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00"
 
 echo
 echo "=== Testing monolithicFlat creation and opening ==="
-IMGOPTS="subformat=monolithicFlat" _make_test_img 2G
+_make_test_img -o "subformat=monolithicFlat" 2G
 _img_info
 _cleanup_test_img
 
 echo
 echo "=== Testing monolithicFlat with zeroed_grain ==="
-IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G
+_make_test_img -o "subformat=monolithicFlat,zeroed_grain=on" 2G
 _cleanup_test_img
 
 echo
 echo "=== Testing big twoGbMaxExtentFlat ==="
-IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G
+_make_test_img -o "subformat=twoGbMaxExtentFlat" 1000G
 $QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/'
 _cleanup_test_img
 
@@ -101,13 +101,13 @@ _img_info
 
 echo
 echo "=== Testing truncated sparse ==="
-IMGOPTS="subformat=monolithicSparse" _make_test_img 100G
+_make_test_img -o "subformat=monolithicSparse" 100G
 truncate -s 10M $TEST_IMG
 _img_info
 
 echo
 echo "=== Converting to streamOptimized from image with small cluster size==="
-TEST_IMG="$TEST_IMG.qcow2" IMGFMT=qcow2 IMGOPTS="cluster_size=4096" _make_test_img 1G
+TEST_IMG="$TEST_IMG.qcow2" IMGFMT=qcow2 _make_test_img -o "cluster_size=4096" 1G
 $QEMU_IO -f qcow2 -c "write -P 0xa 0 512" "$TEST_IMG.qcow2" | _filter_qemu_io
 $QEMU_IO -f qcow2 -c "write -P 0xb 10240 512" "$TEST_IMG.qcow2" | _filter_qemu_io
 $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2" "$TEST_IMG" 2>&1
@@ -117,7 +117,7 @@ echo "=== Testing monolithicFlat with internally generated JSON file name ==="
 
 echo '--- blkdebug ---'
 # Should work, because bdrv_dirname() works fine with blkdebug
-IMGOPTS="subformat=monolithicFlat" _make_test_img 64M
+_make_test_img -o "subformat=monolithicFlat" 64M
 $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \
          -c info \
     2>&1 \
@@ -126,7 +126,7 @@ _cleanup_test_img
 
 echo '--- quorum ---'
 # Should not work, because bdrv_dirname() does not work with quorum
-IMGOPTS="subformat=monolithicFlat" _make_test_img 64M
+_make_test_img -o "subformat=monolithicFlat" 64M
 cp "$TEST_IMG" "$TEST_IMG.orig"
 
 filename="json:{
@@ -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
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index 9c2ef42522..92243c2edd 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -158,7 +158,7 @@ $QEMU_IO -c 'write 0k 64k' "$BACKING_IMG" | _filter_qemu_io
 # compat=0.10 is required in order to make the following discard actually
 # unallocate the sector rather than make it a zero sector - we want COW, after
 # all.
-IMGOPTS='compat=0.10' _make_test_img -b "$BACKING_IMG" 1G
+_make_test_img -o 'compat=0.10' -b "$BACKING_IMG" 1G
 # Write two clusters, the second one enforces creation of an L2 table after
 # the first data cluster.
 $QEMU_IO -c 'write 0k 64k' -c 'write 512M 64k' "$TEST_IMG" | _filter_qemu_io
@@ -398,7 +398,7 @@ echo
 echo "=== Discarding a non-covered in-bounds refblock ==="
 echo
 
-IMGOPTS='refcount_bits=1' _make_test_img 64M
+_make_test_img -o 'refcount_bits=1' 64M
 
 # Pretend there's a refblock somewhere where there is no refblock to
 # cover it (but the covering refblock has a valid index in the
@@ -422,7 +422,7 @@ echo
 echo "=== Discarding a refblock covered by an unaligned refblock ==="
 echo
 
-IMGOPTS='refcount_bits=1' _make_test_img 64M
+_make_test_img -o 'refcount_bits=1' 64M
 
 # Same as above
 poke_file "$TEST_IMG" "$(($rt_offset+8))" "\x00\x00\x00\x10\x00\x00\x00\x00"
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index 4eac5b83bd..0480be0141 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -41,11 +41,14 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# Conversion between different compat versions can only really work
+# with refcount_bits=16
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
 echo
 echo "=== Testing version downgrade with zero expansion ==="
 echo
-IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
+_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
 $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
 $PYTHON qcow2.py "$TEST_IMG" dump-header
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
@@ -56,7 +59,7 @@ _check_test_img
 echo
 echo "=== Testing version downgrade with zero expansion and 4K cache entries ==="
 echo
-IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
+_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
 $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "write -z 32M 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c map "$TEST_IMG" | _filter_qemu_io
@@ -72,7 +75,7 @@ _check_test_img
 echo
 echo "=== Testing dirty version downgrade ==="
 echo
-IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
+_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
 _NO_VALGRIND \
 $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
          -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
@@ -85,7 +88,7 @@ _check_test_img
 echo
 echo "=== Testing version downgrade with unknown compat/autoclear flags ==="
 echo
-IMGOPTS="compat=1.1" _make_test_img 64M
+_make_test_img -o "compat=1.1" 64M
 $PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42
 $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
 $PYTHON qcow2.py "$TEST_IMG" dump-header
@@ -96,7 +99,7 @@ _check_test_img
 echo
 echo "=== Testing version upgrade and resize ==="
 echo
-IMGOPTS="compat=0.10" _make_test_img 64M
+_make_test_img -o "compat=0.10" 64M
 $QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
 $PYTHON qcow2.py "$TEST_IMG" dump-header
 $QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG"
@@ -107,7 +110,7 @@ _check_test_img
 echo
 echo "=== Testing dirty lazy_refcounts=off ==="
 echo
-IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
+_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
 _NO_VALGRIND \
 $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
          -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
@@ -120,8 +123,8 @@ _check_test_img
 echo
 echo "=== Testing backing file ==="
 echo
-IMGOPTS="compat=1.1" _make_test_img 64M
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
+_make_test_img -o "compat=1.1" 64M
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
 $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG amend -o "backing_file=$TEST_IMG.base,backing_fmt=qcow2" "$TEST_IMG"
@@ -131,7 +134,7 @@ _check_test_img
 echo
 echo "=== Testing invalid configurations ==="
 echo
-IMGOPTS="compat=0.10" _make_test_img 64M
+_make_test_img -o "compat=0.10" 64M
 $QEMU_IMG amend -o "lazy_refcounts=on" "$TEST_IMG"
 $QEMU_IMG amend -o "compat=1.1" "$TEST_IMG" # actually valid
 $QEMU_IMG amend -o "compat=0.10,lazy_refcounts=on" "$TEST_IMG"
@@ -144,7 +147,7 @@ $QEMU_IMG amend -o "preallocation=on" "$TEST_IMG"
 echo
 echo "=== Testing correct handling of unset value ==="
 echo
-IMGOPTS="compat=1.1,cluster_size=1k" _make_test_img 64M
+_make_test_img -o "compat=1.1,cluster_size=1k" 64M
 echo "Should work:"
 $QEMU_IMG amend -o "lazy_refcounts=on" "$TEST_IMG"
 echo "Should not work:" # Just to know which of these tests actually fails
@@ -153,7 +156,7 @@ $QEMU_IMG amend -o "cluster_size=64k" "$TEST_IMG"
 echo
 echo "=== Testing zero expansion on inactive clusters ==="
 echo
-IMGOPTS="compat=1.1" _make_test_img 64M
+_make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG snapshot -c foo "$TEST_IMG"
 $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
@@ -167,7 +170,7 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
 echo
 echo "=== Testing zero expansion on shared L2 table ==="
 echo
-IMGOPTS="compat=1.1" _make_test_img 64M
+_make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG snapshot -c foo "$TEST_IMG"
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
@@ -180,9 +183,9 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
 echo
 echo "=== Testing zero expansion on backed image ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
-IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
+_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
 $QEMU_IO -c "read -P 0x2a 0 128k" -c "write -z 0 64k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
 _check_test_img
@@ -191,9 +194,9 @@ $QEMU_IO -c "read -P 0 0 64k" -c "read -P 0x2a 64k 64k" "$TEST_IMG" | _filter_qe
 echo
 echo "=== Testing zero expansion on backed inactive clusters ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
-IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
+_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
 $QEMU_IO -c "write -z 0 64k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG snapshot -c foo "$TEST_IMG"
 $QEMU_IO -c "write -P 0x42 0 128k" "$TEST_IMG" | _filter_qemu_io
@@ -207,9 +210,9 @@ $QEMU_IO -c "read -P 0 0 64k" -c "read -P 0x2a 64k 64k" "$TEST_IMG" | _filter_qe
 echo
 echo "=== Testing zero expansion on backed image with shared L2 table ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
-IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
+_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
 $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IMG snapshot -c foo "$TEST_IMG"
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
@@ -222,7 +225,7 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
 echo
 echo "=== Testing preallocated zero expansion on full image ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG" _make_test_img 64M
+TEST_IMG="$TEST_IMG" _make_test_img -o "compat=1.1" 64M
 $QEMU_IO -c "write -P 0x2a 0 64M" "$TEST_IMG" -c "write -z 0 64M" | _filter_qemu_io
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
 _check_test_img
@@ -231,8 +234,8 @@ $QEMU_IO -c "read -P 0 0 64M" "$TEST_IMG" | _filter_qemu_io
 echo
 echo "=== Testing progress report without snapshot ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 4G
-IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 4G
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 4G
+_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 4G
 $QEMU_IO -c "write -z 0  64k" \
          -c "write -z 1G 64k" \
          -c "write -z 2G 64k" \
@@ -243,8 +246,8 @@ _check_test_img
 echo
 echo "=== Testing progress report with snapshot ==="
 echo
-IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 4G
-IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 4G
+TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 4G
+_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 4G
 $QEMU_IO -c "write -z 0  64k" \
          -c "write -z 1G 64k" \
          -c "write -z 2G 64k" \
@@ -256,7 +259,7 @@ _check_test_img
 echo
 echo "=== Testing version downgrade with external data file ==="
 echo
-IMGOPTS="compat=1.1,data_file=$TEST_IMG.data" _make_test_img 64M
+_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data" 64M
 $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
 _img_info --format-specific
 _check_test_img
@@ -264,11 +267,11 @@ _check_test_img
 echo
 echo "=== Try changing the external data file ==="
 echo
-IMGOPTS="compat=1.1" _make_test_img 64M
+_make_test_img -o "compat=1.1" 64M
 $QEMU_IMG amend -o "data_file=foo" "$TEST_IMG"
 
 echo
-IMGOPTS="compat=1.1,data_file=$TEST_IMG.data" _make_test_img 64M
+_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data" 64M
 $QEMU_IMG amend -o "data_file=foo" "$TEST_IMG"
 _img_info --format-specific
 TEST_IMG="data-file.filename=$TEST_IMG.data,file.filename=$TEST_IMG" _img_info --format-specific --image-opts
@@ -281,7 +284,7 @@ TEST_IMG="data-file.filename=$TEST_IMG.data,file.filename=$TEST_IMG" _img_info -
 echo
 echo "=== Clearing and setting data-file-raw ==="
 echo
-IMGOPTS="compat=1.1,data_file=$TEST_IMG.data,data_file_raw=on" _make_test_img 64M
+_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data,data_file_raw=on" 64M
 $QEMU_IMG amend -o "data_file_raw=on" "$TEST_IMG"
 _img_info --format-specific
 _check_test_img
diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
index 81f0c21f53..162355b29a 100755
--- a/tests/qemu-iotests/079
+++ b/tests/qemu-iotests/079
@@ -44,8 +44,7 @@ echo
 cluster_sizes="16384 32768 65536 131072 262144 524288 1048576 2097152 4194304"
 
 for s in $cluster_sizes; do
-    IMGOPTS=$(_optstr_add "$IMGOPTS" "preallocation=metadata,cluster_size=$s") \
-        _make_test_img 4G
+    _make_test_img -o "preallocation=metadata,cluster_size=$s" 4G
 done
 
 # success, all done
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index ac47eaa0f5..b5d1ec4078 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -51,7 +51,7 @@ for create_mode in off falloc full; do
         echo
         echo "--- create_mode=$create_mode growth_mode=$growth_mode ---"
 
-        IMGOPTS="preallocation=$create_mode" _make_test_img ${CREATION_SIZE}K
+        _make_test_img -o "preallocation=$create_mode" ${CREATION_SIZE}K
         $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
 
         expected_size=0
diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index 9c08172237..b0a6ae597b 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -65,7 +65,7 @@ echo
 echo '=== Repairing unreferenced data cluster in new refblock area ==='
 echo
 
-IMGOPTS='cluster_size=512' _make_test_img 64M
+_make_test_img -o 'cluster_size=512' 64M
 # Allocate the first 128 kB in the image (first refblock)
 $QEMU_IO -c 'write 0 0x1b200' "$TEST_IMG" | _filter_qemu_io
 # should be 131072 == 0x20000
diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
index 706c10b600..6850225939 100755
--- a/tests/qemu-iotests/112
+++ b/tests/qemu-iotests/112
@@ -53,20 +53,20 @@ echo '=== refcount_bits limits ==='
 echo
 
 # Must be positive (non-zero)
-IMGOPTS="$IMGOPTS,refcount_bits=0" _make_test_img 64M
+_make_test_img -o "refcount_bits=0" 64M
 # Must be positive (non-negative)
-IMGOPTS="$IMGOPTS,refcount_bits=-1" _make_test_img 64M
+_make_test_img -o "refcount_bits=-1" 64M
 # May not exceed 64
-IMGOPTS="$IMGOPTS,refcount_bits=128" _make_test_img 64M
+_make_test_img -o "refcount_bits=128" 64M
 # Must be a power of two
-IMGOPTS="$IMGOPTS,refcount_bits=42" _make_test_img 64M
+_make_test_img -o "refcount_bits=42" 64M
 
 # 1 is the minimum
-IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
+_make_test_img -o "refcount_bits=1" 64M
 print_refcount_bits
 
 # 64 is the maximum
-IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
+_make_test_img -o "refcount_bits=64" 64M
 print_refcount_bits
 
 # 16 is the default
@@ -78,19 +78,19 @@ echo '=== refcount_bits and compat=0.10 ==='
 echo
 
 # Should work
-IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=16" _make_test_img 64M
+_make_test_img -o "compat=0.10,refcount_bits=16" 64M
 print_refcount_bits
 
 # Should not work
-IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=1" _make_test_img 64M
-IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=64" _make_test_img 64M
+_make_test_img -o "compat=0.10,refcount_bits=1" 64M
+_make_test_img -o "compat=0.10,refcount_bits=64" 64M
 
 
 echo
 echo '=== Snapshot limit on refcount_bits=1 ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
+_make_test_img -o "refcount_bits=1" 64M
 print_refcount_bits
 
 $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
@@ -106,7 +106,7 @@ echo
 echo '=== Snapshot limit on refcount_bits=2 ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=2" _make_test_img 64M
+_make_test_img -o "refcount_bits=2" 64M
 print_refcount_bits
 
 $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
@@ -124,7 +124,7 @@ echo
 echo '=== Compressed clusters with refcount_bits=1 ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
+_make_test_img -o "refcount_bits=1" 64M
 print_refcount_bits
 
 # Both should fit into a single host cluster; instead of failing to increase the
@@ -140,7 +140,7 @@ echo
 echo '=== MSb set in 64 bit refcount ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
+_make_test_img -o "refcount_bits=64" 64M
 print_refcount_bits
 
 $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
@@ -158,7 +158,7 @@ echo
 echo '=== Snapshot on maximum 64 bit refcount value ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
+_make_test_img -o "refcount_bits=64" 64M
 print_refcount_bits
 
 $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
@@ -239,7 +239,7 @@ echo
 echo '=== Testing too many references for check ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
+_make_test_img -o "refcount_bits=1" 64M
 print_refcount_bits
 
 # This cluster should be created at 0x50000
@@ -262,7 +262,7 @@ echo
 echo '=== Multiple walks necessary during amend ==='
 echo
 
-IMGOPTS="$IMGOPTS,refcount_bits=1,cluster_size=512" _make_test_img 64k
+_make_test_img -o "refcount_bits=1,cluster_size=512" 64k
 
 # Cluster 0 is the image header, clusters 1 to 4 are used by the L1 table, a
 # single L2 table, the reftable and a single refblock. This creates 58 data
diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
index 9ed3cb6a83..d254b18342 100755
--- a/tests/qemu-iotests/115
+++ b/tests/qemu-iotests/115
@@ -64,8 +64,7 @@ echo
 # least 256 MB. We can achieve that by using preallocation=metadata for an image
 # which has a guest disk size of 256 MB.
 
-IMGOPTS="$IMGOPTS,refcount_bits=64,cluster_size=512,preallocation=metadata" \
-    _make_test_img 256M
+_make_test_img -o "refcount_bits=64,cluster_size=512,preallocation=metadata" 256M
 
 # We know for sure that the L1 and refcount tables do not overlap with any other
 # structure because the metadata overlap checks would have caught that case.
diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
index 90a0424edb..10db813d94 100755
--- a/tests/qemu-iotests/121
+++ b/tests/qemu-iotests/121
@@ -50,7 +50,7 @@ echo
 # Preallocation speeds up the write operation, but preallocating everything will
 # destroy the purpose of the write; so preallocate one KB less than what would
 # cause a reftable growth...
-IMGOPTS='preallocation=metadata,cluster_size=1k' _make_test_img 64512K
+_make_test_img -o 'preallocation=metadata,cluster_size=1k' 64512K
 # ...and make the image the desired size afterwards.
 $QEMU_IMG resize "$TEST_IMG" 65M
 
@@ -73,7 +73,7 @@ echo
 echo '--- Test 2 ---'
 echo
 
-IMGOPTS='preallocation=metadata,cluster_size=1k' _make_test_img 64513K
+_make_test_img -o 'preallocation=metadata,cluster_size=1k' 64513K
 # This results in an L1 table growth which in turn results in some clusters at
 # the start of the image becoming free
 $QEMU_IMG resize "$TEST_IMG" 65M
@@ -96,7 +96,7 @@ echo
 echo '=== Allocating a new refcount block must not leave holes in the image ==='
 echo
 
-IMGOPTS='cluster_size=512,refcount_bits=16' _make_test_img 1M
+_make_test_img -o 'cluster_size=512,refcount_bits=16' 1M
 
 # This results in an image with 256 used clusters: the qcow2 header,
 # the refcount table, one refcount block, the L1 table, four L2 tables
diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
index 4e31aa4e5f..d510984045 100755
--- a/tests/qemu-iotests/125
+++ b/tests/qemu-iotests/125
@@ -114,7 +114,7 @@ for GROWTH_SIZE in 16 48 80; do
         for growth_mode in off metadata falloc full; do
             echo "--- cluster_size=$cluster_size growth_size=$GROWTH_SIZE create_mode=$create_mode growth_mode=$growth_mode ---"
 
-            IMGOPTS="preallocation=$create_mode,cluster_size=$cluster_size" _make_test_img ${CREATION_SIZE}
+            _make_test_img -o "preallocation=$create_mode,cluster_size=$cluster_size" ${CREATION_SIZE}
             $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
 
             host_size_0=$(get_image_size_on_host)
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 089821da0c..6cf2997577 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -117,7 +117,7 @@ $QEMU_IO \
     -c "reopen -o cache-clean-interval=-1" \
     "$TEST_IMG" | _filter_qemu_io
 
-IMGOPTS="cluster_size=256k" _make_test_img 32P
+_make_test_img -o "cluster_size=256k" 32P
 $QEMU_IO \
     -c "reopen -o l2-cache-entry-size=512,l2-cache-size=1T" \
     "$TEST_IMG" | _filter_qemu_io
diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
index 6a731370db..66ae9d5e78 100755
--- a/tests/qemu-iotests/138
+++ b/tests/qemu-iotests/138
@@ -45,8 +45,7 @@ echo
 echo '=== Check on an image with a multiple of 2^32 clusters ==='
 echo
 
-IMGOPTS=$(_optstr_add "$IMGOPTS" "cluster_size=512") \
-    _make_test_img 512
+_make_test_img -o "cluster_size=512" 512
 
 # Allocate L2 table
 $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
index 55db2803ed..020ed8e61f 100755
--- a/tests/qemu-iotests/175
+++ b/tests/qemu-iotests/175
@@ -95,7 +95,7 @@ stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_block
 for mode in off full falloc; do
     echo
     echo "== creating image with preallocation $mode =="
-    IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt
+    _make_test_img -o preallocation=$mode $size | _filter_imgfmt
     stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size
 done
 
diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
index eb766ad09f..5890ff9cfc 100755
--- a/tests/qemu-iotests/190
+++ b/tests/qemu-iotests/190
@@ -45,7 +45,7 @@ _supported_proto file
 echo "== Huge file =="
 echo
 
-IMGOPTS='cluster_size=2M' _make_test_img 2T
+_make_test_img -o 'cluster_size=2M' 2T
 
 $QEMU_IMG measure -O raw -f qcow2 "$TEST_IMG"
 $QEMU_IMG measure -O qcow2 -o cluster_size=64k -f qcow2 "$TEST_IMG"
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index 528022e8d8..21c16a32cb 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -51,8 +51,7 @@ echo === Preparing and starting VM ===
 echo
 
 TEST_IMG="${TEST_IMG}.base" _make_test_img $size
-IMGOPTS=$(_optstr_add "$IMGOPTS" "backing_fmt=$IMGFMT") \
-    TEST_IMG="${TEST_IMG}.mid" _make_test_img -b "${TEST_IMG}.base"
+TEST_IMG="${TEST_IMG}.mid" _make_test_img -o "backing_fmt=$IMGFMT" -b "${TEST_IMG}.base"
 _make_test_img -b "${TEST_IMG}.mid"
 TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid"
 
diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
index 2d62c5dcac..3769f372cb 100755
--- a/tests/qemu-iotests/220
+++ b/tests/qemu-iotests/220
@@ -37,6 +37,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# To use a different refcount width but 16 bits we need compat=1.1
+_unsupported_imgopts 'compat=0.10'
 
 echo "== Creating huge file =="
 
@@ -46,7 +48,7 @@ if ! truncate --size=513T "$TEST_IMG"; then
     _notrun "file system on $TEST_DIR does not support large enough files"
 fi
 rm "$TEST_IMG"
-IMGOPTS='cluster_size=2M,refcount_bits=1' _make_test_img 513T
+_make_test_img -o 'cluster_size=2M,refcount_bits=1' 513T
 
 echo "== Populating refcounts =="
 # We want an image with 256M refcounts * 2M clusters = 512T referenced.
diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
index e563761307..2b84b896db 100755
--- a/tests/qemu-iotests/243
+++ b/tests/qemu-iotests/243
@@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# External data files do not work with compat=0.10
+_unsupported_imgopts 'compat=0.10'
 
 for mode in off metadata falloc full; do
 
@@ -47,7 +49,7 @@ for mode in off metadata falloc full; do
     echo "=== preallocation=$mode ==="
     echo
 
-    IMGOPTS="preallocation=$mode" _make_test_img 64M
+    _make_test_img -o "preallocation=$mode" 64M
 
     printf "File size: "
     du -b $TEST_IMG | cut -f1
@@ -64,7 +66,7 @@ for mode in off metadata falloc full; do
     echo "=== External data file: preallocation=$mode ==="
     echo
 
-    IMGOPTS="data_file=$TEST_IMG.data,preallocation=$mode" _make_test_img 64M
+    _make_test_img -o "data_file=$TEST_IMG.data,preallocation=$mode" 64M
 
     echo -n "qcow2 file size: "
     du -b $TEST_IMG | cut -f1
diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
index 13978f93d2..0375bc12d4 100755
--- a/tests/qemu-iotests/244
+++ b/tests/qemu-iotests/244
@@ -41,13 +41,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# External data files do not work with compat=0.10
+_unsupported_imgopts 'compat=0.10'
 
 echo
 echo "=== Create and open image with external data file ==="
 echo
 
 echo "With data file name in the image:"
-IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
+_make_test_img -o "data_file=$TEST_IMG.data" 64M
 _check_test_img
 
 $QEMU_IO -c "open $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qemu_io | _filter_testdir
@@ -104,7 +106,7 @@ echo
 echo "=== Standalone image with external data file (efficient) ==="
 echo
 
-IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
+_make_test_img -o "data_file=$TEST_IMG.data" 64M
 
 echo -n "qcow2 file size before I/O: "
 du -b $TEST_IMG | cut -f1
@@ -154,7 +156,7 @@ echo
 echo "=== Standalone image with external data file (valid raw) ==="
 echo
 
-IMGOPTS="data_file=$TEST_IMG.data,data_file_raw=on" _make_test_img 64M
+_make_test_img -o "data_file=$TEST_IMG.data,data_file_raw=on" 64M
 
 echo -n "qcow2 file size before I/O: "
 du -b $TEST_IMG | cut -f1
@@ -187,7 +189,7 @@ echo
 echo "=== bdrv_co_block_status test for file and offset=0 ==="
 echo
 
-IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
+_make_test_img -o "data_file=$TEST_IMG.data" 64M
 
 $QEMU_IO -c 'write -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c 'read -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250
index c9c0a84a5a..670cf19076 100755
--- a/tests/qemu-iotests/250
+++ b/tests/qemu-iotests/250
@@ -55,9 +55,8 @@ disk_usage()
 }
 
 size=2100M
-IMGOPTS="cluster_size=1M,preallocation=metadata"
 
-_make_test_img $size
+_make_test_img -o "cluster_size=1M,preallocation=metadata" $size
 $QEMU_IO -c 'discard 0 10M' -c 'discard 2090M 10M' \
          -c 'write 2090M 10M' -c 'write 0 10M' "$TEST_IMG" | _filter_qemu_io
 
diff --git a/tests/qemu-iotests/265 b/tests/qemu-iotests/265
index dce6f77be3..00f2ec769e 100755
--- a/tests/qemu-iotests/265
+++ b/tests/qemu-iotests/265
@@ -41,7 +41,7 @@ _supported_os Linux
 echo '--- Writing to the image ---'
 
 # Reduce cluster size so we get more and quicker I/O
-IMGOPTS='cluster_size=4096' _make_test_img 1M
+_make_test_img -o 'cluster_size=4096' 1M
 (for ((kb = 1024 - 4; kb >= 0; kb -= 4)); do \
      echo "aio_write -P 42 $((kb + 1))k 2k"; \
  done) \
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 11/21] iotests: Replace IMGOPTS='' by --no-opts
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (9 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267 Max Reitz
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/071 | 4 ++--
 tests/qemu-iotests/174 | 2 +-
 tests/qemu-iotests/178 | 4 ++--
 tests/qemu-iotests/197 | 4 ++--
 tests/qemu-iotests/215 | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index fab526666b..4e31943244 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -58,7 +58,7 @@ echo
 echo "=== Testing blkverify through filename ==="
 echo
 
-TEST_IMG="$TEST_IMG.base" IMGOPTS="" IMGFMT="raw" _make_test_img $IMG_SIZE |\
+TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE |\
     _filter_imgfmt
 _make_test_img $IMG_SIZE
 $QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
@@ -73,7 +73,7 @@ echo
 echo "=== Testing blkverify through file blockref ==="
 echo
 
-TEST_IMG="$TEST_IMG.base" IMGOPTS="" IMGFMT="raw" _make_test_img $IMG_SIZE |\
+TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE |\
     _filter_imgfmt
 _make_test_img $IMG_SIZE
 $QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base,file.test.driver=$IMGFMT,file.test.file.filename=$TEST_IMG" \
diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174
index 0a952a73fd..e2f14a38c6 100755
--- a/tests/qemu-iotests/174
+++ b/tests/qemu-iotests/174
@@ -40,7 +40,7 @@ _unsupported_fmt raw
 
 
 size=256K
-IMGFMT=raw IMGKEYSECRET= IMGOPTS= _make_test_img $size | _filter_imgfmt
+IMGFMT=raw IMGKEYSECRET= _make_test_img --no-opts $size | _filter_imgfmt
 
 echo
 echo "== reading wrong format should fail =="
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 21231cadd3..75b5e8f314 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -62,8 +62,8 @@ $QEMU_IMG measure -O foo "$TEST_IMG" # unknown image file format
 
 make_test_img_with_fmt() {
     # Shadow global variables within this function
-    local IMGFMT="$1" IMGOPTS=""
-    _make_test_img "$2"
+    local IMGFMT="$1"
+    _make_test_img --no-opts "$2"
 }
 
 qemu_io_with_fmt() {
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index 1d4f6786db..4d3d08ad6f 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -66,8 +66,8 @@ if [ "$IMGFMT" = "vpc" ]; then
 fi
 _make_test_img 4G
 $QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
-IMGPROTO=file IMGFMT=qcow2 IMGOPTS= TEST_IMG_FILE="$TEST_WRAP" \
-    _make_test_img -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
+    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
 $QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
 
 # Ensure that a read of two clusters, but where one is already allocated,
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index 2eb377d682..55a1874dcd 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -63,8 +63,8 @@ if [ "$IMGFMT" = "vpc" ]; then
 fi
 _make_test_img 4G
 $QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
-IMGPROTO=file IMGFMT=qcow2 IMGOPTS= TEST_IMG_FILE="$TEST_WRAP" \
-    _make_test_img -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
+    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
 $QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
 
 # Ensure that a read of two clusters, but where one is already allocated,
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (10 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 11/21] iotests: Replace IMGOPTS='' by --no-opts Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:50   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 13/21] iotests: Avoid qemu-img create Max Reitz
                   ` (10 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Overwriting IMGOPTS means ignoring all user-supplied options, which is
not what we want.  Replace the current IMGOPTS use by a new BACKING_FILE
variable.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/267 | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267
index d37a67c012..eda45449d4 100755
--- a/tests/qemu-iotests/267
+++ b/tests/qemu-iotests/267
@@ -68,7 +68,11 @@ size=128M
 
 run_test()
 {
-    _make_test_img $size
+    if [ -n "$BACKING_FILE" ]; then
+        _make_test_img -b "$BACKING_FILE" $size
+    else
+        _make_test_img $size
+    fi
     printf "savevm snap0\ninfo snapshots\nloadvm snap0\n" | run_qemu "$@" | _filter_date
 }
 
@@ -119,12 +123,12 @@ echo
 
 TEST_IMG="$TEST_IMG.base" _make_test_img $size
 
-IMGOPTS="backing_file=$TEST_IMG.base" \
+BACKING_FILE="$TEST_IMG.base" \
 run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
          -blockdev driver=file,filename="$TEST_IMG",node-name=file \
          -blockdev driver=$IMGFMT,file=file,backing=backing-file,node-name=fmt
 
-IMGOPTS="backing_file=$TEST_IMG.base" \
+BACKING_FILE="$TEST_IMG.base" \
 run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
          -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \
          -blockdev driver=file,filename="$TEST_IMG",node-name=file \
@@ -141,7 +145,7 @@ echo
 echo "=== -blockdev with NBD server on the backing file ==="
 echo
 
-IMGOPTS="backing_file=$TEST_IMG.base" _make_test_img $size
+_make_test_img -b "$TEST_IMG.base" $size
 cat <<EOF |
 nbd_server_start unix:$TEST_DIR/nbd
 nbd_server_add -w backing-fmt
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 13/21] iotests: Avoid qemu-img create
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (11 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267 Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images Max Reitz
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Use _make_test_img whenever possible.  This way, we will not ignore
user-specified image options.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/094 | 2 +-
 tests/qemu-iotests/111 | 3 +--
 tests/qemu-iotests/123 | 2 +-
 tests/qemu-iotests/153 | 2 +-
 tests/qemu-iotests/200 | 4 ++--
 5 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index 9343e09492..d645952d54 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -45,7 +45,7 @@ _supported_proto nbd
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
 
 _make_test_img 64M
-$QEMU_IMG create -f $IMGFMT "$TEST_DIR/source.$IMGFMT" 64M | _filter_img_create
+TEST_IMG_FILE="$TEST_DIR/source.$IMGFMT" IMGPROTO=file _make_test_img 64M
 
 _launch_qemu -drive if=none,id=src,file="$TEST_DIR/source.$IMGFMT",format=raw \
              -nodefaults
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
index 490a5bbcb5..3b43d1bd83 100755
--- a/tests/qemu-iotests/111
+++ b/tests/qemu-iotests/111
@@ -41,8 +41,7 @@ _supported_fmt qed qcow qcow2 vmdk
 _supported_proto file
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
 
-$QEMU_IMG create -f $IMGFMT -b "$TEST_IMG.inexistent" "$TEST_IMG" 2>&1 \
-    | _filter_testdir | _filter_imgfmt
+_make_test_img -b "$TEST_IMG.inexistent"
 
 # success, all done
 echo '*** done'
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index d33950eb54..74d40d0478 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -44,7 +44,7 @@ _supported_os Linux
 SRC_IMG="$TEST_DIR/source.$IMGFMT"
 
 _make_test_img 1M
-$QEMU_IMG create -f $IMGFMT "$SRC_IMG" 1M | _filter_img_create
+TEST_IMG_FILE=$SRC_IMG IMGPROTO=file _make_test_img 1M
 
 $QEMU_IO -c 'write -P 42 0 1M' "$SRC_IMG" | _filter_qemu_io
 
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index c969a1a16f..e59090259c 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -98,7 +98,7 @@ for opts1 in "" "read-only=on" "read-only=on,force-share=on"; do
 
     echo
     echo "== Creating test image =="
-    $QEMU_IMG create -f $IMGFMT "${TEST_IMG}" -b ${TEST_IMG}.base | _filter_img_create
+    _make_test_img -b "${TEST_IMG}.base"
 
     echo
     echo "== Launching QEMU, opts: '$opts1' =="
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index 72d431f251..d904885136 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -46,8 +46,8 @@ _supported_proto file
 BACKING_IMG="${TEST_DIR}/backing.img"
 TEST_IMG="${TEST_DIR}/test.img"
 
-${QEMU_IMG} create -f $IMGFMT "${BACKING_IMG}" 512M | _filter_img_create
-${QEMU_IMG} create -f $IMGFMT -F $IMGFMT "${TEST_IMG}" -b "${BACKING_IMG}" 512M | _filter_img_create
+TEST_IMG="$BACKING_IMG" _make_test_img 512M
+_make_test_img -F $IMGFMT -b "$BACKING_IMG" 512M
 
 ${QEMU_IO} -c "write -P 0xa5 512 300M" "${BACKING_IMG}" | _filter_qemu_io
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (12 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 13/21] iotests: Avoid qemu-img create Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:47   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 15/21] iotests: Avoid cp/mv of " Max Reitz
                   ` (8 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Just rm will not delete external data files.  Use _rm_test_img every
time we delete a test image.

(In the process, clean up the indentation of every _cleanup() this patch
touches.)

((Also, use quotes consistently.  I am happy to see unquoted instances
like "rm -rf $TEST_DIR/..." go.))

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/005 |  2 +-
 tests/qemu-iotests/019 |  6 +++---
 tests/qemu-iotests/020 |  6 +++---
 tests/qemu-iotests/024 | 10 +++++-----
 tests/qemu-iotests/028 |  2 +-
 tests/qemu-iotests/029 |  2 +-
 tests/qemu-iotests/043 |  4 +++-
 tests/qemu-iotests/048 |  2 +-
 tests/qemu-iotests/050 |  4 ++--
 tests/qemu-iotests/053 |  4 ++--
 tests/qemu-iotests/058 |  2 +-
 tests/qemu-iotests/059 |  2 +-
 tests/qemu-iotests/061 |  2 +-
 tests/qemu-iotests/063 |  6 ++++--
 tests/qemu-iotests/069 |  2 +-
 tests/qemu-iotests/074 |  2 +-
 tests/qemu-iotests/080 |  2 +-
 tests/qemu-iotests/081 |  6 +++---
 tests/qemu-iotests/085 |  9 ++++++---
 tests/qemu-iotests/088 |  2 +-
 tests/qemu-iotests/092 |  2 +-
 tests/qemu-iotests/094 |  2 +-
 tests/qemu-iotests/095 |  5 +++--
 tests/qemu-iotests/099 |  7 ++++---
 tests/qemu-iotests/109 |  4 ++--
 tests/qemu-iotests/110 |  4 ++--
 tests/qemu-iotests/122 |  6 ++++--
 tests/qemu-iotests/123 |  2 +-
 tests/qemu-iotests/141 |  4 +++-
 tests/qemu-iotests/142 |  2 +-
 tests/qemu-iotests/144 |  4 +++-
 tests/qemu-iotests/153 | 10 +++-------
 tests/qemu-iotests/156 |  8 ++++++--
 tests/qemu-iotests/159 |  2 +-
 tests/qemu-iotests/160 |  3 ++-
 tests/qemu-iotests/161 |  4 ++--
 tests/qemu-iotests/170 |  2 +-
 tests/qemu-iotests/172 |  6 +++---
 tests/qemu-iotests/173 |  3 ++-
 tests/qemu-iotests/178 |  2 +-
 tests/qemu-iotests/182 |  2 +-
 tests/qemu-iotests/183 |  2 +-
 tests/qemu-iotests/185 |  4 ++--
 tests/qemu-iotests/187 |  6 +++---
 tests/qemu-iotests/190 |  2 +-
 tests/qemu-iotests/191 |  6 +++---
 tests/qemu-iotests/195 |  2 +-
 tests/qemu-iotests/197 |  2 +-
 tests/qemu-iotests/200 |  3 ++-
 tests/qemu-iotests/215 |  2 +-
 tests/qemu-iotests/225 |  2 +-
 tests/qemu-iotests/229 |  3 ++-
 tests/qemu-iotests/232 |  4 +++-
 tests/qemu-iotests/243 |  2 +-
 tests/qemu-iotests/244 |  4 ++--
 tests/qemu-iotests/247 |  4 +++-
 tests/qemu-iotests/249 |  4 ++--
 tests/qemu-iotests/252 |  2 +-
 58 files changed, 119 insertions(+), 96 deletions(-)

diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
index 58442762fe..2b651f2c37 100755
--- a/tests/qemu-iotests/005
+++ b/tests/qemu-iotests/005
@@ -62,7 +62,7 @@ if [ "$IMGFMT" = "raw" ]; then
     if ! truncate --size=5T "$TEST_IMG"; then
         _notrun "file system on $TEST_DIR does not support large enough files"
     fi
-    rm "$TEST_IMG"
+    _rm_test_img "$TEST_IMG"
 fi
 
 echo
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index b4f5234609..813a84acac 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -30,9 +30,9 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-    rm -f "$TEST_IMG.base"
-    rm -f "$TEST_IMG.orig"
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.base"
+    _rm_test_img "$TEST_IMG.orig"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index f41b92f35f..20f8f185d0 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -28,9 +28,9 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-    rm -f "$TEST_IMG.base"
-    rm -f "$TEST_IMG.orig"
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.base"
+    _rm_test_img "$TEST_IMG.orig"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index 23298c6f59..e2e766241e 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -29,12 +29,12 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_DIR/t.$IMGFMT.base_old"
-    rm -f "$TEST_DIR/t.$IMGFMT.base_new"
+    _rm_test_img "$TEST_DIR/t.$IMGFMT.base_old"
+    _rm_test_img "$TEST_DIR/t.$IMGFMT.base_new"
 
-    rm -f "$TEST_DIR/subdir/t.$IMGFMT"
-    rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_old"
-    rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_new"
+    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT"
+    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_old"
+    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_new"
     rmdir "$TEST_DIR/subdir" 2> /dev/null
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 71301ec6e5..caf1258647 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -32,7 +32,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm -f "${TEST_IMG}.copy"
+    _rm_test_img "${TEST_IMG}.copy"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index 94c2713132..9254ede5e5 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@ -28,7 +28,7 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -f $TEST_IMG.snap
+    _rm_test_img "$TEST_IMG.snap"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043
index 67cc7e74c2..b102e49208 100755
--- a/tests/qemu-iotests/043
+++ b/tests/qemu-iotests/043
@@ -29,7 +29,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG".[123].base
+    for img in "$TEST_IMG".[123].base; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
index bde408ca92..a8feb76184 100755
--- a/tests/qemu-iotests/048
+++ b/tests/qemu-iotests/048
@@ -31,7 +31,7 @@ _cleanup()
 {
     echo "Cleanup"
     _cleanup_test_img
-    rm "${TEST_IMG_FILE2}"
+    _rm_test_img "${TEST_IMG_FILE2}"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
index 272ecab195..cdc5356541 100755
--- a/tests/qemu-iotests/050
+++ b/tests/qemu-iotests/050
@@ -29,8 +29,8 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.old"
-    rm -f "$TEST_IMG.new"
+    _rm_test_img "$TEST_IMG.old"
+    _rm_test_img "$TEST_IMG.new"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
index e82bb69881..71d299c4f9 100755
--- a/tests/qemu-iotests/053
+++ b/tests/qemu-iotests/053
@@ -28,8 +28,8 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	rm -f "$TEST_IMG.orig"
-	_cleanup_test_img
+    _rm_test_img "$TEST_IMG.orig"
+    _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
index 8c3212a72f..ed01115fa3 100755
--- a/tests/qemu-iotests/058
+++ b/tests/qemu-iotests/058
@@ -42,7 +42,7 @@ _cleanup()
 {
     nbd_server_stop
     _cleanup_test_img
-    rm -f "$converted_image"
+    _rm_test_img "$converted_image"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 3941c3f0c2..5438025285 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.qcow2"
+    IMGFMT=qcow2 _rm_test_img "$TEST_IMG.qcow2"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index 0480be0141..b4076d8e8b 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.data
+    _rm_test_img "$TEST_IMG.data"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
index 7cf0427af4..eef2b8a534 100755
--- a/tests/qemu-iotests/063
+++ b/tests/qemu-iotests/063
@@ -29,8 +29,10 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-	rm -f "$TEST_IMG.orig" "$TEST_IMG.raw1" "$TEST_IMG.raw2"
+    _cleanup_test_img
+    for img in "$TEST_IMG".{orig,raw1,raw2,target}; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
index 3974714852..b997b127f0 100755
--- a/tests/qemu-iotests/069
+++ b/tests/qemu-iotests/069
@@ -47,7 +47,7 @@ echo "=== Creating an image with a backing file and deleting that file ==="
 echo
 TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
 _make_test_img -b "$TEST_IMG.base" $IMG_SIZE
-rm -f "$TEST_IMG.base"
+_rm_test_img "$TEST_IMG.base"
 # Just open the image and close it right again (this should print an error message)
 $QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
 
diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
index bb4ad1cc08..62be89a0d9 100755
--- a/tests/qemu-iotests/074
+++ b/tests/qemu-iotests/074
@@ -31,7 +31,7 @@ _cleanup()
 {
     echo "Cleanup"
     _cleanup_test_img
-    rm "${TEST_IMG2}"
+    _rm_test_img "${TEST_IMG2}"
     rm -f "$TEST_DIR/blkdebug.conf"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
index 4bcb5021e8..b1ecafb41e 100755
--- a/tests/qemu-iotests/080
+++ b/tests/qemu-iotests/080
@@ -28,7 +28,7 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -f $TEST_IMG.snap
+    _rm_test_img "$TEST_IMG.snap"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index 85acdf76d4..537d40dfd5 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -28,9 +28,9 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -rf $TEST_DIR/1.raw
-    rm -rf $TEST_DIR/2.raw
-    rm -rf $TEST_DIR/3.raw
+    _rm_test_img "$TEST_DIR/1.raw"
+    _rm_test_img "$TEST_DIR/2.raw"
+    _rm_test_img "$TEST_DIR/3.raw"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
index d40fdab542..bbea1252d2 100755
--- a/tests/qemu-iotests/085
+++ b/tests/qemu-iotests/085
@@ -41,10 +41,13 @@ _cleanup()
     _cleanup_qemu
     for i in $(seq 1 ${SNAPSHOTS})
     do
-        rm -f "${TEST_DIR}/${i}-${snapshot_virt0}"
-        rm -f "${TEST_DIR}/${i}-${snapshot_virt1}"
+        _rm_test_img "${TEST_DIR}/${i}-${snapshot_virt0}"
+        _rm_test_img "${TEST_DIR}/${i}-${snapshot_virt1}"
+    done
+    for img in "${TEST_IMG}".{1,2,base}
+    do
+        _rm_test_img "$img"
     done
-    rm -f "${TEST_IMG}" "${TEST_IMG}.1" "${TEST_IMG}.2" "${TEST_IMG}.base"
 
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088
index b44edd0cf9..ef1163346c 100755
--- a/tests/qemu-iotests/088
+++ b/tests/qemu-iotests/088
@@ -28,7 +28,7 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -f $TEST_IMG.snap
+    _rm_test_img "$TEST_IMG.snap"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092
index e2e0726de1..40ec62b6f1 100755
--- a/tests/qemu-iotests/092
+++ b/tests/qemu-iotests/092
@@ -28,7 +28,7 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -f $TEST_IMG.snap
+    _rm_test_img "$TEST_IMG.snap"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index d645952d54..2d3e1004d3 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -30,7 +30,7 @@ _cleanup()
 {
     _cleanup_qemu
     _cleanup_test_img
-    rm -f "$TEST_DIR/source.$IMGFMT"
+    _rm_test_img "$TEST_DIR/source.$IMGFMT"
 }
 
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095
index 58fe174b5e..155ae86aa7 100755
--- a/tests/qemu-iotests/095
+++ b/tests/qemu-iotests/095
@@ -32,8 +32,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm  -f "${TEST_IMG}.base" "${TEST_IMG}.snp1"
-	_cleanup_test_img
+    _rm_test_img "${TEST_IMG}.base"
+    _rm_test_img "${TEST_IMG}.snp1"
+    _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
index c3cf66798a..b383c11e6a 100755
--- a/tests/qemu-iotests/099
+++ b/tests/qemu-iotests/099
@@ -29,7 +29,10 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.compare"
+    rm -f "$TEST_DIR/blkdebug.conf"
+
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -121,8 +124,6 @@ echo
 test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG"
 
 
-rm -f "$TEST_IMG.compare" "$TEST_DIR/blkdebug.conf"
-
 # success, all done
 echo "*** done"
 rm -f $seq.full
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
index 9897ceb6cd..ba638db11f 100755
--- a/tests/qemu-iotests/109
+++ b/tests/qemu-iotests/109
@@ -29,8 +29,8 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm -f $TEST_IMG.src
-	_cleanup_test_img
+    _rm_test_img "$TEST_IMG.src"
+    _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
index 2ef516baf1..f78df0e6e1 100755
--- a/tests/qemu-iotests/110
+++ b/tests/qemu-iotests/110
@@ -28,8 +28,8 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-        rm -f "$TEST_IMG.copy"
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.copy"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
index 059011ebb1..dfa350936f 100755
--- a/tests/qemu-iotests/122
+++ b/tests/qemu-iotests/122
@@ -28,8 +28,10 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-    rm -f "$TEST_IMG".[123]
-	_cleanup_test_img
+    for img in "$TEST_IMG".[123]; do
+        _rm_test_img "$img"
+    done
+    _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index 74d40d0478..01b771c76e 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$SRC_IMG"
+    _rm_test_img "$SRC_IMG"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
index 8c2ae79f2b..5192d256e3 100755
--- a/tests/qemu-iotests/141
+++ b/tests/qemu-iotests/141
@@ -30,7 +30,9 @@ _cleanup()
 {
     _cleanup_qemu
     _cleanup_test_img
-    rm -f "$TEST_DIR"/{b,m,o}.$IMGFMT
+    for img in "$TEST_DIR"/{b,m,o}.$IMGFMT; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
index 6b62271876..daefcbaa58 100755
--- a/tests/qemu-iotests/142
+++ b/tests/qemu-iotests/142
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.snap
+    _rm_test_img "$TEST_IMG.snap"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144
index 011ed4f2bc..4569ac0b4b 100755
--- a/tests/qemu-iotests/144
+++ b/tests/qemu-iotests/144
@@ -34,7 +34,9 @@ TMP_SNAP2=${TEST_DIR}/tmp2.qcow2
 _cleanup()
 {
     _cleanup_qemu
-    rm -f "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}"
+    for img in "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}"; do
+        _rm_test_img "$img"
+    done
 }
 
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index e59090259c..2b13111768 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -30,13 +30,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "${TEST_IMG}.base"
-    rm -f "${TEST_IMG}.overlay"
-    rm -f "${TEST_IMG}.convert"
-    rm -f "${TEST_IMG}.a"
-    rm -f "${TEST_IMG}.b"
-    rm -f "${TEST_IMG}.c"
-    rm -f "${TEST_IMG}.lnk"
+    for img in "${TEST_IMG}".{base,overlay,convert,a,b,c,lnk}; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
index 2ffa3ca942..3f27db71f2 100755
--- a/tests/qemu-iotests/156
+++ b/tests/qemu-iotests/156
@@ -37,7 +37,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm -f "$TEST_IMG"{,.target}{,.backing,.overlay}
+    for img in "$TEST_IMG"{,.target}{,.backing,.overlay}; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -120,7 +122,9 @@ _send_qemu_cmd $QEMU_HANDLE \
     '"status": "null"'
 
 # Remove the source images
-rm -f "$TEST_IMG{,.backing,.overlay}"
+for img in "$TEST_IMG{,.backing,.overlay}"; do
+    _rm_test_img "$img"
+done
 
 echo
 
diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159
index 2557140ac2..f9690053a2 100755
--- a/tests/qemu-iotests/159
+++ b/tests/qemu-iotests/159
@@ -28,7 +28,7 @@ status=1
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.out"
+    _rm_test_img "$TEST_IMG.out"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160
index df89d3864b..0572b5ae9a 100755
--- a/tests/qemu-iotests/160
+++ b/tests/qemu-iotests/160
@@ -28,7 +28,8 @@ status=1
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.out" "$TEST_IMG.out.dd"
+    _rm_test_img "$TEST_IMG.out"
+    _rm_test_img "$TEST_IMG.out.dd"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
index 456a4bd8c4..f572a19af2 100755
--- a/tests/qemu-iotests/161
+++ b/tests/qemu-iotests/161
@@ -30,8 +30,8 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.base"
-    rm -f "$TEST_IMG.int"
+    _rm_test_img "$TEST_IMG.base"
+    _rm_test_img "$TEST_IMG.int"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170
index 05dd6ed6c3..6c8f0e8085 100755
--- a/tests/qemu-iotests/170
+++ b/tests/qemu-iotests/170
@@ -28,7 +28,7 @@ status=1
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.out"
+    _rm_test_img  "$TEST_IMG.out"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index d67997e5f6..7195fb895a 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -28,9 +28,9 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-    rm -f "$TEST_IMG.2"
-    rm -f "$TEST_IMG.3"
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.2"
+    _rm_test_img "$TEST_IMG.3"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173
index 9e2fa2e73c..bba26f0d2a 100755
--- a/tests/qemu-iotests/173
+++ b/tests/qemu-iotests/173
@@ -29,7 +29,8 @@ status=1    # failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm  -f "${QEMU_TEST_DIR}/image.base" "${QEMU_TEST_DIR}/image.snp1"
+    _rm_test_img "${TEST_DIR}/image.base"
+    _rm_test_img "${TEST_DIR}/image.snp1"
     _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 75b5e8f314..51a70fe669 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -29,7 +29,7 @@ status=1    # failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.converted"
+    _rm_test_img "$TEST_IMG.converted"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
index 7f494eb9bb..8de724e7ec 100755
--- a/tests/qemu-iotests/182
+++ b/tests/qemu-iotests/182
@@ -30,7 +30,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.overlay"
+    _rm_test_img "$TEST_IMG.overlay"
     rm -f "$TEST_DIR/nbd.socket"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183
index 04fb344d08..eff8e0216c 100755
--- a/tests/qemu-iotests/183
+++ b/tests/qemu-iotests/183
@@ -31,7 +31,7 @@ MIG_SOCKET="${TEST_DIR}/migrate"
 _cleanup()
 {
     rm -f "${MIG_SOCKET}"
-    rm -f "${TEST_IMG}.dest"
+    _rm_test_img "${TEST_IMG}.dest"
     _cleanup_test_img
     _cleanup_qemu
 }
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
index 454ff600cc..e50f19ebf0 100755
--- a/tests/qemu-iotests/185
+++ b/tests/qemu-iotests/185
@@ -28,8 +28,8 @@ status=1 # failure is the default!
 
 _cleanup()
 {
-    rm -f "${TEST_IMG}.mid"
-    rm -f "${TEST_IMG}.copy"
+    _rm_test_img "${TEST_IMG}.mid"
+    _rm_test_img "${TEST_IMG}.copy"
     _cleanup_test_img
     _cleanup_qemu
 }
diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187
index 2fcef9e2bd..c6e1dc57a0 100755
--- a/tests/qemu-iotests/187
+++ b/tests/qemu-iotests/187
@@ -28,9 +28,9 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-    rm -f "$TEST_IMG.2"
-    rm -f "$TEST_IMG.3"
+    _cleanup_test_img
+    _rm_test_img "$TEST_IMG.2"
+    _rm_test_img "$TEST_IMG.3"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
index 5890ff9cfc..6d41650438 100755
--- a/tests/qemu-iotests/190
+++ b/tests/qemu-iotests/190
@@ -29,7 +29,7 @@ status=1    # failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.converted"
+    _rm_test_img "$TEST_IMG.converted"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index 21c16a32cb..23ab0ce899 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -28,9 +28,9 @@ status=1 # failure is the default!
 
 _cleanup()
 {
-    rm -f "${TEST_IMG}.mid"
-    rm -f "${TEST_IMG}.ovl2"
-    rm -f "${TEST_IMG}.ovl3"
+    _rm_test_img "${TEST_IMG}.mid"
+    _rm_test_img "${TEST_IMG}.ovl2"
+    _rm_test_img "${TEST_IMG}.ovl3"
     _cleanup_test_img
     _cleanup_qemu
 }
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
index ef7b9a94e2..48984b7ac1 100755
--- a/tests/qemu-iotests/195
+++ b/tests/qemu-iotests/195
@@ -29,7 +29,7 @@ status=1 # failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.mid"
+    _rm_test_img "$TEST_IMG.mid"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index 4d3d08ad6f..95f05b0e34 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -43,7 +43,7 @@ esac
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_WRAP"
+    _rm_test_img "$TEST_WRAP"
     rm -f "$BLKDBG_CONF"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index d904885136..a2cdd7f83d 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -31,7 +31,8 @@ status=1    # failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm -f "${TEST_IMG}" "${BACKING_IMG}"
+    _rm_test_img "${TEST_IMG}"
+    _rm_test_img "${BACKING_IMG}"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index 55a1874dcd..f99bae78c7 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -40,7 +40,7 @@ esac
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_WRAP"
+    _rm_test_img "$TEST_WRAP"
     rm -f "$BLKDBG_CONF"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225
index fbd7404791..c9a334c7e9 100755
--- a/tests/qemu-iotests/225
+++ b/tests/qemu-iotests/225
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.not_base"
+    _rm_test_img "$TEST_IMG.not_base"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
index e18a464fe0..866168b236 100755
--- a/tests/qemu-iotests/229
+++ b/tests/qemu-iotests/229
@@ -31,7 +31,8 @@ _cleanup()
 {
     _cleanup_qemu
     _cleanup_test_img
-    rm -f "$TEST_IMG" "$DEST_IMG"
+    _rm_test_img "$TEST_IMG"
+    _rm_test_img "$DEST_IMG"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
index 65b0e42063..685356ac3b 100755
--- a/tests/qemu-iotests/232
+++ b/tests/qemu-iotests/232
@@ -29,7 +29,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.[01234]
+    for img in "$TEST_IMG".[01234]; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
index 2b84b896db..3dc3b6a711 100755
--- a/tests/qemu-iotests/243
+++ b/tests/qemu-iotests/243
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.data
+    _rm_test_img "$TEST_IMG.data"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
index 0375bc12d4..13263292b0 100755
--- a/tests/qemu-iotests/244
+++ b/tests/qemu-iotests/244
@@ -29,8 +29,8 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.data
-    rm -f $TEST_IMG.src
+    _rm_test_img "$TEST_IMG.data"
+    _rm_test_img "$TEST_IMG.src"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/247 b/tests/qemu-iotests/247
index c853b73819..87e37b39e2 100755
--- a/tests/qemu-iotests/247
+++ b/tests/qemu-iotests/247
@@ -29,7 +29,9 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f $TEST_IMG.[01234]
+    for img in "$TEST_IMG".[01234]; do
+        _rm_test_img "$img"
+    done
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249
index e4650ecf6b..2b99c9789e 100755
--- a/tests/qemu-iotests/249
+++ b/tests/qemu-iotests/249
@@ -30,8 +30,8 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.base"
-    rm -f "$TEST_IMG.int"
+    _rm_test_img "$TEST_IMG.base"
+    _rm_test_img "$TEST_IMG.int"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/252 b/tests/qemu-iotests/252
index f6c8f71444..83280c1715 100755
--- a/tests/qemu-iotests/252
+++ b/tests/qemu-iotests/252
@@ -29,7 +29,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.base_new"
+    _rm_test_img "$TEST_IMG.base_new"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 15/21] iotests: Avoid cp/mv of test images
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (13 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-10-15 14:27 ` [PATCH v2 16/21] iotests: Make 091 work with data_file Max Reitz
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

This will not work with external data files, so try to get tests working
without it as far as possible.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tests/qemu-iotests/063     | 12 ++++--------
 tests/qemu-iotests/063.out |  3 ++-
 tests/qemu-iotests/085     |  9 +++------
 tests/qemu-iotests/085.out |  8 ++++----
 4 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
index eef2b8a534..c750b3806e 100755
--- a/tests/qemu-iotests/063
+++ b/tests/qemu-iotests/063
@@ -51,15 +51,13 @@ _unsupported_imgopts "subformat=monolithicFlat" \
 _make_test_img 4M
 
 echo "== Testing conversion with -n fails with no target file =="
-# check .orig file does not exist
-rm -f "$TEST_IMG.orig"
 if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" >/dev/null 2>&1; then
     exit 1
 fi
 
 echo "== Testing conversion with -n succeeds with a target file =="
-rm -f "$TEST_IMG.orig"
-cp "$TEST_IMG" "$TEST_IMG.orig"
+_rm_test_img "$TEST_IMG.orig"
+TEST_IMG="$TEST_IMG.orig" _make_test_img 4M
 if ! $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" ; then
     exit 1
 fi
@@ -85,10 +83,8 @@ fi
 _check_test_img
 
 echo "== Testing conversion to a smaller file fails =="
-rm -f "$TEST_IMG.orig"
-mv "$TEST_IMG" "$TEST_IMG.orig"
-_make_test_img 2M
-if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG.orig" "$TEST_IMG" >/dev/null 2>&1; then
+TEST_IMG="$TEST_IMG.target" _make_test_img 2M
+if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.target" >/dev/null 2>&1; then
     exit 1
 fi
 
diff --git a/tests/qemu-iotests/063.out b/tests/qemu-iotests/063.out
index 7b691b2c9e..890b719bf0 100644
--- a/tests/qemu-iotests/063.out
+++ b/tests/qemu-iotests/063.out
@@ -2,11 +2,12 @@ QA output created by 063
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
 == Testing conversion with -n fails with no target file ==
 == Testing conversion with -n succeeds with a target file ==
+Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=4194304
 == Testing conversion to raw is the same after conversion with -n ==
 == Testing conversion back to original format ==
 No errors were found on the image.
 == Testing conversion to a smaller file fails ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2097152
+Formatting 'TEST_DIR/t.IMGFMT.target', fmt=IMGFMT size=2097152
 == Regression testing for copy offloading bug ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
 Formatting 'TEST_DIR/t.IMGFMT.target', fmt=IMGFMT size=1048576
diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
index bbea1252d2..46981dbb64 100755
--- a/tests/qemu-iotests/085
+++ b/tests/qemu-iotests/085
@@ -105,8 +105,7 @@ add_snapshot_image()
 {
     base_image="${TEST_DIR}/$((${1}-1))-${snapshot_virt0}"
     snapshot_file="${TEST_DIR}/${1}-${snapshot_virt0}"
-    _make_test_img -u -b "${base_image}" "$size"
-    mv "${TEST_IMG}" "${snapshot_file}"
+    TEST_IMG=$snapshot_file _make_test_img -u -b "${base_image}" "$size"
     do_blockdev_add "$1" "'backing': null, " "${snapshot_file}"
 }
 
@@ -122,10 +121,8 @@ blockdev_snapshot()
 
 size=128M
 
-_make_test_img $size
-mv "${TEST_IMG}" "${TEST_IMG}.1"
-_make_test_img $size
-mv "${TEST_IMG}" "${TEST_IMG}.2"
+TEST_IMG="$TEST_IMG.1" _make_test_img $size
+TEST_IMG="$TEST_IMG.2" _make_test_img $size
 
 echo
 echo === Running QEMU ===
diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out
index 2a5f256cd3..313198f182 100644
--- a/tests/qemu-iotests/085.out
+++ b/tests/qemu-iotests/085.out
@@ -1,6 +1,6 @@
 QA output created by 085
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728
 
 === Running QEMU ===
 
@@ -55,10 +55,10 @@ Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_fil
 
 === Create a couple of snapshots using blockdev-snapshot ===
 
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/10-snapshot-v0.IMGFMT
+Formatting 'TEST_DIR/11-snapshot-v0.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/10-snapshot-v0.IMGFMT
 {"return": {}}
 {"return": {}}
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/11-snapshot-v0.IMGFMT
+Formatting 'TEST_DIR/12-snapshot-v0.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/11-snapshot-v0.IMGFMT
 {"return": {}}
 {"return": {}}
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 16/21] iotests: Make 091 work with data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (14 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 15/21] iotests: Avoid cp/mv of " Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:50   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 17/21] iotests: Make 110 " Max Reitz
                   ` (6 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

The image end offset as reported by qemu-img check is different when
using an external data file; we do not care about its value here, so we
can just filter it.  Incidentally, common.rc already has _check_test_img
for us which does exactly that.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/091     | 2 +-
 tests/qemu-iotests/091.out | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091
index f4b44659ae..0874fa84c8 100755
--- a/tests/qemu-iotests/091
+++ b/tests/qemu-iotests/091
@@ -101,7 +101,7 @@ echo "Check image pattern"
 ${QEMU_IO} -c "read -P 0x22 0 4M" "${TEST_IMG}" | _filter_testdir | _filter_qemu_io
 
 echo "Running 'qemu-img check -r all \$TEST_IMG'"
-"${QEMU_IMG}" check -r all "${TEST_IMG}" 2>&1 | _filter_testdir | _filter_qemu
+_check_test_img -r all
 
 echo "*** done"
 rm -f $seq.full
diff --git a/tests/qemu-iotests/091.out b/tests/qemu-iotests/091.out
index 5017f8c2d9..5ec7b00f13 100644
--- a/tests/qemu-iotests/091.out
+++ b/tests/qemu-iotests/091.out
@@ -23,6 +23,4 @@ read 4194304/4194304 bytes at offset 0
 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Running 'qemu-img check -r all $TEST_IMG'
 No errors were found on the image.
-80/16384 = 0.49% allocated, 0.00% fragmented, 0.00% compressed clusters
-Image end offset: 5570560
 *** done
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 17/21] iotests: Make 110 work with data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (15 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 16/21] iotests: Make 091 work with data_file Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:50   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 18/21] iotests: Make 137 " Max Reitz
                   ` (5 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

The only difference is that the json:{} filename of the image looks
different.  We actually do not care about that filename in this test, we
are only interested in (1) that there is a json:{} filename, and (2)
whether the backing filename can be constructed.

So just filter out the json:{} data, thus making this test pass both
with and without data_file.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/110     | 7 +++++--
 tests/qemu-iotests/110.out | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
index f78df0e6e1..139c02c2cf 100755
--- a/tests/qemu-iotests/110
+++ b/tests/qemu-iotests/110
@@ -67,6 +67,7 @@ echo
 # Across blkdebug without a config file, you cannot reconstruct filenames, so
 # qemu is incapable of knowing the directory of the top image from the filename
 # alone. However, using bdrv_dirname(), it should still work.
+# (Filter out the json:{} filename so this test works with external data files)
 TEST_IMG="json:{
     'driver': '$IMGFMT',
     'file': {
@@ -82,7 +83,8 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info | grep -v 'backing file format'
+}" _img_info | _filter_img_info | grep -v 'backing file format' \
+    | _filter_json_filename
 
 echo
 echo '=== Backing name is always relative to the backed image ==='
@@ -114,7 +116,8 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info | grep -v 'backing file format'
+}" _img_info | _filter_img_info | grep -v 'backing file format' \
+    | _filter_json_filename
 
 
 # success, all done
diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out
index f60b26390e..f835553a99 100644
--- a/tests/qemu-iotests/110.out
+++ b/tests/qemu-iotests/110.out
@@ -11,7 +11,7 @@ backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 
 === Non-reconstructable filename ===
 
-image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
+image: json:{ /* filtered */ }
 file format: IMGFMT
 virtual size: 64 MiB (67108864 bytes)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
@@ -22,7 +22,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.b
 
 === Nodes without a common directory ===
 
-image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-threshold": 1}}
+image: json:{ /* filtered */ }
 file format: IMGFMT
 virtual size: 64 MiB (67108864 bytes)
 backing file: t.IMGFMT.base (cannot determine actual path)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 18/21] iotests: Make 137 work with data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (16 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 17/21] iotests: Make 110 " Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:51   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 19/21] iotests: Make 198 " Max Reitz
                   ` (4 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

When using an external data file, there are no refcounts for data
clusters.  We thus have to adjust the corruption test in this patch to
not be based around a data cluster allocation, but the L2 table
allocation (L2 tables are still refcounted with external data files).

Furthermore, we should not print qcow2.py's list of incompatible
features because it differs depending on whether there is an external
data file or not.

With those two changes, the test will work both with an external data
files (once that options works with the iotests at all).

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/137     | 15 +++++++++++----
 tests/qemu-iotests/137.out |  6 ++----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 6cf2997577..7ae86892f7 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -138,14 +138,21 @@ $QEMU_IO \
     "$TEST_IMG" 2>&1 | _filter_qemu_io
 
 # The dirty bit must not be set
-$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+# (Filter the external data file bit)
+if $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features \
+    | grep -q '\<0\>'
+then
+    echo 'ERROR: Dirty bit set'
+else
+    echo 'OK: Dirty bit not set'
+fi
 
 # Similarly we can test whether corruption detection has been enabled:
-# Create L1/L2, overwrite first entry in refcount block, allocate something.
+# Create L1, overwrite refcounts, force allocation of L2 by writing
+# data.
 # Disabling the checks should fail, so the corruption must be detected.
 _make_test_img 64M
-$QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
-poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00"
+poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00\x00\x00\x00\x00\x00\x00"
 $QEMU_IO \
     -c "reopen -o overlap-check=none,lazy-refcounts=42" \
     -c "write 64k 64k" \
diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
index bd4523a853..86377c80cd 100644
--- a/tests/qemu-iotests/137.out
+++ b/tests/qemu-iotests/137.out
@@ -36,11 +36,9 @@ qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
-incompatible_features     []
+OK: Dirty bit not set
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-wrote 65536/65536 bytes at offset 0
-64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off'
-qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with qcow2_header); further corruption events will be suppressed
+qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table at offset 0; further corruption events will be suppressed
 write failed: Input/output error
 *** done
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 19/21] iotests: Make 198 work with data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (17 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 18/21] iotests: Make 137 " Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:51   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 20/21] iotests: Disable data_file where it cannot be used Max Reitz
                   ` (3 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

We do not care about the json:{} filenames here, so we can just filter
them out and thus make the test work both with and without external data
files.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/198     | 6 ++++--
 tests/qemu-iotests/198.out | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
index c8f824cfae..fb0d5a29d3 100755
--- a/tests/qemu-iotests/198
+++ b/tests/qemu-iotests/198
@@ -92,13 +92,15 @@ echo
 echo "== checking image base =="
 $QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-specific \
     | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
-          -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
+          -e '/lazy refcounts:/ D' -e '/corrupt:/ D' -e '/^\s*data file/ D' \
+    | _filter_json_filename
 
 echo
 echo "== checking image layer =="
 $QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-specific \
     | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
-          -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
+          -e '/lazy refcounts:/ D' -e '/corrupt:/ D' -e '/^\s*data file/ D' \
+    | _filter_json_filename
 
 
 # success, all done
diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out
index e86b175e39..831ce3a289 100644
--- a/tests/qemu-iotests/198.out
+++ b/tests/qemu-iotests/198.out
@@ -32,7 +32,7 @@ read 16777216/16777216 bytes at offset 0
 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
 == checking image base ==
-image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}}
+image: json:{ /* filtered */ }
 file format: IMGFMT
 virtual size: 16 MiB (16777216 bytes)
 Format specific information:
@@ -74,7 +74,7 @@ Format specific information:
         master key iters: 1024
 
 == checking image layer ==
-image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}
+image: json:{ /* filtered */ }
 file format: IMGFMT
 virtual size: 16 MiB (16777216 bytes)
 backing file: TEST_DIR/t.IMGFMT.base
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 20/21] iotests: Disable data_file where it cannot be used
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (18 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 19/21] iotests: Make 198 " Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:52   ` Maxim Levitsky
  2019-10-15 14:27 ` [PATCH v2 21/21] iotests: Allow check -o data_file Max Reitz
                   ` (2 subsequent siblings)
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/007 | 5 +++--
 tests/qemu-iotests/014 | 2 ++
 tests/qemu-iotests/015 | 5 +++--
 tests/qemu-iotests/026 | 5 ++++-
 tests/qemu-iotests/029 | 5 +++--
 tests/qemu-iotests/031 | 6 +++---
 tests/qemu-iotests/036 | 5 +++--
 tests/qemu-iotests/039 | 3 +++
 tests/qemu-iotests/046 | 2 ++
 tests/qemu-iotests/048 | 2 ++
 tests/qemu-iotests/051 | 5 +++--
 tests/qemu-iotests/058 | 5 +++--
 tests/qemu-iotests/060 | 6 ++++--
 tests/qemu-iotests/061 | 6 ++++--
 tests/qemu-iotests/062 | 2 +-
 tests/qemu-iotests/066 | 2 +-
 tests/qemu-iotests/067 | 6 ++++--
 tests/qemu-iotests/068 | 5 +++--
 tests/qemu-iotests/071 | 3 +++
 tests/qemu-iotests/073 | 2 ++
 tests/qemu-iotests/074 | 2 ++
 tests/qemu-iotests/080 | 5 +++--
 tests/qemu-iotests/090 | 2 ++
 tests/qemu-iotests/098 | 6 ++++--
 tests/qemu-iotests/099 | 3 ++-
 tests/qemu-iotests/103 | 5 +++--
 tests/qemu-iotests/108 | 6 ++++--
 tests/qemu-iotests/112 | 5 +++--
 tests/qemu-iotests/114 | 2 ++
 tests/qemu-iotests/121 | 3 +++
 tests/qemu-iotests/138 | 2 ++
 tests/qemu-iotests/156 | 2 ++
 tests/qemu-iotests/176 | 7 +++++--
 tests/qemu-iotests/191 | 2 ++
 tests/qemu-iotests/201 | 6 +++---
 tests/qemu-iotests/214 | 3 ++-
 tests/qemu-iotests/217 | 3 ++-
 tests/qemu-iotests/220 | 5 +++--
 tests/qemu-iotests/243 | 6 ++++--
 tests/qemu-iotests/244 | 5 +++--
 tests/qemu-iotests/250 | 2 ++
 tests/qemu-iotests/267 | 5 +++--
 42 files changed, 117 insertions(+), 52 deletions(-)

diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
index 7d3544b479..160683adf8 100755
--- a/tests/qemu-iotests/007
+++ b/tests/qemu-iotests/007
@@ -41,8 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 # refcount_bits must be at least 4 so we can create ten internal snapshots
-# (1 bit supports none, 2 bits support two, 4 bits support 14)
-_unsupported_imgopts 'refcount_bits=\(1\|2\)[^0-9]'
+# (1 bit supports none, 2 bits support two, 4 bits support 14);
+# snapshot are generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=\(1\|2\)[^0-9]' data_file
 
 echo
 echo "creating image"
diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
index 2f728a1956..e1221c0fff 100755
--- a/tests/qemu-iotests/014
+++ b/tests/qemu-iotests/014
@@ -43,6 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# Compression and snapshots do not work with external data files
+_unsupported_imgopts data_file
 
 TEST_OFFSETS="0 4294967296"
 TEST_OPS="writev read write readv"
diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015
index eec5387f3d..4d8effd0ae 100755
--- a/tests/qemu-iotests/015
+++ b/tests/qemu-iotests/015
@@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # actually any format that supports snapshots
 _supported_fmt qcow2
 _supported_proto generic
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 echo
 echo "creating image"
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 3430029ed6..a4aa74764f 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -49,7 +49,10 @@ _supported_cache_modes writethrough none
 # 32 and 64 bits do not work either, however, due to different leaked cluster
 # count on error.
 # Thus, the only remaining option is refcount_bits=16.
-_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+#
+# As for data_file, none of the refcount tests can work for it.
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' \
+    data_file
 
 echo "Errors while writing 128 kB"
 echo
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index 9254ede5e5..2161a4b87a 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@ -42,8 +42,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 _unsupported_proto vxhs
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 offset_size=24
 offset_l1_size=36
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index c44fcf91bb..646ecd593f 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -40,9 +40,9 @@ 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]\|$\)\)'
+# We want to test compat=0.10, which does not support external data
+# files or refcount widths other than 16
+_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
 CLUSTER_SIZE=65536
 
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index bbaf0ef45b..512598421c 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -43,8 +43,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qcow2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto file
-# Only qcow2v3 and later supports feature bits
-_unsupported_imgopts 'compat=0.10'
+# Only qcow2v3 and later supports feature bits;
+# qcow2.py does not support external data files
+_unsupported_imgopts 'compat=0.10' data_file
 
 echo
 echo === Image with unknown incompatible feature bit ===
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index 99563bf126..ddce48ab47 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -44,6 +44,9 @@ _supported_proto file
 _supported_os Linux
 _default_cache_mode writethrough
 _supported_cache_modes writethrough
+# Some of these test cases expect no external data file so that all
+# clusters are part of the qcow2 image and refcounted
+_unsupported_imgopts data_file
 
 size=128M
 
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index 4e03ead7b1..a066eec605 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+# data_file does not support compressed clusters
+_unsupported_imgopts data_file
 
 CLUSTER_SIZE=64k
 size=128M
diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
index a8feb76184..2af6b74b41 100755
--- a/tests/qemu-iotests/048
+++ b/tests/qemu-iotests/048
@@ -49,6 +49,8 @@ _compare()
 _supported_fmt raw qcow2 qed luks
 _supported_proto file
 _supported_os Linux
+# Using 'cp' is incompatible with external data files
+_unsupported_imgopts data_file
 
 # Remove once all tests are fixed to use TEST_IMG_FILE
 # correctly and common.rc sets it unconditionally
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 9cd1d60d45..0053bad46a 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 # A compat=0.10 image is created in this test which does not support anything
-# other than refcount_bits=16
-_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+# other than refcount_bits=16;
+# it also will not support an external data file
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
 
 do_run_qemu()
 {
diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
index ed01115fa3..d5304bb404 100755
--- a/tests/qemu-iotests/058
+++ b/tests/qemu-iotests/058
@@ -56,8 +56,9 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 _require_command QEMU_NBD
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
 
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index 92243c2edd..8ad0d7a904 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -48,8 +48,10 @@ _filter_io_error()
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# These tests only work for compat=1.1 images with refcount_bits=16
-_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+# These tests only work for compat=1.1 images without an external
+# data file with refcount_bits=16
+_unsupported_imgopts 'compat=0.10' data_file \
+    'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
 
 rt_offset=65536  # 0x10000 (XXX: just an assumption)
 rb_offset=131072 # 0x20000 (XXX: just an assumption)
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index b4076d8e8b..4e218798d8 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -42,8 +42,10 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 # Conversion between different compat versions can only really work
-# with refcount_bits=16
-_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+# with refcount_bits=16;
+# we have explicit tests for data_file here, but the whole test does
+# not work with it
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
 
 echo
 echo "=== Testing version downgrade with zero expansion ==="
diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
index ac0d2a9a3b..68e52a6402 100755
--- a/tests/qemu-iotests/062
+++ b/tests/qemu-iotests/062
@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 # We need zero clusters and snapshots
-_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
 
 IMG_SIZE=64M
 
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
index 00eb80d89e..0fff3e3a52 100755
--- a/tests/qemu-iotests/066
+++ b/tests/qemu-iotests/066
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 # We need zero clusters and snapshots
-_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
 
 # Intentionally create an unaligned image
 IMG_SIZE=$((64 * 1024 * 1024 + 512))
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index 926c79b37c..3bc6e719eb 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -32,8 +32,10 @@ status=1	# failure is the default!
 
 _supported_fmt qcow2
 _supported_proto file
-# Because anything other than 16 would change the output of query-block
-_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+# Because anything other than 16 would change the output of query-block,
+# and external data files would change the output of
+# query-named-block-ndoes
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
 
 do_run_qemu()
 {
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
index 65650fca9a..c8748f5b02 100755
--- a/tests/qemu-iotests/068
+++ b/tests/qemu-iotests/068
@@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # This tests qocw2-specific low-level functionality
 _supported_fmt qcow2
 _supported_proto generic
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
 
 IMG_SIZE=128K
 
diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index 4e31943244..88faebcc1d 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -39,6 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _require_drivers blkdebug blkverify
+# blkdebug can only inject errors on bs->file, not on the data_file,
+# so thie test does not work with external data files
+_unsupported_imgopts data_file
 
 do_run_qemu()
 {
diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
index e684b1b780..903dc9c9ab 100755
--- a/tests/qemu-iotests/073
+++ b/tests/qemu-iotests/073
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 _unsupported_proto vxhs
+# External data files do not support compressed clusters
+_unsupported_imgopts data_file
 
 CLUSTER_SIZE=64k
 size=128M
diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
index 62be89a0d9..db03edf0b0 100755
--- a/tests/qemu-iotests/074
+++ b/tests/qemu-iotests/074
@@ -50,6 +50,8 @@ _compare()
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# blkdebug can only inject errors on bs->file
+_unsupported_imgopts data_file
 
 # Setup test basic parameters
 TEST_IMG2=$TEST_IMG.2
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
index b1ecafb41e..a3d13c414e 100755
--- a/tests/qemu-iotests/080
+++ b/tests/qemu-iotests/080
@@ -40,9 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# - Internal snapshots are (currently) impossible with refcount_bits=1
+# - Internal snapshots are (currently) impossible with refcount_bits=1,
+#   and generally impossible with external data files
 # - This is generally a test for compat=1.1 images
-_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10'
 
 header_size=104
 
diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090
index 9f8cfbb80f..1246e4f910 100755
--- a/tests/qemu-iotests/090
+++ b/tests/qemu-iotests/090
@@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file nfs
+# External data files do not support compressed clusters
+_unsupported_imgopts data_file
 
 IMG_SIZE=128K
 
diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
index 700068b328..1e29d96b3d 100755
--- a/tests/qemu-iotests/098
+++ b/tests/qemu-iotests/098
@@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
-# The code path we want to test here only works for compat=1.1 images
-_unsupported_imgopts 'compat=0.10'
+# The code path we want to test here only works for compat=1.1 images;
+# blkdebug can only inject errors on bs->file, so external data files
+# do not work with this test
+_unsupported_imgopts 'compat=0.10' data_file
 
 for event in l1_update empty_image_prepare reftable_update refblock_alloc; do
 
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
index b383c11e6a..65e8e92572 100755
--- a/tests/qemu-iotests/099
+++ b/tests/qemu-iotests/099
@@ -46,8 +46,9 @@ _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
 _supported_proto file
 _supported_os Linux
 _require_drivers blkdebug blkverify
+# data_file would change the json:{} filenames
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
-    "subformat=twoGbMaxExtentSparse"
+    "subformat=twoGbMaxExtentSparse" data_file
 
 do_run_qemu()
 {
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
index 554b9de054..8c1ebe0443 100755
--- a/tests/qemu-iotests/103
+++ b/tests/qemu-iotests/103
@@ -38,8 +38,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file nfs
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 IMG_SIZE=64K
 
diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index b0a6ae597b..6bbeb4f996 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -41,8 +41,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# This test directly modifies a refblock so it relies on refcount_bits being 16
-_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
+# This test directly modifies a refblock so it relies on refcount_bits being 16;
+# and the low-level modification it performs are not tuned for external data
+# files
+_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
 
 echo
 echo '=== Repairing an image without any refcount table ==='
diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
index 6850225939..20ff5c224a 100755
--- a/tests/qemu-iotests/112
+++ b/tests/qemu-iotests/112
@@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 # This test will set refcount_bits on its own which would conflict with the
-# manual setting; compat will be overridden as well
-_unsupported_imgopts refcount_bits 'compat=0.10'
+# manual setting; compat will be overridden as well;
+# and external data files do not work well with our refcount testing
+_unsupported_imgopts refcount_bits 'compat=0.10' data_file
 
 print_refcount_bits()
 {
diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
index f90a744fc0..26104fff6c 100755
--- a/tests/qemu-iotests/114
+++ b/tests/qemu-iotests/114
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto generic
 _unsupported_proto vxhs
+# qcow2.py does not work too well with external data files
+_unsupported_imgopts data_file
 
 
 TEST_IMG="$TEST_IMG.base" _make_test_img 64M
diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
index 10db813d94..90ea0db737 100755
--- a/tests/qemu-iotests/121
+++ b/tests/qemu-iotests/121
@@ -39,6 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# Refcount structures are used much differently with external data
+# files
+_unsupported_imgopts data_file
 
 echo
 echo '=== New refcount structures may not conflict with existing structures ==='
diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
index 66ae9d5e78..7b0bc62a74 100755
--- a/tests/qemu-iotests/138
+++ b/tests/qemu-iotests/138
@@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# These refcount calculations do not work with external data files
+_unsupported_imgopts data_file
 
 echo
 echo '=== Check on an image with a multiple of 2^32 clusters ==='
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
index 3f27db71f2..5559df63a5 100755
--- a/tests/qemu-iotests/156
+++ b/tests/qemu-iotests/156
@@ -51,6 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2 qed
 _supported_proto generic
 _unsupported_proto vxhs
+# Copying files around with cp does not work with external data files
+_unsupported_imgopts data_file
 
 # Create source disk
 TEST_IMG="$TEST_IMG.backing" _make_test_img 1M
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
index 50df4c00fa..117c8b6954 100755
--- a/tests/qemu-iotests/176
+++ b/tests/qemu-iotests/176
@@ -47,8 +47,11 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# Persistent dirty bitmaps require compat=1.1
-_unsupported_imgopts 'compat=0.10'
+# Persistent dirty bitmaps require compat=1.1;
+# Internal snapshots forbid using an external data file
+# (they work with refcount_bits=1 here, though, because there actually
+# is no data when creating the snapshot)
+_unsupported_imgopts 'compat=0.10' data_file
 
 run_qemu()
 {
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index 23ab0ce899..b05db68141 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -43,6 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+# An external data file would change the query-named-block-nodes output
+_unsupported_imgopts data_file
 
 size=64M
 
diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201
index 7abf740fe4..3a458f18a0 100755
--- a/tests/qemu-iotests/201
+++ b/tests/qemu-iotests/201
@@ -43,9 +43,9 @@ _supported_fmt qcow2
 _supported_proto generic
 _supported_os Linux
 
-# Internal snapshots are (currently) impossible with refcount_bits=1
-# This was taken from test 080
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 size=64M
 _make_test_img $size
diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
index 21ec8a2ad8..0f2e61280a 100755
--- a/tests/qemu-iotests/214
+++ b/tests/qemu-iotests/214
@@ -39,7 +39,8 @@ _supported_proto file
 
 # Repairing the corrupted image requires qemu-img check to store a
 # refcount up to 3, which requires at least two refcount bits.
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# External data files do not support compressed clusters.
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 
 echo
diff --git a/tests/qemu-iotests/217 b/tests/qemu-iotests/217
index 58a78a6098..d89116ccad 100755
--- a/tests/qemu-iotests/217
+++ b/tests/qemu-iotests/217
@@ -40,7 +40,8 @@ _supported_proto file
 
 # This test needs clusters with at least a refcount of 2 so that
 # OFLAG_COPIED is not set.  refcount_bits=1 is therefore unsupported.
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# (As are external data files.)
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 echo
 echo '=== Simulating an I/O error during snapshot deletion ==='
diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
index 3769f372cb..a88c59152b 100755
--- a/tests/qemu-iotests/220
+++ b/tests/qemu-iotests/220
@@ -37,8 +37,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# To use a different refcount width but 16 bits we need compat=1.1
-_unsupported_imgopts 'compat=0.10'
+# To use a different refcount width but 16 bits we need compat=1.1,
+# and external data files do not support compressed clusters.
+_unsupported_imgopts 'compat=0.10' data_file
 
 echo "== Creating huge file =="
 
diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
index 3dc3b6a711..a61852f6d9 100755
--- a/tests/qemu-iotests/243
+++ b/tests/qemu-iotests/243
@@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# External data files do not work with compat=0.10
-_unsupported_imgopts 'compat=0.10'
+# External data files do not work with compat=0.10, and because there
+# is an explicit case for external data files here, we cannot allow
+# the user to specify whether to use one
+_unsupported_imgopts 'compat=0.10' data_file
 
 for mode in off metadata falloc full; do
 
diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
index 13263292b0..0d1efee6ef 100755
--- a/tests/qemu-iotests/244
+++ b/tests/qemu-iotests/244
@@ -41,8 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
-# External data files do not work with compat=0.10
-_unsupported_imgopts 'compat=0.10'
+# External data files do not work with compat=0.10, and because we use
+# our own external data file, we cannot let the user specify one
+_unsupported_imgopts 'compat=0.10' data_file
 
 echo
 echo "=== Create and open image with external data file ==="
diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250
index 670cf19076..9bb6b94d74 100755
--- a/tests/qemu-iotests/250
+++ b/tests/qemu-iotests/250
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
+# This test does not make much sense with external data files
+_unsupported_imgopts data_file
 
 # This test checks that qcow2_process_discards does not truncate a discard
 # request > 2G.
diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267
index eda45449d4..d2f0e5df59 100755
--- a/tests/qemu-iotests/267
+++ b/tests/qemu-iotests/267
@@ -41,8 +41,9 @@ _supported_fmt qcow2
 _supported_proto file
 _supported_os Linux
 
-# Internal snapshots are (currently) impossible with refcount_bits=1
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
+# Internal snapshots are (currently) impossible with refcount_bits=1,
+# and generally impossible with external data files
+_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
 
 do_run_qemu()
 {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 21/21] iotests: Allow check -o data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (19 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 20/21] iotests: Disable data_file where it cannot be used Max Reitz
@ 2019-10-15 14:27 ` Max Reitz
  2019-11-06 15:52   ` Maxim Levitsky
  2019-10-16  0:19 ` [PATCH v2 00/21] iotests: Allow ./check " no-reply
  2019-11-06 15:52 ` Maxim Levitsky
  22 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-10-15 14:27 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Maxim Levitsky, qemu-devel, Max Reitz

The problem with allowing the data_file option is that you want to use a
different data file per image used in the test.  Therefore, we need to
allow patterns like -o data_file='$TEST_IMG.data_file'.

Then, we need to filter it out from qemu-img map, qemu-img create, and
remove the data file in _rm_test_img.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/common.filter | 23 +++++++++++++++++++++--
 tests/qemu-iotests/common.rc     | 22 +++++++++++++++++++++-
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 63bc6f6f26..9dd05689d1 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -121,7 +121,13 @@ _filter_actual_image_size()
 # replace driver-specific options in the "Formatting..." line
 _filter_img_create()
 {
-    $SED -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
+    data_file_filter=()
+    if data_file=$(_get_data_file "$TEST_IMG"); then
+        data_file_filter=(-e "s# data_file=$data_file##")
+    fi
+
+    $SED "${data_file_filter[@]}" \
+        -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGFMT#IMGFMT#g" \
@@ -204,9 +210,22 @@ _filter_img_info()
 # human and json output
 _filter_qemu_img_map()
 {
+    # Assuming the data_file value in $IMGOPTS contains a '$TEST_IMG',
+    # create a filter that replaces the data file name by $TEST_IMG.
+    # Example:
+    #   In $IMGOPTS: 'data_file=$TEST_IMG.data_file'
+    #   Then data_file_pattern == '\(.*\).data_file'
+    #   And  data_file_filter  == -e 's#\(.*\).data_file#\1#
+    data_file_filter=()
+    if data_file_pattern=$(_get_data_file '\\(.*\\)'); then
+        data_file_filter=(-e "s#$data_file_pattern#\\1#")
+    fi
+
     $SED -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
         -e 's/"offset": [0-9]\+/"offset": OFFSET/g' \
-        -e 's/Mapped to *//' | _filter_testdir | _filter_imgfmt
+        -e 's/Mapped to *//' \
+        "${data_file_filter[@]}" \
+        | _filter_testdir | _filter_imgfmt
 }
 
 _filter_nbd()
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index f3784077de..bed789a691 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -277,6 +277,20 @@ _stop_nbd_server()
     fi
 }
 
+# Gets the data_file value from IMGOPTS and replaces the '$TEST_IMG'
+# pattern by '$1'
+# Caution: The replacement is done with sed, so $1 must be escaped
+#          properly.  (The delimiter is '#'.)
+_get_data_file()
+{
+    if ! echo "$IMGOPTS" | grep -q 'data_file='; then
+        return 1
+    fi
+
+    echo "$IMGOPTS" | sed -e 's/.*data_file=\([^,]*\).*/\1/' \
+                    | sed -e "s#\\\$TEST_IMG#$1#"
+}
+
 _make_test_img()
 {
     # extra qemu-img options can be added by tests
@@ -297,7 +311,8 @@ _make_test_img()
     fi
 
     if [ -n "$IMGOPTS" ]; then
-        optstr=$(_optstr_add "$optstr" "$IMGOPTS")
+        imgopts_expanded=$(echo "$IMGOPTS" | sed -e "s#\\\$TEST_IMG#$img_name#")
+        optstr=$(_optstr_add "$optstr" "$imgopts_expanded")
     fi
     if [ -n "$IMGKEYSECRET" ]; then
         object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
@@ -376,6 +391,11 @@ _rm_test_img()
         # Remove all the extents for vmdk
         "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
             | xargs -I {} rm -f "{}"
+    elif [ "$IMGFMT" = "qcow2" ]; then
+        # Remove external data file
+        if data_file=$(_get_data_file "$img"); then
+            rm -f "$data_file"
+        fi
     fi
     rm -f "$img"
 }
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/21] iotests: Allow ./check -o data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (20 preceding siblings ...)
  2019-10-15 14:27 ` [PATCH v2 21/21] iotests: Allow check -o data_file Max Reitz
@ 2019-10-16  0:19 ` no-reply
  2019-10-16  7:18   ` Max Reitz
  2019-11-06 15:52 ` Maxim Levitsky
  22 siblings, 1 reply; 48+ messages in thread
From: no-reply @ 2019-10-16  0:19 UTC (permalink / raw)
  To: mreitz; +Cc: kwolf, mreitz, qemu-devel, qemu-block, mlevitsk

Patchew URL: https://patchew.org/QEMU/20191015142729.18123-1-mreitz@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [PATCH v2 00/21] iotests: Allow ./check -o data_file
Type: series
Message-id: 20191015142729.18123-1-mreitz@redhat.com

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
7e75916 iotests: Allow check -o data_file
a21918d iotests: Disable data_file where it cannot be used
1eb7209 iotests: Make 198 work with data_file
02453ff iotests: Make 137 work with data_file
cdb651c iotests: Make 110 work with data_file
1b30e90 iotests: Make 091 work with data_file
26ebffa iotests: Avoid cp/mv of test images
5d6ba79 iotests: Use _rm_test_img for deleting test images
4c20fa0 iotests: Avoid qemu-img create
944555b iotests: Drop IMGOPTS use in 267
9037b83 iotests: Replace IMGOPTS='' by --no-opts
e62282b iotests: Replace IMGOPTS= by -o
26d39b5 iotests: Inject space into -ocompat=0.10 in 051
99d129e iotests: Add -o and --no-opts to _make_test_img
301f2c3 iotests: Let _make_test_img parse its parameters
53a8dea iotests: Drop compat=1.1 in 050
85b18f8 iotests: Replace IMGOPTS by _unsupported_imgopts
476fb23 iotests: Filter refcount_order in 036
67b9119 iotests: Add _filter_json_filename
fbf9402 iotests/qcow2.py: Split feature fields into bits
afe3486 iotests/qcow2.py: Add dump-header-exts

=== OUTPUT BEGIN ===
1/21 Checking commit afe348661672 (iotests/qcow2.py: Add dump-header-exts)
ERROR: line over 90 characters
#32: FILE: tests/qemu-iotests/qcow2.py:237:
+    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],

total: 1 errors, 0 warnings, 17 lines checked

Patch 1/21 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/21 Checking commit fbf940255d05 (iotests/qcow2.py: Split feature fields into bits)
3/21 Checking commit 67b9119032ad (iotests: Add _filter_json_filename)
4/21 Checking commit 476fb233c777 (iotests: Filter refcount_order in 036)
5/21 Checking commit 85b18f83a826 (iotests: Replace IMGOPTS by _unsupported_imgopts)
6/21 Checking commit 53a8dea8fb7b (iotests: Drop compat=1.1 in 050)
7/21 Checking commit 301f2c32204c (iotests: Let _make_test_img parse its parameters)
8/21 Checking commit 99d129e91dbe (iotests: Add -o and --no-opts to _make_test_img)
9/21 Checking commit 26d39b59dfe1 (iotests: Inject space into -ocompat=0.10 in 051)
10/21 Checking commit e62282b2ad38 (iotests: Replace IMGOPTS= by -o)
11/21 Checking commit 9037b83425c4 (iotests: Replace IMGOPTS='' by --no-opts)
12/21 Checking commit 944555b5c283 (iotests: Drop IMGOPTS use in 267)
13/21 Checking commit 4c20fa09b6c5 (iotests: Avoid qemu-img create)
14/21 Checking commit 5d6ba791204b (iotests: Use _rm_test_img for deleting test images)
15/21 Checking commit 26ebffafbd87 (iotests: Avoid cp/mv of test images)
16/21 Checking commit 1b30e9035908 (iotests: Make 091 work with data_file)
17/21 Checking commit cdb651c3c22b (iotests: Make 110 work with data_file)
18/21 Checking commit 02453ff71311 (iotests: Make 137 work with data_file)
19/21 Checking commit 1eb720910a65 (iotests: Make 198 work with data_file)
20/21 Checking commit a21918dcdf92 (iotests: Disable data_file where it cannot be used)
21/21 Checking commit 7e7591696382 (iotests: Allow check -o data_file)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20191015142729.18123-1-mreitz@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/21] iotests: Allow ./check -o data_file
  2019-10-16  0:19 ` [PATCH v2 00/21] iotests: Allow ./check " no-reply
@ 2019-10-16  7:18   ` Max Reitz
  0 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-10-16  7:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, qemu-block, mlevitsk


[-- Attachment #1.1: Type: text/plain, Size: 2389 bytes --]

On 16.10.19 02:19, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20191015142729.18123-1-mreitz@redhat.com/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Subject: [PATCH v2 00/21] iotests: Allow ./check -o data_file
> Type: series
> Message-id: 20191015142729.18123-1-mreitz@redhat.com
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> Switched to a new branch 'test'
> 7e75916 iotests: Allow check -o data_file
> a21918d iotests: Disable data_file where it cannot be used
> 1eb7209 iotests: Make 198 work with data_file
> 02453ff iotests: Make 137 work with data_file
> cdb651c iotests: Make 110 work with data_file
> 1b30e90 iotests: Make 091 work with data_file
> 26ebffa iotests: Avoid cp/mv of test images
> 5d6ba79 iotests: Use _rm_test_img for deleting test images
> 4c20fa0 iotests: Avoid qemu-img create
> 944555b iotests: Drop IMGOPTS use in 267
> 9037b83 iotests: Replace IMGOPTS='' by --no-opts
> e62282b iotests: Replace IMGOPTS= by -o
> 26d39b5 iotests: Inject space into -ocompat=0.10 in 051
> 99d129e iotests: Add -o and --no-opts to _make_test_img
> 301f2c3 iotests: Let _make_test_img parse its parameters
> 53a8dea iotests: Drop compat=1.1 in 050
> 85b18f8 iotests: Replace IMGOPTS by _unsupported_imgopts
> 476fb23 iotests: Filter refcount_order in 036
> 67b9119 iotests: Add _filter_json_filename
> fbf9402 iotests/qcow2.py: Split feature fields into bits
> afe3486 iotests/qcow2.py: Add dump-header-exts
> 
> === OUTPUT BEGIN ===
> 1/21 Checking commit afe348661672 (iotests/qcow2.py: Add dump-header-exts)
> ERROR: line over 90 characters
> #32: FILE: tests/qemu-iotests/qcow2.py:237:
> +    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],
> 
> total: 1 errors, 0 warnings, 17 lines checked

I actually saw this error locally but decided to go with it because it
fits the current style of qcow2.py in that place.  (And I don’t think
the line length does any harm there.)

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts
  2019-10-15 14:27 ` [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts Max Reitz
@ 2019-11-06 15:37   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:37 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> This is useful for tests that want to whitelist fields from dump-header
> (with grep) but still print all header extensions.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/qcow2.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
> index b392972d1b..d813b4fc81 100755
> --- a/tests/qemu-iotests/qcow2.py
> +++ b/tests/qemu-iotests/qcow2.py
> @@ -154,6 +154,10 @@ def cmd_dump_header(fd):
>      h.dump()
>      h.dump_extensions()
>  
> +def cmd_dump_header_exts(fd):
> +    h = QcowHeader(fd)
> +    h.dump_extensions()
> +
>  def cmd_set_header(fd, name, value):
>      try:
>          value = int(value, 0)
> @@ -230,6 +234,7 @@ def cmd_set_feature_bit(fd, group, bit):
>  
>  cmds = [
>      [ 'dump-header',          cmd_dump_header,          0, 'Dump image header and header extensions' ],
> +    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],
>      [ 'set-header',           cmd_set_header,           2, 'Set a field in the header'],
>      [ 'add-header-ext',       cmd_add_header_ext,       2, 'Add a header extension' ],
>      [ 'add-header-ext-stdio', cmd_add_header_ext_stdio, 1, 'Add a header extension, data from stdin' ],
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits
  2019-10-15 14:27 ` [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits Max Reitz
@ 2019-11-06 15:37   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:37 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Print the feature fields as a set of bits so that filtering is easier.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/031.out  | 36 +++++++++----------
>  tests/qemu-iotests/036.out  | 18 +++++-----
>  tests/qemu-iotests/039.out  | 22 ++++++------
>  tests/qemu-iotests/060.out  | 20 +++++------
>  tests/qemu-iotests/061.out  | 72 ++++++++++++++++++-------------------
>  tests/qemu-iotests/137.out  |  2 +-
>  tests/qemu-iotests/qcow2.py | 18 +++++++---
>  7 files changed, 99 insertions(+), 89 deletions(-)
> 
> diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out
> index 68a74d03b9..d535e407bc 100644
> --- a/tests/qemu-iotests/031.out
> +++ b/tests/qemu-iotests/031.out
> @@ -18,9 +18,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -46,9 +46,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -74,9 +74,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -109,9 +109,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -142,9 +142,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -175,9 +175,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out
> index e489b44386..15229a9604 100644
> --- a/tests/qemu-iotests/036.out
> +++ b/tests/qemu-iotests/036.out
> @@ -16,9 +16,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x8000000000000000
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     [63]
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -50,9 +50,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x8000000000000000
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        [63]
>  refcount_order            4
>  header_length             104
>  
> @@ -78,9 +78,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
> index 2e356d51b6..bdafa3ace3 100644
> --- a/tests/qemu-iotests/039.out
> +++ b/tests/qemu-iotests/039.out
> @@ -4,7 +4,7 @@ QA output created by 039
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -incompatible_features     0x0
> +incompatible_features     []
>  No errors were found on the image.
>  
>  == Creating a dirty image file ==
> @@ -12,7 +12,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x1
> +incompatible_features     [0]
>  ERROR cluster 5 refcount=0 reference=1
>  ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
>  
> @@ -22,7 +22,7 @@ Data may be corrupted, or further writes to the image may corrupt it.
>  == Read-only access must still work ==
>  read 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -incompatible_features     0x1
> +incompatible_features     [0]
>  
>  == Repairing the image file must succeed ==
>  ERROR cluster 5 refcount=0 reference=1
> @@ -36,7 +36,7 @@ The following inconsistencies were found and repaired:
>  
>  Double checking the fixed image now...
>  No errors were found on the image.
> -incompatible_features     0x0
> +incompatible_features     []
>  
>  == Data should still be accessible after repair ==
>  read 512/512 bytes at offset 0
> @@ -47,21 +47,21 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x1
> +incompatible_features     [0]
>  ERROR cluster 5 refcount=0 reference=1
>  Rebuilding refcount structure
>  Repairing cluster 1 refcount=1 reference=0
>  Repairing cluster 2 refcount=1 reference=0
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -incompatible_features     0x0
> +incompatible_features     []
>  
>  == Creating an image file with lazy_refcounts=off ==
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x0
> +incompatible_features     []
>  No errors were found on the image.
>  
>  == Committing to a backing file with lazy_refcounts=on ==
> @@ -70,8 +70,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  Image committed.
> -incompatible_features     0x0
> -incompatible_features     0x0
> +incompatible_features     []
> +incompatible_features     []
>  No errors were found on the image.
>  No errors were found on the image.
>  
> @@ -80,7 +80,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x1
> +incompatible_features     [0]
>  ERROR cluster 5 refcount=0 reference=1
>  ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
>  
> @@ -90,6 +90,6 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x0
> +incompatible_features     []
>  No errors were found on the image.
>  *** done
> diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
> index 0f6b0658a1..d27692a33c 100644
> --- a/tests/qemu-iotests/060.out
> +++ b/tests/qemu-iotests/060.out
> @@ -7,10 +7,10 @@ ERROR cluster 3 refcount=1 reference=3
>  
>  1 errors were found on the image.
>  Data may be corrupted, or further writes to the image may corrupt it.
> -incompatible_features     0x0
> +incompatible_features     []
>  qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with active L1 table); further corruption events will be suppressed
>  write failed: Input/output error
> -incompatible_features     0x2
> +incompatible_features     [1]
>  image: TEST_DIR/t.IMGFMT
>  file format: IMGFMT
>  virtual size: 64 MiB (67108864 bytes)
> @@ -33,10 +33,10 @@ ERROR cluster 2 refcount=1 reference=2
>  
>  2 errors were found on the image.
>  Data may be corrupted, or further writes to the image may corrupt it.
> -incompatible_features     0x0
> +incompatible_features     []
>  qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed
>  write failed: Input/output error
> -incompatible_features     0x2
> +incompatible_features     [1]
>  ERROR refcount block 0 refcount=2
>  ERROR cluster 2 refcount=1 reference=2
>  Rebuilding refcount structure
> @@ -49,10 +49,10 @@ The following inconsistencies were found and repaired:
>  
>  Double checking the fixed image now...
>  No errors were found on the image.
> -incompatible_features     0x0
> +incompatible_features     []
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -incompatible_features     0x0
> +incompatible_features     []
>  
>  === Testing cluster data reference into inactive L2 table ===
>  
> @@ -69,10 +69,10 @@ Data may be corrupted, or further writes to the image may corrupt it.
>  
>  1 leaked clusters were found on the image.
>  This means waste of disk space, but no harm to data.
> -incompatible_features     0x0
> +incompatible_features     []
>  qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with inactive L2 table); further corruption events will be suppressed
>  write failed: Input/output error
> -incompatible_features     0x2
> +incompatible_features     [1]
>  ERROR cluster 4 refcount=1 reference=2
>  Leaked cluster 9 refcount=1 reference=0
>  Repairing cluster 4 refcount=1 reference=2
> @@ -85,10 +85,10 @@ The following inconsistencies were found and repaired:
>  
>  Double checking the fixed image now...
>  No errors were found on the image.
> -incompatible_features     0x0
> +incompatible_features     []
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -incompatible_features     0x0
> +incompatible_features     []
>  read 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  No errors were found on the image.
> diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
> index d6a7c2af95..8b3091a412 100644
> --- a/tests/qemu-iotests/061.out
> +++ b/tests/qemu-iotests/061.out
> @@ -18,9 +18,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x1
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       [0]
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -42,9 +42,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -76,9 +76,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x1
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       [0]
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -100,9 +100,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -132,9 +132,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x1
> -compatible_features       0x1
> -autoclear_features        0x0
> +incompatible_features     [0]
> +compatible_features       [0]
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -161,9 +161,9 @@ refcount_table_offset     0x80000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -187,9 +187,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x40000000000
> -autoclear_features        0x40000000000
> +incompatible_features     []
> +compatible_features       [42]
> +autoclear_features        [42]
>  refcount_order            4
>  header_length             104
>  
> @@ -211,9 +211,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -237,9 +237,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             72
>  
> @@ -256,9 +256,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x1
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       [0]
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -290,9 +290,9 @@ refcount_table_offset     0x10000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x1
> -compatible_features       0x1
> -autoclear_features        0x0
> +incompatible_features     [0]
> +compatible_features       [0]
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> @@ -319,9 +319,9 @@ refcount_table_offset     0x80000
>  refcount_table_clusters   1
>  nb_snapshots              0
>  snapshot_offset           0x0
> -incompatible_features     0x0
> -compatible_features       0x0
> -autoclear_features        0x0
> +incompatible_features     []
> +compatible_features       []
> +autoclear_features        []
>  refcount_order            4
>  header_length             104
>  
> diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
> index 1c6569eb2c..bd4523a853 100644
> --- a/tests/qemu-iotests/137.out
> +++ b/tests/qemu-iotests/137.out
> @@ -36,7 +36,7 @@ qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     0x0
> +incompatible_features     []
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
>  wrote 65536/65536 bytes at offset 0
>  64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
> index d813b4fc81..91e4420b9f 100755
> --- a/tests/qemu-iotests/qcow2.py
> +++ b/tests/qemu-iotests/qcow2.py
> @@ -42,9 +42,9 @@ class QcowHeader:
>          [ uint64_t, '%#x',  'snapshot_offset' ],
>  
>          # Version 3 header fields
> -        [ uint64_t, '%#x',  'incompatible_features' ],
> -        [ uint64_t, '%#x',  'compatible_features' ],
> -        [ uint64_t, '%#x',  'autoclear_features' ],
> +        [ uint64_t, 'mask', 'incompatible_features' ],
> +        [ uint64_t, 'mask', 'compatible_features' ],
> +        [ uint64_t, 'mask', 'autoclear_features' ],
>          [ uint32_t, '%d',   'refcount_order' ],
>          [ uint32_t, '%d',   'header_length' ],
>      ];
> @@ -130,7 +130,17 @@ class QcowHeader:
>  
>      def dump(self):
>          for f in QcowHeader.fields:
> -            print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
> +            value = self.__dict__[f[2]]
> +            if f[1] == 'mask':
> +                bits = []
> +                for bit in range(64):

Very very minor nitpick, the type size (64 bit) is hardcoded here
but I think it is OK.

> +                    if value & (1 << bit):
> +                        bits.append(bit)
> +                value_str = str(bits)
> +            else:
> +                value_str = f[1] % value
> +
> +            print("%-25s" % f[2], value_str)
>          print("")
>  
>      def dump_extensions(self):


This is  very good idea and implementation.
Thanks!

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 03/21] iotests: Add _filter_json_filename
  2019-10-15 14:27 ` [PATCH v2 03/21] iotests: Add _filter_json_filename Max Reitz
@ 2019-11-06 15:44   ` Maxim Levitsky
  2019-11-07  8:59     ` Max Reitz
  0 siblings, 1 reply; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:44 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/common.filter | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
> index 9f418b4881..63bc6f6f26 100644
> --- a/tests/qemu-iotests/common.filter
> +++ b/tests/qemu-iotests/common.filter
> @@ -227,5 +227,29 @@ _filter_qmp_empty_return()
>      grep -v '{"return": {}}'
>  }
>  
> +_filter_json_filename()
> +{
> +    $PYTHON -c 'import sys
> +result, *fnames = sys.stdin.read().split("json:{")

Very minor nitpick, maybe I would give 'fnames' a more generic name,
since its is just result of a split, thus not really a list of filenames.
Feel free to ignore that though.

> +depth = 0
> +for fname in fnames:
> +    depth += 1 # For the opening brace in the split separator
> +    for chr_i, chr in enumerate(fname):
> +        if chr == "{":
> +            depth += 1
> +        elif chr == "}":
> +            depth -= 1
> +            if depth == 0:
> +                break
> +
> +    # json:{} filenames may be nested; filter out everything from
> +    # inside the outermost one
> +    if depth == 0:
> +        chr_i += 1 # First character past the filename
> +        result += "json:{ /* filtered */ }" + fname[chr_i:]
> +
> +sys.stdout.write(result)'
> +}
> +
>  # make sure this script returns success
>  true

I must admit that I haven't run tested it, but it looks like it should work.
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 04/21] iotests: Filter refcount_order in 036
  2019-10-15 14:27 ` [PATCH v2 04/21] iotests: Filter refcount_order in 036 Max Reitz
@ 2019-11-06 15:45   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:45 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> This test can run just fine with other values for refcount_bits, so we
> should filter the value from qcow2.py's dump-header.  In fact, we can
> filter everything but the feature bits and header extensions, because
> that is what the test is about.

> 
> (036 currently ignores user-specified image options, but that will be
> fixed in the next patch.)
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/036     |  9 ++++---
>  tests/qemu-iotests/036.out | 48 --------------------------------------
>  2 files changed, 6 insertions(+), 51 deletions(-)
> 
> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> index f06ff67408..5f929ad3be 100755
> --- a/tests/qemu-iotests/036
> +++ b/tests/qemu-iotests/036
> @@ -55,7 +55,8 @@ $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
>  
>  # Without feature table
>  $PYTHON qcow2.py "$TEST_IMG" del-header-ext 0x6803f857
> -$PYTHON qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
>  _img_info
>  
>  # With feature table containing bit 63
> @@ -103,14 +104,16 @@ echo === Create image with unknown autoclear feature bit ===
>  echo
>  _make_test_img 64M
>  $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
> -$PYTHON qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
>  
>  echo
>  echo === Repair image ===
>  echo
>  _check_test_img -r all
>  
> -$PYTHON qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header-exts
>  
>  # success, all done
>  echo "*** done"
> diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out
> index 15229a9604..0b52b934e1 100644
> --- a/tests/qemu-iotests/036.out
> +++ b/tests/qemu-iotests/036.out
> @@ -3,25 +3,9 @@ QA output created by 036
>  === Image with unknown incompatible feature bit ===
>  
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
> -magic                     0x514649fb
> -version                   3
> -backing_file_offset       0x0
> -backing_file_size         0x0
> -cluster_bits              16
> -size                      67108864
> -crypt_method              0
> -l1_size                   1
> -l1_table_offset           0x30000
> -refcount_table_offset     0x10000
> -refcount_table_clusters   1
> -nb_snapshots              0
> -snapshot_offset           0x0
>  incompatible_features     [63]
>  compatible_features       []
>  autoclear_features        []
> -refcount_order            4
> -header_length             104
> -
>  qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): Unknown incompatible feature: 8000000000000000
>  qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): Test feature
>  
> @@ -37,25 +21,9 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Unsupported IMGFMT feature(s): tes
>  === Create image with unknown autoclear feature bit ===
>  
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
> -magic                     0x514649fb
> -version                   3
> -backing_file_offset       0x0
> -backing_file_size         0x0
> -cluster_bits              16
> -size                      67108864
> -crypt_method              0
> -l1_size                   1
> -l1_table_offset           0x30000
> -refcount_table_offset     0x10000
> -refcount_table_clusters   1
> -nb_snapshots              0
> -snapshot_offset           0x0
>  incompatible_features     []
>  compatible_features       []
>  autoclear_features        [63]
> -refcount_order            4
> -header_length             104
> -
>  Header extension:
>  magic                     0x6803f857
>  length                    192
> @@ -65,25 +33,9 @@ data                      <binary>
>  === Repair image ===
>  
>  No errors were found on the image.
> -magic                     0x514649fb
> -version                   3
> -backing_file_offset       0x0
> -backing_file_size         0x0
> -cluster_bits              16
> -size                      67108864
> -crypt_method              0
> -l1_size                   1
> -l1_table_offset           0x30000
> -refcount_table_offset     0x10000
> -refcount_table_clusters   1
> -nb_snapshots              0
> -snapshot_offset           0x0
>  incompatible_features     []
>  compatible_features       []
>  autoclear_features        []
> -refcount_order            4
> -header_length             104
> -
>  Header extension:
>  magic                     0x6803f857
>  length                    192

Great!
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts
  2019-10-15 14:27 ` [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts Max Reitz
@ 2019-11-06 15:45   ` Maxim Levitsky
  2019-11-07  9:08     ` Max Reitz
  0 siblings, 1 reply; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:45 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Some tests require compat=1.1 and thus set IMGOPTS='compat=1.1'
> globally.  That is not how it should be done; instead, they should
> simply set _unsupported_imgopts to compat=0.10 (compat=1.1 is the
> default anyway).
> 
> This makes the tests heed user-specified $IMGOPTS.  Some do not work
> with all image options, though, so we need to disable them accordingly.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/036 | 3 +--
>  tests/qemu-iotests/060 | 4 ++--
>  tests/qemu-iotests/062 | 3 ++-
>  tests/qemu-iotests/066 | 3 ++-
>  tests/qemu-iotests/068 | 3 ++-
>  tests/qemu-iotests/098 | 4 ++--
>  6 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> index 5f929ad3be..bbaf0ef45b 100755
> --- a/tests/qemu-iotests/036
> +++ b/tests/qemu-iotests/036
> @@ -43,9 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qcow2-specific low-level functionality
>  _supported_fmt qcow2
>  _supported_proto file
> -
>  # Only qcow2v3 and later supports feature bits
> -IMGOPTS="compat=1.1"
> +_unsupported_imgopts 'compat=0.10'
>  
>  echo
>  echo === Image with unknown incompatible feature bit ===
> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> index b91d8321bb..9c2ef42522 100755
> --- a/tests/qemu-iotests/060
> +++ b/tests/qemu-iotests/060
> @@ -48,6 +48,8 @@ _filter_io_error()
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# These tests only work for compat=1.1 images with refcount_bits=16
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
Looks like the reason for that is that the test hardcodes (or guesses that is) various qcow2 structures
thing I have seen few times already in the iotests.
Not now but sometime in the future it would be nice to extend qcow2.py (or something
like that) to dump location of all qcow2 structures so that the guesswork could be eliminated.

>  
>  rt_offset=65536  # 0x10000 (XXX: just an assumption)
>  rb_offset=131072 # 0x20000 (XXX: just an assumption)
> @@ -55,8 +57,6 @@ l1_offset=196608 # 0x30000 (XXX: just an assumption)
>  l2_offset=262144 # 0x40000 (XXX: just an assumption)
>  l2_offset_after_snapshot=524288 # 0x80000 (XXX: just an assumption)
>  
> -IMGOPTS="compat=1.1"
> -
>  OPEN_RW="open -o overlap-check=all $TEST_IMG"
>  # Overlap checks are done before write operations only, therefore opening an
>  # image read-only makes the overlap-check option irrelevant
> diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
> index d5f818fcce..ac0d2a9a3b 100755
> --- a/tests/qemu-iotests/062
> +++ b/tests/qemu-iotests/062
> @@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qocw2-specific low-level functionality
If you respin that patch for some reason, you could fix the typo above.
>  _supported_fmt qcow2
>  _supported_proto generic
> +# We need zero clusters and snapshots
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
>  
> -IMGOPTS="compat=1.1"
>  IMG_SIZE=64M
>  
>  echo
> diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
> index 28f8c98412..00eb80d89e 100755
> --- a/tests/qemu-iotests/066
> +++ b/tests/qemu-iotests/066
> @@ -39,9 +39,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qocw2-specific low-level functionality
^^ Same here
>  _supported_fmt qcow2
>  _supported_proto generic
> +# We need zero clusters and snapshots
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
>  
>  # Intentionally create an unaligned image
> -IMGOPTS="compat=1.1"
>  IMG_SIZE=$((64 * 1024 * 1024 + 512))
>  
>  echo
> diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
> index 22f5ca3ba6..65650fca9a 100755
> --- a/tests/qemu-iotests/068
> +++ b/tests/qemu-iotests/068
> @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qocw2-specific low-level functionality
>  _supported_fmt qcow2
>  _supported_proto generic
> +# Internal snapshots are (currently) impossible with refcount_bits=1
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
>  
> -IMGOPTS="compat=1.1"
>  IMG_SIZE=128K
>  
>  case "$QEMU_DEFAULT_MACHINE" in
> diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
> index 1c1d1c468f..700068b328 100755
> --- a/tests/qemu-iotests/098
> +++ b/tests/qemu-iotests/098
> @@ -40,8 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file
> -
> -IMGOPTS="compat=1.1"
> +# The code path we want to test here only works for compat=1.1 images
> +_unsupported_imgopts 'compat=0.10'
>  
>  for event in l1_update empty_image_prepare reftable_update refblock_alloc; do
>  


Reviewed-by: Maxim Levitsky <mlevitsky@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
  2019-10-15 14:27 ` [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o Max Reitz
@ 2019-11-06 15:47   ` Maxim Levitsky
  2019-11-07  9:20     ` Max Reitz
  0 siblings, 1 reply; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:47 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

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 <mreitz@redhat.com>
> ---
>  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
>  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 "compat=1.1,lazy_refcounts=on" $size
>  
>  _NO_VALGRIND \
>  $QEMU_IO -c "reopen -o lazy-refcounts=off" \
Looks good.



> diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
> index 10bfbaecec..3941c3f0c2 100755
> --- a/tests/qemu-iotests/059
> +++ b/tests/qemu-iotests/059
> @@ -70,18 +70,18 @@ poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00"
>  
>  echo
>  echo "=== Testing monolithicFlat creation and opening ==="
> -IMGOPTS="subformat=monolithicFlat" _make_test_img 2G
> +_make_test_img -o "subformat=monolithicFlat" 2G
>  _img_info
>  _cleanup_test_img
>  
>  echo
>  echo "=== Testing monolithicFlat with zeroed_grain ==="
> -IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G
> +_make_test_img -o "subformat=monolithicFlat,zeroed_grain=on" 2G
>  _cleanup_test_img
>  
>  echo
>  echo "=== Testing big twoGbMaxExtentFlat ==="
> -IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G
> +_make_test_img -o "subformat=twoGbMaxExtentFlat" 1000G
>  $QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/'
>  _cleanup_test_img
>  
> @@ -101,13 +101,13 @@ _img_info
>  
>  echo
>  echo "=== Testing truncated sparse ==="
> -IMGOPTS="subformat=monolithicSparse" _make_test_img 100G
> +_make_test_img -o "subformat=monolithicSparse" 100G
>  truncate -s 10M $TEST_IMG
>  _img_info
>  
>  echo
>  echo "=== Converting to streamOptimized from image with small cluster size==="
> -TEST_IMG="$TEST_IMG.qcow2" IMGFMT=qcow2 IMGOPTS="cluster_size=4096" _make_test_img 1G
> +TEST_IMG="$TEST_IMG.qcow2" IMGFMT=qcow2 _make_test_img -o "cluster_size=4096" 1G
>  $QEMU_IO -f qcow2 -c "write -P 0xa 0 512" "$TEST_IMG.qcow2" | _filter_qemu_io
>  $QEMU_IO -f qcow2 -c "write -P 0xb 10240 512" "$TEST_IMG.qcow2" | _filter_qemu_io
>  $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2" "$TEST_IMG" 2>&1
> @@ -117,7 +117,7 @@ echo "=== Testing monolithicFlat with internally generated JSON file name ==="
>  
>  echo '--- blkdebug ---'
>  # Should work, because bdrv_dirname() works fine with blkdebug
> -IMGOPTS="subformat=monolithicFlat" _make_test_img 64M
> +_make_test_img -o "subformat=monolithicFlat" 64M
>  $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \
>           -c info \
>      2>&1 \
> @@ -126,7 +126,7 @@ _cleanup_test_img
>  
>  echo '--- quorum ---'
>  # Should not work, because bdrv_dirname() does not work with quorum
> -IMGOPTS="subformat=monolithicFlat" _make_test_img 64M
> +_make_test_img -o "subformat=monolithicFlat" 64M
>  cp "$TEST_IMG" "$TEST_IMG.orig"
>  
>  filename="json:{
> @@ -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... :-)


> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> index 9c2ef42522..92243c2edd 100755
> --- a/tests/qemu-iotests/060
> +++ b/tests/qemu-iotests/060
> @@ -158,7 +158,7 @@ $QEMU_IO -c 'write 0k 64k' "$BACKING_IMG" | _filter_qemu_io
>  # compat=0.10 is required in order to make the following discard actually
>  # unallocate the sector rather than make it a zero sector - we want COW, after
>  # all.
> -IMGOPTS='compat=0.10' _make_test_img -b "$BACKING_IMG" 1G
> +_make_test_img -o 'compat=0.10' -b "$BACKING_IMG" 1G
>  # Write two clusters, the second one enforces creation of an L2 table after
>  # the first data cluster.
>  $QEMU_IO -c 'write 0k 64k' -c 'write 512M 64k' "$TEST_IMG" | _filter_qemu_io
> @@ -398,7 +398,7 @@ echo
>  echo "=== Discarding a non-covered in-bounds refblock ==="
>  echo
>  
> -IMGOPTS='refcount_bits=1' _make_test_img 64M
> +_make_test_img -o 'refcount_bits=1' 64M
>  
>  # Pretend there's a refblock somewhere where there is no refblock to
>  # cover it (but the covering refblock has a valid index in the
> @@ -422,7 +422,7 @@ echo
>  echo "=== Discarding a refblock covered by an unaligned refblock ==="
>  echo
>  
> -IMGOPTS='refcount_bits=1' _make_test_img 64M
> +_make_test_img -o 'refcount_bits=1' 64M
>  
>  # Same as above
>  poke_file "$TEST_IMG" "$(($rt_offset+8))" "\x00\x00\x00\x10\x00\x00\x00\x00"
Looks good.


> diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
> index 4eac5b83bd..0480be0141 100755
> --- a/tests/qemu-iotests/061
> +++ b/tests/qemu-iotests/061
> @@ -41,11 +41,14 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# Conversion between different compat versions can only really work
> +# with refcount_bits=16
100 agree, however in the future this test maybe should be split
to one test that converts between versions and one that
converts between same version. No need to do that now of course.

> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>  
>  echo
>  echo "=== Testing version downgrade with zero expansion ==="
>  echo
> -IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> +_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
>  $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $PYTHON qcow2.py "$TEST_IMG" dump-header
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> @@ -56,7 +59,7 @@ _check_test_img
>  echo
>  echo "=== Testing version downgrade with zero expansion and 4K cache entries ==="
>  echo
> -IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> +_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
>  $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IO -c "write -z 32M 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IO -c map "$TEST_IMG" | _filter_qemu_io
> @@ -72,7 +75,7 @@ _check_test_img
>  echo
>  echo "=== Testing dirty version downgrade ==="
>  echo
> -IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> +_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
>  _NO_VALGRIND \
>  $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
>           -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
> @@ -85,7 +88,7 @@ _check_test_img
>  echo
>  echo "=== Testing version downgrade with unknown compat/autoclear flags ==="
>  echo
> -IMGOPTS="compat=1.1" _make_test_img 64M
> +_make_test_img -o "compat=1.1" 64M
>  $PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42
>  $PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
>  $PYTHON qcow2.py "$TEST_IMG" dump-header
> @@ -96,7 +99,7 @@ _check_test_img
>  echo
>  echo "=== Testing version upgrade and resize ==="
>  echo
> -IMGOPTS="compat=0.10" _make_test_img 64M
> +_make_test_img -o "compat=0.10" 64M
>  $QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
>  $PYTHON qcow2.py "$TEST_IMG" dump-header
>  $QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG"
> @@ -107,7 +110,7 @@ _check_test_img
>  echo
>  echo "=== Testing dirty lazy_refcounts=off ==="
>  echo
> -IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> +_make_test_img -o "compat=1.1,lazy_refcounts=on" 64M
>  _NO_VALGRIND \
>  $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
>           -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
> @@ -120,8 +123,8 @@ _check_test_img
>  echo
>  echo "=== Testing backing file ==="
>  echo
> -IMGOPTS="compat=1.1" _make_test_img 64M
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
> +_make_test_img -o "compat=1.1" 64M
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
>  $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG amend -o "backing_file=$TEST_IMG.base,backing_fmt=qcow2" "$TEST_IMG"
> @@ -131,7 +134,7 @@ _check_test_img
>  echo
>  echo "=== Testing invalid configurations ==="
>  echo
> -IMGOPTS="compat=0.10" _make_test_img 64M
> +_make_test_img -o "compat=0.10" 64M
>  $QEMU_IMG amend -o "lazy_refcounts=on" "$TEST_IMG"
>  $QEMU_IMG amend -o "compat=1.1" "$TEST_IMG" # actually valid
>  $QEMU_IMG amend -o "compat=0.10,lazy_refcounts=on" "$TEST_IMG"
> @@ -144,7 +147,7 @@ $QEMU_IMG amend -o "preallocation=on" "$TEST_IMG"
>  echo
>  echo "=== Testing correct handling of unset value ==="
>  echo
> -IMGOPTS="compat=1.1,cluster_size=1k" _make_test_img 64M
> +_make_test_img -o "compat=1.1,cluster_size=1k" 64M
>  echo "Should work:"
>  $QEMU_IMG amend -o "lazy_refcounts=on" "$TEST_IMG"
>  echo "Should not work:" # Just to know which of these tests actually fails
> @@ -153,7 +156,7 @@ $QEMU_IMG amend -o "cluster_size=64k" "$TEST_IMG"
>  echo
>  echo "=== Testing zero expansion on inactive clusters ==="
>  echo
> -IMGOPTS="compat=1.1" _make_test_img 64M
> +_make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG snapshot -c foo "$TEST_IMG"
>  $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
> @@ -167,7 +170,7 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
>  echo
>  echo "=== Testing zero expansion on shared L2 table ==="
>  echo
> -IMGOPTS="compat=1.1" _make_test_img 64M
> +_make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG snapshot -c foo "$TEST_IMG"
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> @@ -180,9 +183,9 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
>  echo
>  echo "=== Testing zero expansion on backed image ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
> -IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
> +_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
>  $QEMU_IO -c "read -P 0x2a 0 128k" -c "write -z 0 64k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>  _check_test_img
> @@ -191,9 +194,9 @@ $QEMU_IO -c "read -P 0 0 64k" -c "read -P 0x2a 64k 64k" "$TEST_IMG" | _filter_qe
>  echo
>  echo "=== Testing zero expansion on backed inactive clusters ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
> -IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
> +_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
>  $QEMU_IO -c "write -z 0 64k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG snapshot -c foo "$TEST_IMG"
>  $QEMU_IO -c "write -P 0x42 0 128k" "$TEST_IMG" | _filter_qemu_io
> @@ -207,9 +210,9 @@ $QEMU_IO -c "read -P 0 0 64k" -c "read -P 0x2a 64k 64k" "$TEST_IMG" | _filter_qe
>  echo
>  echo "=== Testing zero expansion on backed image with shared L2 table ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
> -IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 64M
> +_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 64M
>  $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IMG snapshot -c foo "$TEST_IMG"
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> @@ -222,7 +225,7 @@ $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
>  echo
>  echo "=== Testing preallocated zero expansion on full image ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG" _make_test_img 64M
> +TEST_IMG="$TEST_IMG" _make_test_img -o "compat=1.1" 64M
>  $QEMU_IO -c "write -P 0x2a 0 64M" "$TEST_IMG" -c "write -z 0 64M" | _filter_qemu_io
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>  _check_test_img
> @@ -231,8 +234,8 @@ $QEMU_IO -c "read -P 0 0 64M" "$TEST_IMG" | _filter_qemu_io
>  echo
>  echo "=== Testing progress report without snapshot ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 4G
> -IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 4G
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 4G
> +_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 4G
>  $QEMU_IO -c "write -z 0  64k" \
>           -c "write -z 1G 64k" \
>           -c "write -z 2G 64k" \
> @@ -243,8 +246,8 @@ _check_test_img
>  echo
>  echo "=== Testing progress report with snapshot ==="
>  echo
> -IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 4G
> -IMGOPTS="compat=1.1" _make_test_img -b "$TEST_IMG.base" 4G
> +TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 4G
> +_make_test_img -o "compat=1.1" -b "$TEST_IMG.base" 4G
>  $QEMU_IO -c "write -z 0  64k" \
>           -c "write -z 1G 64k" \
>           -c "write -z 2G 64k" \
> @@ -256,7 +259,7 @@ _check_test_img
>  echo
>  echo "=== Testing version downgrade with external data file ==="
>  echo
> -IMGOPTS="compat=1.1,data_file=$TEST_IMG.data" _make_test_img 64M
> +_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data" 64M
>  $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>  _img_info --format-specific
>  _check_test_img
> @@ -264,11 +267,11 @@ _check_test_img
>  echo
>  echo "=== Try changing the external data file ==="
>  echo
> -IMGOPTS="compat=1.1" _make_test_img 64M
> +_make_test_img -o "compat=1.1" 64M
>  $QEMU_IMG amend -o "data_file=foo" "$TEST_IMG"
>  
>  echo
> -IMGOPTS="compat=1.1,data_file=$TEST_IMG.data" _make_test_img 64M
> +_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data" 64M
>  $QEMU_IMG amend -o "data_file=foo" "$TEST_IMG"
>  _img_info --format-specific
>  TEST_IMG="data-file.filename=$TEST_IMG.data,file.filename=$TEST_IMG" _img_info --format-specific --image-opts
> @@ -281,7 +284,7 @@ TEST_IMG="data-file.filename=$TEST_IMG.data,file.filename=$TEST_IMG" _img_info -
>  echo
>  echo "=== Clearing and setting data-file-raw ==="
>  echo
> -IMGOPTS="compat=1.1,data_file=$TEST_IMG.data,data_file_raw=on" _make_test_img 64M
> +_make_test_img -o "compat=1.1,data_file=$TEST_IMG.data,data_file_raw=on" 64M
>  $QEMU_IMG amend -o "data_file_raw=on" "$TEST_IMG"
>  _img_info --format-specific
>  _check_test_img
> 
Looks good.


> diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
> index 81f0c21f53..162355b29a 100755
> --- a/tests/qemu-iotests/079
> +++ b/tests/qemu-iotests/079
> @@ -44,8 +44,7 @@ echo
>  cluster_sizes="16384 32768 65536 131072 262144 524288 1048576 2097152 4194304"
>  
>  for s in $cluster_sizes; do
> -    IMGOPTS=$(_optstr_add "$IMGOPTS" "preallocation=metadata,cluster_size=$s") \
> -        _make_test_img 4G
> +    _make_test_img -o "preallocation=metadata,cluster_size=$s" 4G
>  done
>  
>  # success, all done
Looks good.


> diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
> index ac47eaa0f5..b5d1ec4078 100755
> --- a/tests/qemu-iotests/106
> +++ b/tests/qemu-iotests/106
> @@ -51,7 +51,7 @@ for create_mode in off falloc full; do
>          echo
>          echo "--- create_mode=$create_mode growth_mode=$growth_mode ---"
>  
> -        IMGOPTS="preallocation=$create_mode" _make_test_img ${CREATION_SIZE}K
> +        _make_test_img -o "preallocation=$create_mode" ${CREATION_SIZE}K
>          $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
>  
>          expected_size=0
Looks good as well.

> diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
> index 9c08172237..b0a6ae597b 100755
> --- a/tests/qemu-iotests/108
> +++ b/tests/qemu-iotests/108
> @@ -65,7 +65,7 @@ echo
>  echo '=== Repairing unreferenced data cluster in new refblock area ==='
>  echo
>  
> -IMGOPTS='cluster_size=512' _make_test_img 64M
> +_make_test_img -o 'cluster_size=512' 64M
>  # Allocate the first 128 kB in the image (first refblock)
>  $QEMU_IO -c 'write 0 0x1b200' "$TEST_IMG" | _filter_qemu_io
>  # should be 131072 == 0x20000
> 
Looks good.


> diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
> index 706c10b600..6850225939 100755
> --- a/tests/qemu-iotests/112
> +++ b/tests/qemu-iotests/112
> @@ -53,20 +53,20 @@ echo '=== refcount_bits limits ==='
>  echo
>  
>  # Must be positive (non-zero)
> -IMGOPTS="$IMGOPTS,refcount_bits=0" _make_test_img 64M
> +_make_test_img -o "refcount_bits=0" 64M
>  # Must be positive (non-negative)
> -IMGOPTS="$IMGOPTS,refcount_bits=-1" _make_test_img 64M
> +_make_test_img -o "refcount_bits=-1" 64M
>  # May not exceed 64
> -IMGOPTS="$IMGOPTS,refcount_bits=128" _make_test_img 64M
> +_make_test_img -o "refcount_bits=128" 64M
>  # Must be a power of two
> -IMGOPTS="$IMGOPTS,refcount_bits=42" _make_test_img 64M
> +_make_test_img -o "refcount_bits=42" 64M
>  
>  # 1 is the minimum
> -IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
> +_make_test_img -o "refcount_bits=1" 64M
>  print_refcount_bits
>  
>  # 64 is the maximum
> -IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
> +_make_test_img -o "refcount_bits=64" 64M
>  print_refcount_bits
>  
>  # 16 is the default
> @@ -78,19 +78,19 @@ echo '=== refcount_bits and compat=0.10 ==='
>  echo
>  
>  # Should work
> -IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=16" _make_test_img 64M
> +_make_test_img -o "compat=0.10,refcount_bits=16" 64M
>  print_refcount_bits
>  
>  # Should not work
> -IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=1" _make_test_img 64M
> -IMGOPTS="$IMGOPTS,compat=0.10,refcount_bits=64" _make_test_img 64M
> +_make_test_img -o "compat=0.10,refcount_bits=1" 64M
> +_make_test_img -o "compat=0.10,refcount_bits=64" 64M
>  
>  
>  echo
>  echo '=== Snapshot limit on refcount_bits=1 ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
> +_make_test_img -o "refcount_bits=1" 64M
>  print_refcount_bits
>  
>  $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
> @@ -106,7 +106,7 @@ echo
>  echo '=== Snapshot limit on refcount_bits=2 ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=2" _make_test_img 64M
> +_make_test_img -o "refcount_bits=2" 64M
>  print_refcount_bits
>  
>  $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
> @@ -124,7 +124,7 @@ echo
>  echo '=== Compressed clusters with refcount_bits=1 ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
> +_make_test_img -o "refcount_bits=1" 64M
>  print_refcount_bits
>  
>  # Both should fit into a single host cluster; instead of failing to increase the
> @@ -140,7 +140,7 @@ echo
>  echo '=== MSb set in 64 bit refcount ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
> +_make_test_img -o "refcount_bits=64" 64M
>  print_refcount_bits
>  
>  $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
> @@ -158,7 +158,7 @@ echo
>  echo '=== Snapshot on maximum 64 bit refcount value ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=64" _make_test_img 64M
> +_make_test_img -o "refcount_bits=64" 64M
>  print_refcount_bits
>  
>  $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
> @@ -239,7 +239,7 @@ echo
>  echo '=== Testing too many references for check ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=1" _make_test_img 64M
> +_make_test_img -o "refcount_bits=1" 64M
>  print_refcount_bits
>  
>  # This cluster should be created at 0x50000
> @@ -262,7 +262,7 @@ echo
>  echo '=== Multiple walks necessary during amend ==='
>  echo
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=1,cluster_size=512" _make_test_img 64k
> +_make_test_img -o "refcount_bits=1,cluster_size=512" 64k
>  
>  # Cluster 0 is the image header, clusters 1 to 4 are used by the L1 table, a
>  # single L2 table, the reftable and a single refblock. This creates 58 data
> 
Looks good.


> diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
> index 9ed3cb6a83..d254b18342 100755
> --- a/tests/qemu-iotests/115
> +++ b/tests/qemu-iotests/115
> @@ -64,8 +64,7 @@ echo
>  # least 256 MB. We can achieve that by using preallocation=metadata for an image
>  # which has a guest disk size of 256 MB.
>  
> -IMGOPTS="$IMGOPTS,refcount_bits=64,cluster_size=512,preallocation=metadata" \
> -    _make_test_img 256M
> +_make_test_img -o "refcount_bits=64,cluster_size=512,preallocation=metadata" 256M
>  
>  # We know for sure that the L1 and refcount tables do not overlap with any other
>  # structure because the metadata overlap checks would have caught that case.
Looks good.


> diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
> index 90a0424edb..10db813d94 100755
> --- a/tests/qemu-iotests/121
> +++ b/tests/qemu-iotests/121
> @@ -50,7 +50,7 @@ echo
>  # Preallocation speeds up the write operation, but preallocating everything will
>  # destroy the purpose of the write; so preallocate one KB less than what would
>  # cause a reftable growth...
> -IMGOPTS='preallocation=metadata,cluster_size=1k' _make_test_img 64512K
> +_make_test_img -o 'preallocation=metadata,cluster_size=1k' 64512K
>  # ...and make the image the desired size afterwards.
>  $QEMU_IMG resize "$TEST_IMG" 65M
>  
> @@ -73,7 +73,7 @@ echo
>  echo '--- Test 2 ---'
>  echo
>  
> -IMGOPTS='preallocation=metadata,cluster_size=1k' _make_test_img 64513K
> +_make_test_img -o 'preallocation=metadata,cluster_size=1k' 64513K
>  # This results in an L1 table growth which in turn results in some clusters at
>  # the start of the image becoming free
>  $QEMU_IMG resize "$TEST_IMG" 65M
> @@ -96,7 +96,7 @@ echo
>  echo '=== Allocating a new refcount block must not leave holes in the image ==='
>  echo
>  
> -IMGOPTS='cluster_size=512,refcount_bits=16' _make_test_img 1M
> +_make_test_img -o 'cluster_size=512,refcount_bits=16' 1M
>  
>  # This results in an image with 256 used clusters: the qcow2 header,
>  # the refcount table, one refcount block, the L1 table, four L2 tables
> 
Looks good.


> diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
> index 4e31aa4e5f..d510984045 100755
> --- a/tests/qemu-iotests/125
> +++ b/tests/qemu-iotests/125
> @@ -114,7 +114,7 @@ for GROWTH_SIZE in 16 48 80; do
>          for growth_mode in off metadata falloc full; do
>              echo "--- cluster_size=$cluster_size growth_size=$GROWTH_SIZE create_mode=$create_mode growth_mode=$growth_mode ---"
>  
> -            IMGOPTS="preallocation=$create_mode,cluster_size=$cluster_size" _make_test_img ${CREATION_SIZE}
> +            _make_test_img -o "preallocation=$create_mode,cluster_size=$cluster_size" ${CREATION_SIZE}
>              $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
>  
>              host_size_0=$(get_image_size_on_host)
> diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
> index 089821da0c..6cf2997577 100755
> --- a/tests/qemu-iotests/137
> +++ b/tests/qemu-iotests/137
> @@ -117,7 +117,7 @@ $QEMU_IO \
>      -c "reopen -o cache-clean-interval=-1" \
>      "$TEST_IMG" | _filter_qemu_io
>  
> -IMGOPTS="cluster_size=256k" _make_test_img 32P
> +_make_test_img -o "cluster_size=256k" 32P
>  $QEMU_IO \
>      -c "reopen -o l2-cache-entry-size=512,l2-cache-size=1T" \
>      "$TEST_IMG" | _filter_qemu_io
> 
Looks good.

> diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
> index 6a731370db..66ae9d5e78 100755
> --- a/tests/qemu-iotests/138
> +++ b/tests/qemu-iotests/138
> @@ -45,8 +45,7 @@ echo
>  echo '=== Check on an image with a multiple of 2^32 clusters ==='
>  echo
>  
> -IMGOPTS=$(_optstr_add "$IMGOPTS" "cluster_size=512") \
> -    _make_test_img 512
> +_make_test_img -o "cluster_size=512" 512
>  
>  # Allocate L2 table
>  $QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
> 
Looks good.

> diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
> index 55db2803ed..020ed8e61f 100755
> --- a/tests/qemu-iotests/175
> +++ b/tests/qemu-iotests/175
> @@ -95,7 +95,7 @@ stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_block
>  for mode in off full falloc; do
>      echo
>      echo "== creating image with preallocation $mode =="
> -    IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt
> +    _make_test_img -o preallocation=$mode $size | _filter_imgfmt
>      stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size
>  done
>  
> 
Looks good.

> diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
> index eb766ad09f..5890ff9cfc 100755
> --- a/tests/qemu-iotests/190
> +++ b/tests/qemu-iotests/190
> @@ -45,7 +45,7 @@ _supported_proto file
>  echo "== Huge file =="
>  echo
>  
> -IMGOPTS='cluster_size=2M' _make_test_img 2T
> +_make_test_img -o 'cluster_size=2M' 2T
>  
>  $QEMU_IMG measure -O raw -f qcow2 "$TEST_IMG"
>  $QEMU_IMG measure -O qcow2 -o cluster_size=64k -f qcow2 "$TEST_IMG"
> 
Looks good.

> diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
> index 528022e8d8..21c16a32cb 100755
> --- a/tests/qemu-iotests/191
> +++ b/tests/qemu-iotests/191
> @@ -51,8 +51,7 @@ echo === Preparing and starting VM ===
>  echo
>  
>  TEST_IMG="${TEST_IMG}.base" _make_test_img $size
> -IMGOPTS=$(_optstr_add "$IMGOPTS" "backing_fmt=$IMGFMT") \
> -    TEST_IMG="${TEST_IMG}.mid" _make_test_img -b "${TEST_IMG}.base"
> +TEST_IMG="${TEST_IMG}.mid" _make_test_img -o "backing_fmt=$IMGFMT" -b "${TEST_IMG}.base"
>  _make_test_img -b "${TEST_IMG}.mid"
>  TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid"
>  
> 
Looks good.

> diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
> index 2d62c5dcac..3769f372cb 100755
> --- a/tests/qemu-iotests/220
> +++ b/tests/qemu-iotests/220
> @@ -37,6 +37,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# To use a different refcount width but 16 bits we need compat=1.1
> +_unsupported_imgopts 'compat=0.10'
>  
>  echo "== Creating huge file =="
>  
> @@ -46,7 +48,7 @@ if ! truncate --size=513T "$TEST_IMG"; then
>      _notrun "file system on $TEST_DIR does not support large enough files"
>  fi
>  rm "$TEST_IMG"
> -IMGOPTS='cluster_size=2M,refcount_bits=1' _make_test_img 513T
> +_make_test_img -o 'cluster_size=2M,refcount_bits=1' 513T
>  
>  echo "== Populating refcounts =="
>  # We want an image with 256M refcounts * 2M clusters = 512T referenced.
> 
Looks good.


> diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
> index e563761307..2b84b896db 100755
> --- a/tests/qemu-iotests/243
> +++ b/tests/qemu-iotests/243
> @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# External data files do not work with compat=0.10
> +_unsupported_imgopts 'compat=0.10'
>  
>  for mode in off metadata falloc full; do
>  
> @@ -47,7 +49,7 @@ for mode in off metadata falloc full; do
>      echo "=== preallocation=$mode ==="
>      echo
>  
> -    IMGOPTS="preallocation=$mode" _make_test_img 64M
> +    _make_test_img -o "preallocation=$mode" 64M
>  
>      printf "File size: "
>      du -b $TEST_IMG | cut -f1
> @@ -64,7 +66,7 @@ for mode in off metadata falloc full; do
>      echo "=== External data file: preallocation=$mode ==="
>      echo
>  
> -    IMGOPTS="data_file=$TEST_IMG.data,preallocation=$mode" _make_test_img 64M
> +    _make_test_img -o "data_file=$TEST_IMG.data,preallocation=$mode" 64M
>  
>      echo -n "qcow2 file size: "
>      du -b $TEST_IMG | cut -f1
> 
Looks good.


> diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
> index 13978f93d2..0375bc12d4 100755
> --- a/tests/qemu-iotests/244
> +++ b/tests/qemu-iotests/244
> @@ -41,13 +41,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# External data files do not work with compat=0.10
> +_unsupported_imgopts 'compat=0.10'
>  
>  echo
>  echo "=== Create and open image with external data file ==="
>  echo
>  
>  echo "With data file name in the image:"
> -IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
> +_make_test_img -o "data_file=$TEST_IMG.data" 64M
>  _check_test_img
>  
>  $QEMU_IO -c "open $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qemu_io | _filter_testdir
> @@ -104,7 +106,7 @@ echo
>  echo "=== Standalone image with external data file (efficient) ==="
>  echo
>  
> -IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
> +_make_test_img -o "data_file=$TEST_IMG.data" 64M
>  
>  echo -n "qcow2 file size before I/O: "
>  du -b $TEST_IMG | cut -f1
> @@ -154,7 +156,7 @@ echo
>  echo "=== Standalone image with external data file (valid raw) ==="
>  echo
>  
> -IMGOPTS="data_file=$TEST_IMG.data,data_file_raw=on" _make_test_img 64M
> +_make_test_img -o "data_file=$TEST_IMG.data,data_file_raw=on" 64M
>  
>  echo -n "qcow2 file size before I/O: "
>  du -b $TEST_IMG | cut -f1
> @@ -187,7 +189,7 @@ echo
>  echo "=== bdrv_co_block_status test for file and offset=0 ==="
>  echo
>  
> -IMGOPTS="data_file=$TEST_IMG.data" _make_test_img 64M
> +_make_test_img -o "data_file=$TEST_IMG.data" 64M
>  
>  $QEMU_IO -c 'write -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
>  $QEMU_IO -c 'read -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
> 
Looks good.

> diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250
> index c9c0a84a5a..670cf19076 100755
> --- a/tests/qemu-iotests/250
> +++ b/tests/qemu-iotests/250
> @@ -55,9 +55,8 @@ disk_usage()
>  }
>  
>  size=2100M
> -IMGOPTS="cluster_size=1M,preallocation=metadata"
>  
> -_make_test_img $size
> +_make_test_img -o "cluster_size=1M,preallocation=metadata" $size
>  $QEMU_IO -c 'discard 0 10M' -c 'discard 2090M 10M' \
>           -c 'write 2090M 10M' -c 'write 0 10M' "$TEST_IMG" | _filter_qemu_io
>  
> 
Looks good.


> diff --git a/tests/qemu-iotests/265 b/tests/qemu-iotests/265
> index dce6f77be3..00f2ec769e 100755
> --- a/tests/qemu-iotests/265
> +++ b/tests/qemu-iotests/265
> @@ -41,7 +41,7 @@ _supported_os Linux
>  echo '--- Writing to the image ---'
>  
>  # Reduce cluster size so we get more and quicker I/O
> -IMGOPTS='cluster_size=4096' _make_test_img 1M
> +_make_test_img -o 'cluster_size=4096' 1M
>  (for ((kb = 1024 - 4; kb >= 0; kb -= 4)); do \
>       echo "aio_write -P 42 $((kb + 1))k 2k"; \
>   done) \
Looks good as well.



To make review of this patch a bit less boring, I went over all
the tests to understand more or less what each test does.
I hope that I didn't miss anything.

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky





^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images
  2019-10-15 14:27 ` [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images Max Reitz
@ 2019-11-06 15:47   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:47 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Just rm will not delete external data files.  Use _rm_test_img every
> time we delete a test image.
> 
> (In the process, clean up the indentation of every _cleanup() this patch
> touches.)
> 
> ((Also, use quotes consistently.  I am happy to see unquoted instances
> like "rm -rf $TEST_DIR/..." go.))
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/005 |  2 +-
>  tests/qemu-iotests/019 |  6 +++---
>  tests/qemu-iotests/020 |  6 +++---
>  tests/qemu-iotests/024 | 10 +++++-----
>  tests/qemu-iotests/028 |  2 +-
>  tests/qemu-iotests/029 |  2 +-
>  tests/qemu-iotests/043 |  4 +++-
>  tests/qemu-iotests/048 |  2 +-
>  tests/qemu-iotests/050 |  4 ++--
>  tests/qemu-iotests/053 |  4 ++--
>  tests/qemu-iotests/058 |  2 +-
>  tests/qemu-iotests/059 |  2 +-
>  tests/qemu-iotests/061 |  2 +-
>  tests/qemu-iotests/063 |  6 ++++--
>  tests/qemu-iotests/069 |  2 +-
>  tests/qemu-iotests/074 |  2 +-
>  tests/qemu-iotests/080 |  2 +-
>  tests/qemu-iotests/081 |  6 +++---
>  tests/qemu-iotests/085 |  9 ++++++---
>  tests/qemu-iotests/088 |  2 +-
>  tests/qemu-iotests/092 |  2 +-
>  tests/qemu-iotests/094 |  2 +-
>  tests/qemu-iotests/095 |  5 +++--
>  tests/qemu-iotests/099 |  7 ++++---
>  tests/qemu-iotests/109 |  4 ++--
>  tests/qemu-iotests/110 |  4 ++--
>  tests/qemu-iotests/122 |  6 ++++--
>  tests/qemu-iotests/123 |  2 +-
>  tests/qemu-iotests/141 |  4 +++-
>  tests/qemu-iotests/142 |  2 +-
>  tests/qemu-iotests/144 |  4 +++-
>  tests/qemu-iotests/153 | 10 +++-------
>  tests/qemu-iotests/156 |  8 ++++++--
>  tests/qemu-iotests/159 |  2 +-
>  tests/qemu-iotests/160 |  3 ++-
>  tests/qemu-iotests/161 |  4 ++--
>  tests/qemu-iotests/170 |  2 +-
>  tests/qemu-iotests/172 |  6 +++---
>  tests/qemu-iotests/173 |  3 ++-
>  tests/qemu-iotests/178 |  2 +-
>  tests/qemu-iotests/182 |  2 +-
>  tests/qemu-iotests/183 |  2 +-
>  tests/qemu-iotests/185 |  4 ++--
>  tests/qemu-iotests/187 |  6 +++---
>  tests/qemu-iotests/190 |  2 +-
>  tests/qemu-iotests/191 |  6 +++---
>  tests/qemu-iotests/195 |  2 +-
>  tests/qemu-iotests/197 |  2 +-
>  tests/qemu-iotests/200 |  3 ++-
>  tests/qemu-iotests/215 |  2 +-
>  tests/qemu-iotests/225 |  2 +-
>  tests/qemu-iotests/229 |  3 ++-
>  tests/qemu-iotests/232 |  4 +++-
>  tests/qemu-iotests/243 |  2 +-
>  tests/qemu-iotests/244 |  4 ++--
>  tests/qemu-iotests/247 |  4 +++-
>  tests/qemu-iotests/249 |  4 ++--
>  tests/qemu-iotests/252 |  2 +-
>  58 files changed, 119 insertions(+), 96 deletions(-)
> 
> diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
> index 58442762fe..2b651f2c37 100755
> --- a/tests/qemu-iotests/005
> +++ b/tests/qemu-iotests/005
> @@ -62,7 +62,7 @@ if [ "$IMGFMT" = "raw" ]; then
>      if ! truncate --size=5T "$TEST_IMG"; then
>          _notrun "file system on $TEST_DIR does not support large enough files"
>      fi
> -    rm "$TEST_IMG"
> +    _rm_test_img "$TEST_IMG"
>  fi
>  
>  echo
> diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
> index b4f5234609..813a84acac 100755
> --- a/tests/qemu-iotests/019
> +++ b/tests/qemu-iotests/019
> @@ -30,9 +30,9 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -    rm -f "$TEST_IMG.base"
> -    rm -f "$TEST_IMG.orig"
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.base"
> +    _rm_test_img "$TEST_IMG.orig"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
> index f41b92f35f..20f8f185d0 100755
> --- a/tests/qemu-iotests/020
> +++ b/tests/qemu-iotests/020
> @@ -28,9 +28,9 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -    rm -f "$TEST_IMG.base"
> -    rm -f "$TEST_IMG.orig"
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.base"
> +    _rm_test_img "$TEST_IMG.orig"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
> index 23298c6f59..e2e766241e 100755
> --- a/tests/qemu-iotests/024
> +++ b/tests/qemu-iotests/024
> @@ -29,12 +29,12 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_DIR/t.$IMGFMT.base_old"
> -    rm -f "$TEST_DIR/t.$IMGFMT.base_new"
> +    _rm_test_img "$TEST_DIR/t.$IMGFMT.base_old"
> +    _rm_test_img "$TEST_DIR/t.$IMGFMT.base_new"
>  
> -    rm -f "$TEST_DIR/subdir/t.$IMGFMT"
> -    rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_old"
> -    rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_new"
> +    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT"
> +    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_old"
> +    _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_new"
>      rmdir "$TEST_DIR/subdir" 2> /dev/null
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
> index 71301ec6e5..caf1258647 100755
> --- a/tests/qemu-iotests/028
> +++ b/tests/qemu-iotests/028
> @@ -32,7 +32,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm -f "${TEST_IMG}.copy"
> +    _rm_test_img "${TEST_IMG}.copy"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
> index 94c2713132..9254ede5e5 100755
> --- a/tests/qemu-iotests/029
> +++ b/tests/qemu-iotests/029
> @@ -28,7 +28,7 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f $TEST_IMG.snap
> +    _rm_test_img "$TEST_IMG.snap"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043
> index 67cc7e74c2..b102e49208 100755
> --- a/tests/qemu-iotests/043
> +++ b/tests/qemu-iotests/043
> @@ -29,7 +29,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG".[123].base
> +    for img in "$TEST_IMG".[123].base; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
> index bde408ca92..a8feb76184 100755
> --- a/tests/qemu-iotests/048
> +++ b/tests/qemu-iotests/048
> @@ -31,7 +31,7 @@ _cleanup()
>  {
>      echo "Cleanup"
>      _cleanup_test_img
> -    rm "${TEST_IMG_FILE2}"
> +    _rm_test_img "${TEST_IMG_FILE2}"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
> index 272ecab195..cdc5356541 100755
> --- a/tests/qemu-iotests/050
> +++ b/tests/qemu-iotests/050
> @@ -29,8 +29,8 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.old"
> -    rm -f "$TEST_IMG.new"
> +    _rm_test_img "$TEST_IMG.old"
> +    _rm_test_img "$TEST_IMG.new"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
> index e82bb69881..71d299c4f9 100755
> --- a/tests/qemu-iotests/053
> +++ b/tests/qemu-iotests/053
> @@ -28,8 +28,8 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	rm -f "$TEST_IMG.orig"
> -	_cleanup_test_img
> +    _rm_test_img "$TEST_IMG.orig"
> +    _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
> index 8c3212a72f..ed01115fa3 100755
> --- a/tests/qemu-iotests/058
> +++ b/tests/qemu-iotests/058
> @@ -42,7 +42,7 @@ _cleanup()
>  {
>      nbd_server_stop
>      _cleanup_test_img
> -    rm -f "$converted_image"
> +    _rm_test_img "$converted_image"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
> index 3941c3f0c2..5438025285 100755
> --- a/tests/qemu-iotests/059
> +++ b/tests/qemu-iotests/059
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.qcow2"
> +    IMGFMT=qcow2 _rm_test_img "$TEST_IMG.qcow2"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
> index 0480be0141..b4076d8e8b 100755
> --- a/tests/qemu-iotests/061
> +++ b/tests/qemu-iotests/061
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.data
> +    _rm_test_img "$TEST_IMG.data"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
> index 7cf0427af4..eef2b8a534 100755
> --- a/tests/qemu-iotests/063
> +++ b/tests/qemu-iotests/063
> @@ -29,8 +29,10 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -	rm -f "$TEST_IMG.orig" "$TEST_IMG.raw1" "$TEST_IMG.raw2"
> +    _cleanup_test_img
> +    for img in "$TEST_IMG".{orig,raw1,raw2,target}; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
> index 3974714852..b997b127f0 100755
> --- a/tests/qemu-iotests/069
> +++ b/tests/qemu-iotests/069
> @@ -47,7 +47,7 @@ echo "=== Creating an image with a backing file and deleting that file ==="
>  echo
>  TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
>  _make_test_img -b "$TEST_IMG.base" $IMG_SIZE
> -rm -f "$TEST_IMG.base"
> +_rm_test_img "$TEST_IMG.base"
>  # Just open the image and close it right again (this should print an error message)
>  $QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
>  
> diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
> index bb4ad1cc08..62be89a0d9 100755
> --- a/tests/qemu-iotests/074
> +++ b/tests/qemu-iotests/074
> @@ -31,7 +31,7 @@ _cleanup()
>  {
>      echo "Cleanup"
>      _cleanup_test_img
> -    rm "${TEST_IMG2}"
> +    _rm_test_img "${TEST_IMG2}"
>      rm -f "$TEST_DIR/blkdebug.conf"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
> index 4bcb5021e8..b1ecafb41e 100755
> --- a/tests/qemu-iotests/080
> +++ b/tests/qemu-iotests/080
> @@ -28,7 +28,7 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f $TEST_IMG.snap
> +    _rm_test_img "$TEST_IMG.snap"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
> index 85acdf76d4..537d40dfd5 100755
> --- a/tests/qemu-iotests/081
> +++ b/tests/qemu-iotests/081
> @@ -28,9 +28,9 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -rf $TEST_DIR/1.raw
> -    rm -rf $TEST_DIR/2.raw
> -    rm -rf $TEST_DIR/3.raw
> +    _rm_test_img "$TEST_DIR/1.raw"
> +    _rm_test_img "$TEST_DIR/2.raw"
> +    _rm_test_img "$TEST_DIR/3.raw"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
> index d40fdab542..bbea1252d2 100755
> --- a/tests/qemu-iotests/085
> +++ b/tests/qemu-iotests/085
> @@ -41,10 +41,13 @@ _cleanup()
>      _cleanup_qemu
>      for i in $(seq 1 ${SNAPSHOTS})
>      do
> -        rm -f "${TEST_DIR}/${i}-${snapshot_virt0}"
> -        rm -f "${TEST_DIR}/${i}-${snapshot_virt1}"
> +        _rm_test_img "${TEST_DIR}/${i}-${snapshot_virt0}"
> +        _rm_test_img "${TEST_DIR}/${i}-${snapshot_virt1}"
> +    done
> +    for img in "${TEST_IMG}".{1,2,base}
> +    do
> +        _rm_test_img "$img"
>      done
> -    rm -f "${TEST_IMG}" "${TEST_IMG}.1" "${TEST_IMG}.2" "${TEST_IMG}.base"
>  
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088
> index b44edd0cf9..ef1163346c 100755
> --- a/tests/qemu-iotests/088
> +++ b/tests/qemu-iotests/088
> @@ -28,7 +28,7 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f $TEST_IMG.snap
> +    _rm_test_img "$TEST_IMG.snap"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092
> index e2e0726de1..40ec62b6f1 100755
> --- a/tests/qemu-iotests/092
> +++ b/tests/qemu-iotests/092
> @@ -28,7 +28,7 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f $TEST_IMG.snap
> +    _rm_test_img "$TEST_IMG.snap"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
> index d645952d54..2d3e1004d3 100755
> --- a/tests/qemu-iotests/094
> +++ b/tests/qemu-iotests/094
> @@ -30,7 +30,7 @@ _cleanup()
>  {
>      _cleanup_qemu
>      _cleanup_test_img
> -    rm -f "$TEST_DIR/source.$IMGFMT"
> +    _rm_test_img "$TEST_DIR/source.$IMGFMT"
>  }
>  
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095
> index 58fe174b5e..155ae86aa7 100755
> --- a/tests/qemu-iotests/095
> +++ b/tests/qemu-iotests/095
> @@ -32,8 +32,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm  -f "${TEST_IMG}.base" "${TEST_IMG}.snp1"
> -	_cleanup_test_img
> +    _rm_test_img "${TEST_IMG}.base"
> +    _rm_test_img "${TEST_IMG}.snp1"
> +    _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
> index c3cf66798a..b383c11e6a 100755
> --- a/tests/qemu-iotests/099
> +++ b/tests/qemu-iotests/099
> @@ -29,7 +29,10 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.compare"
> +    rm -f "$TEST_DIR/blkdebug.conf"
> +
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> @@ -121,8 +124,6 @@ echo
>  test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG"
>  
>  
> -rm -f "$TEST_IMG.compare" "$TEST_DIR/blkdebug.conf"
> -
>  # success, all done
>  echo "*** done"
>  rm -f $seq.full
> diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
> index 9897ceb6cd..ba638db11f 100755
> --- a/tests/qemu-iotests/109
> +++ b/tests/qemu-iotests/109
> @@ -29,8 +29,8 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm -f $TEST_IMG.src
> -	_cleanup_test_img
> +    _rm_test_img "$TEST_IMG.src"
> +    _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
> index 2ef516baf1..f78df0e6e1 100755
> --- a/tests/qemu-iotests/110
> +++ b/tests/qemu-iotests/110
> @@ -28,8 +28,8 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -        rm -f "$TEST_IMG.copy"
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.copy"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
> index 059011ebb1..dfa350936f 100755
> --- a/tests/qemu-iotests/122
> +++ b/tests/qemu-iotests/122
> @@ -28,8 +28,10 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f "$TEST_IMG".[123]
> -	_cleanup_test_img
> +    for img in "$TEST_IMG".[123]; do
> +        _rm_test_img "$img"
> +    done
> +    _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
> index 74d40d0478..01b771c76e 100755
> --- a/tests/qemu-iotests/123
> +++ b/tests/qemu-iotests/123
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$SRC_IMG"
> +    _rm_test_img "$SRC_IMG"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
> index 8c2ae79f2b..5192d256e3 100755
> --- a/tests/qemu-iotests/141
> +++ b/tests/qemu-iotests/141
> @@ -30,7 +30,9 @@ _cleanup()
>  {
>      _cleanup_qemu
>      _cleanup_test_img
> -    rm -f "$TEST_DIR"/{b,m,o}.$IMGFMT
> +    for img in "$TEST_DIR"/{b,m,o}.$IMGFMT; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
> index 6b62271876..daefcbaa58 100755
> --- a/tests/qemu-iotests/142
> +++ b/tests/qemu-iotests/142
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.snap
> +    _rm_test_img "$TEST_IMG.snap"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144
> index 011ed4f2bc..4569ac0b4b 100755
> --- a/tests/qemu-iotests/144
> +++ b/tests/qemu-iotests/144
> @@ -34,7 +34,9 @@ TMP_SNAP2=${TEST_DIR}/tmp2.qcow2
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm -f "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}"
> +    for img in "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}"; do
> +        _rm_test_img "$img"
> +    done
>  }
>  
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
> index e59090259c..2b13111768 100755
> --- a/tests/qemu-iotests/153
> +++ b/tests/qemu-iotests/153
> @@ -30,13 +30,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "${TEST_IMG}.base"
> -    rm -f "${TEST_IMG}.overlay"
> -    rm -f "${TEST_IMG}.convert"
> -    rm -f "${TEST_IMG}.a"
> -    rm -f "${TEST_IMG}.b"
> -    rm -f "${TEST_IMG}.c"
> -    rm -f "${TEST_IMG}.lnk"
> +    for img in "${TEST_IMG}".{base,overlay,convert,a,b,c,lnk}; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
> index 2ffa3ca942..3f27db71f2 100755
> --- a/tests/qemu-iotests/156
> +++ b/tests/qemu-iotests/156
> @@ -37,7 +37,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm -f "$TEST_IMG"{,.target}{,.backing,.overlay}
> +    for img in "$TEST_IMG"{,.target}{,.backing,.overlay}; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> @@ -120,7 +122,9 @@ _send_qemu_cmd $QEMU_HANDLE \
>      '"status": "null"'
>  
>  # Remove the source images
> -rm -f "$TEST_IMG{,.backing,.overlay}"
> +for img in "$TEST_IMG{,.backing,.overlay}"; do
> +    _rm_test_img "$img"
> +done
>  
>  echo
>  
> diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159
> index 2557140ac2..f9690053a2 100755
> --- a/tests/qemu-iotests/159
> +++ b/tests/qemu-iotests/159
> @@ -28,7 +28,7 @@ status=1
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.out"
> +    _rm_test_img "$TEST_IMG.out"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160
> index df89d3864b..0572b5ae9a 100755
> --- a/tests/qemu-iotests/160
> +++ b/tests/qemu-iotests/160
> @@ -28,7 +28,8 @@ status=1
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.out" "$TEST_IMG.out.dd"
> +    _rm_test_img "$TEST_IMG.out"
> +    _rm_test_img "$TEST_IMG.out.dd"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
> index 456a4bd8c4..f572a19af2 100755
> --- a/tests/qemu-iotests/161
> +++ b/tests/qemu-iotests/161
> @@ -30,8 +30,8 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.base"
> -    rm -f "$TEST_IMG.int"
> +    _rm_test_img "$TEST_IMG.base"
> +    _rm_test_img "$TEST_IMG.int"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170
> index 05dd6ed6c3..6c8f0e8085 100755
> --- a/tests/qemu-iotests/170
> +++ b/tests/qemu-iotests/170
> @@ -28,7 +28,7 @@ status=1
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.out"
> +    _rm_test_img  "$TEST_IMG.out"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
> index d67997e5f6..7195fb895a 100755
> --- a/tests/qemu-iotests/172
> +++ b/tests/qemu-iotests/172
> @@ -28,9 +28,9 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -    rm -f "$TEST_IMG.2"
> -    rm -f "$TEST_IMG.3"
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.2"
> +    _rm_test_img "$TEST_IMG.3"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173
> index 9e2fa2e73c..bba26f0d2a 100755
> --- a/tests/qemu-iotests/173
> +++ b/tests/qemu-iotests/173
> @@ -29,7 +29,8 @@ status=1    # failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm  -f "${QEMU_TEST_DIR}/image.base" "${QEMU_TEST_DIR}/image.snp1"
> +    _rm_test_img "${TEST_DIR}/image.base"
> +    _rm_test_img "${TEST_DIR}/image.snp1"
>      _cleanup_test_img
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
> index 75b5e8f314..51a70fe669 100755
> --- a/tests/qemu-iotests/178
> +++ b/tests/qemu-iotests/178
> @@ -29,7 +29,7 @@ status=1    # failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.converted"
> +    _rm_test_img "$TEST_IMG.converted"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
> index 7f494eb9bb..8de724e7ec 100755
> --- a/tests/qemu-iotests/182
> +++ b/tests/qemu-iotests/182
> @@ -30,7 +30,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.overlay"
> +    _rm_test_img "$TEST_IMG.overlay"
>      rm -f "$TEST_DIR/nbd.socket"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183
> index 04fb344d08..eff8e0216c 100755
> --- a/tests/qemu-iotests/183
> +++ b/tests/qemu-iotests/183
> @@ -31,7 +31,7 @@ MIG_SOCKET="${TEST_DIR}/migrate"
>  _cleanup()
>  {
>      rm -f "${MIG_SOCKET}"
> -    rm -f "${TEST_IMG}.dest"
> +    _rm_test_img "${TEST_IMG}.dest"
>      _cleanup_test_img
>      _cleanup_qemu
>  }
> diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
> index 454ff600cc..e50f19ebf0 100755
> --- a/tests/qemu-iotests/185
> +++ b/tests/qemu-iotests/185
> @@ -28,8 +28,8 @@ status=1 # failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f "${TEST_IMG}.mid"
> -    rm -f "${TEST_IMG}.copy"
> +    _rm_test_img "${TEST_IMG}.mid"
> +    _rm_test_img "${TEST_IMG}.copy"
>      _cleanup_test_img
>      _cleanup_qemu
>  }
> diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187
> index 2fcef9e2bd..c6e1dc57a0 100755
> --- a/tests/qemu-iotests/187
> +++ b/tests/qemu-iotests/187
> @@ -28,9 +28,9 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> -    rm -f "$TEST_IMG.2"
> -    rm -f "$TEST_IMG.3"
> +    _cleanup_test_img
> +    _rm_test_img "$TEST_IMG.2"
> +    _rm_test_img "$TEST_IMG.3"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
> index 5890ff9cfc..6d41650438 100755
> --- a/tests/qemu-iotests/190
> +++ b/tests/qemu-iotests/190
> @@ -29,7 +29,7 @@ status=1    # failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.converted"
> +    _rm_test_img "$TEST_IMG.converted"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
> index 21c16a32cb..23ab0ce899 100755
> --- a/tests/qemu-iotests/191
> +++ b/tests/qemu-iotests/191
> @@ -28,9 +28,9 @@ status=1 # failure is the default!
>  
>  _cleanup()
>  {
> -    rm -f "${TEST_IMG}.mid"
> -    rm -f "${TEST_IMG}.ovl2"
> -    rm -f "${TEST_IMG}.ovl3"
> +    _rm_test_img "${TEST_IMG}.mid"
> +    _rm_test_img "${TEST_IMG}.ovl2"
> +    _rm_test_img "${TEST_IMG}.ovl3"
>      _cleanup_test_img
>      _cleanup_qemu
>  }
> diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
> index ef7b9a94e2..48984b7ac1 100755
> --- a/tests/qemu-iotests/195
> +++ b/tests/qemu-iotests/195
> @@ -29,7 +29,7 @@ status=1 # failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.mid"
> +    _rm_test_img "$TEST_IMG.mid"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
> index 4d3d08ad6f..95f05b0e34 100755
> --- a/tests/qemu-iotests/197
> +++ b/tests/qemu-iotests/197
> @@ -43,7 +43,7 @@ esac
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_WRAP"
> +    _rm_test_img "$TEST_WRAP"
>      rm -f "$BLKDBG_CONF"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
> index d904885136..a2cdd7f83d 100755
> --- a/tests/qemu-iotests/200
> +++ b/tests/qemu-iotests/200
> @@ -31,7 +31,8 @@ status=1    # failure is the default!
>  _cleanup()
>  {
>      _cleanup_qemu
> -    rm -f "${TEST_IMG}" "${BACKING_IMG}"
> +    _rm_test_img "${TEST_IMG}"
> +    _rm_test_img "${BACKING_IMG}"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
> index 55a1874dcd..f99bae78c7 100755
> --- a/tests/qemu-iotests/215
> +++ b/tests/qemu-iotests/215
> @@ -40,7 +40,7 @@ esac
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_WRAP"
> +    _rm_test_img "$TEST_WRAP"
>      rm -f "$BLKDBG_CONF"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225
> index fbd7404791..c9a334c7e9 100755
> --- a/tests/qemu-iotests/225
> +++ b/tests/qemu-iotests/225
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.not_base"
> +    _rm_test_img "$TEST_IMG.not_base"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
> index e18a464fe0..866168b236 100755
> --- a/tests/qemu-iotests/229
> +++ b/tests/qemu-iotests/229
> @@ -31,7 +31,8 @@ _cleanup()
>  {
>      _cleanup_qemu
>      _cleanup_test_img
> -    rm -f "$TEST_IMG" "$DEST_IMG"
> +    _rm_test_img "$TEST_IMG"
> +    _rm_test_img "$DEST_IMG"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
> index 65b0e42063..685356ac3b 100755
> --- a/tests/qemu-iotests/232
> +++ b/tests/qemu-iotests/232
> @@ -29,7 +29,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.[01234]
> +    for img in "$TEST_IMG".[01234]; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
> index 2b84b896db..3dc3b6a711 100755
> --- a/tests/qemu-iotests/243
> +++ b/tests/qemu-iotests/243
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.data
> +    _rm_test_img "$TEST_IMG.data"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
> index 0375bc12d4..13263292b0 100755
> --- a/tests/qemu-iotests/244
> +++ b/tests/qemu-iotests/244
> @@ -29,8 +29,8 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.data
> -    rm -f $TEST_IMG.src
> +    _rm_test_img "$TEST_IMG.data"
> +    _rm_test_img "$TEST_IMG.src"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/247 b/tests/qemu-iotests/247
> index c853b73819..87e37b39e2 100755
> --- a/tests/qemu-iotests/247
> +++ b/tests/qemu-iotests/247
> @@ -29,7 +29,9 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f $TEST_IMG.[01234]
> +    for img in "$TEST_IMG".[01234]; do
> +        _rm_test_img "$img"
> +    done
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249
> index e4650ecf6b..2b99c9789e 100755
> --- a/tests/qemu-iotests/249
> +++ b/tests/qemu-iotests/249
> @@ -30,8 +30,8 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.base"
> -    rm -f "$TEST_IMG.int"
> +    _rm_test_img "$TEST_IMG.base"
> +    _rm_test_img "$TEST_IMG.int"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/252 b/tests/qemu-iotests/252
> index f6c8f71444..83280c1715 100755
> --- a/tests/qemu-iotests/252
> +++ b/tests/qemu-iotests/252
> @@ -29,7 +29,7 @@ status=1	# failure is the default!
>  _cleanup()
>  {
>      _cleanup_test_img
> -    rm -f "$TEST_IMG.base_new"
> +    _rm_test_img "$TEST_IMG.base_new"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  

I might have missed something, but it looks all right, so:

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267
  2019-10-15 14:27 ` [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267 Max Reitz
@ 2019-11-06 15:50   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:50 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Overwriting IMGOPTS means ignoring all user-supplied options, which is
> not what we want.  Replace the current IMGOPTS use by a new BACKING_FILE
> variable.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/267 | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267
> index d37a67c012..eda45449d4 100755
> --- a/tests/qemu-iotests/267
> +++ b/tests/qemu-iotests/267
> @@ -68,7 +68,11 @@ size=128M
>  
>  run_test()
>  {
> -    _make_test_img $size
> +    if [ -n "$BACKING_FILE" ]; then
> +        _make_test_img -b "$BACKING_FILE" $size
> +    else
> +        _make_test_img $size
> +    fi
>      printf "savevm snap0\ninfo snapshots\nloadvm snap0\n" | run_qemu "$@" | _filter_date
>  }
>  
> @@ -119,12 +123,12 @@ echo
>  
>  TEST_IMG="$TEST_IMG.base" _make_test_img $size
>  
> -IMGOPTS="backing_file=$TEST_IMG.base" \
> +BACKING_FILE="$TEST_IMG.base" \
>  run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
>           -blockdev driver=file,filename="$TEST_IMG",node-name=file \
>           -blockdev driver=$IMGFMT,file=file,backing=backing-file,node-name=fmt
>  
> -IMGOPTS="backing_file=$TEST_IMG.base" \
> +BACKING_FILE="$TEST_IMG.base" \
>  run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
>           -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \
>           -blockdev driver=file,filename="$TEST_IMG",node-name=file \
> @@ -141,7 +145,7 @@ echo
>  echo "=== -blockdev with NBD server on the backing file ==="
>  echo
>  
> -IMGOPTS="backing_file=$TEST_IMG.base" _make_test_img $size
> +_make_test_img -b "$TEST_IMG.base" $size
>  cat <<EOF |
>  nbd_server_start unix:$TEST_DIR/nbd
>  nbd_server_add -w backing-fmt

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 16/21] iotests: Make 091 work with data_file
  2019-10-15 14:27 ` [PATCH v2 16/21] iotests: Make 091 work with data_file Max Reitz
@ 2019-11-06 15:50   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:50 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> The image end offset as reported by qemu-img check is different when
> using an external data file; we do not care about its value here, so we
> can just filter it.  Incidentally, common.rc already has _check_test_img
> for us which does exactly that.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/091     | 2 +-
>  tests/qemu-iotests/091.out | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091
> index f4b44659ae..0874fa84c8 100755
> --- a/tests/qemu-iotests/091
> +++ b/tests/qemu-iotests/091
> @@ -101,7 +101,7 @@ echo "Check image pattern"
>  ${QEMU_IO} -c "read -P 0x22 0 4M" "${TEST_IMG}" | _filter_testdir | _filter_qemu_io
>  
>  echo "Running 'qemu-img check -r all \$TEST_IMG'"
> -"${QEMU_IMG}" check -r all "${TEST_IMG}" 2>&1 | _filter_testdir | _filter_qemu
> +_check_test_img -r all
>  
>  echo "*** done"
>  rm -f $seq.full
> diff --git a/tests/qemu-iotests/091.out b/tests/qemu-iotests/091.out
> index 5017f8c2d9..5ec7b00f13 100644
> --- a/tests/qemu-iotests/091.out
> +++ b/tests/qemu-iotests/091.out
> @@ -23,6 +23,4 @@ read 4194304/4194304 bytes at offset 0
>  4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  Running 'qemu-img check -r all $TEST_IMG'
>  No errors were found on the image.
> -80/16384 = 0.49% allocated, 0.00% fragmented, 0.00% compressed clusters
> -Image end offset: 5570560
>  *** done
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 17/21] iotests: Make 110 work with data_file
  2019-10-15 14:27 ` [PATCH v2 17/21] iotests: Make 110 " Max Reitz
@ 2019-11-06 15:50   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:50 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> The only difference is that the json:{} filename of the image looks
> different.  We actually do not care about that filename in this test, we
> are only interested in (1) that there is a json:{} filename, and (2)
> whether the backing filename can be constructed.
> 
> So just filter out the json:{} data, thus making this test pass both
> with and without data_file.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/110     | 7 +++++--
>  tests/qemu-iotests/110.out | 4 ++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
> index f78df0e6e1..139c02c2cf 100755
> --- a/tests/qemu-iotests/110
> +++ b/tests/qemu-iotests/110
> @@ -67,6 +67,7 @@ echo
>  # Across blkdebug without a config file, you cannot reconstruct filenames, so
>  # qemu is incapable of knowing the directory of the top image from the filename
>  # alone. However, using bdrv_dirname(), it should still work.
> +# (Filter out the json:{} filename so this test works with external data files)
>  TEST_IMG="json:{
>      'driver': '$IMGFMT',
>      'file': {
> @@ -82,7 +83,8 @@ TEST_IMG="json:{
>              }
>          ]
>      }
> -}" _img_info | _filter_img_info | grep -v 'backing file format'
> +}" _img_info | _filter_img_info | grep -v 'backing file format' \
> +    | _filter_json_filename
>  
>  echo
>  echo '=== Backing name is always relative to the backed image ==='
> @@ -114,7 +116,8 @@ TEST_IMG="json:{
>              }
>          ]
>      }
> -}" _img_info | _filter_img_info | grep -v 'backing file format'
> +}" _img_info | _filter_img_info | grep -v 'backing file format' \
> +    | _filter_json_filename
>  
>  
>  # success, all done
> diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out
> index f60b26390e..f835553a99 100644
> --- a/tests/qemu-iotests/110.out
> +++ b/tests/qemu-iotests/110.out
> @@ -11,7 +11,7 @@ backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
>  
>  === Non-reconstructable filename ===
>  
> -image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
> +image: json:{ /* filtered */ }
>  file format: IMGFMT
>  virtual size: 64 MiB (67108864 bytes)
>  backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
> @@ -22,7 +22,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.b
>  
>  === Nodes without a common directory ===
>  
> -image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-
> threshold": 1}}
> +image: json:{ /* filtered */ }
>  file format: IMGFMT
>  virtual size: 64 MiB (67108864 bytes)
>  backing file: t.IMGFMT.base (cannot determine actual path)

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 18/21] iotests: Make 137 work with data_file
  2019-10-15 14:27 ` [PATCH v2 18/21] iotests: Make 137 " Max Reitz
@ 2019-11-06 15:51   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:51 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> When using an external data file, there are no refcounts for data
> clusters.  We thus have to adjust the corruption test in this patch to
> not be based around a data cluster allocation, but the L2 table
> allocation (L2 tables are still refcounted with external data files).
> 
> Furthermore, we should not print qcow2.py's list of incompatible
> features because it differs depending on whether there is an external
> data file or not.
> 
> With those two changes, the test will work both with an external data
> files (once that options works with the iotests at all).
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/137     | 15 +++++++++++----
>  tests/qemu-iotests/137.out |  6 ++----
>  2 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
> index 6cf2997577..7ae86892f7 100755
> --- a/tests/qemu-iotests/137
> +++ b/tests/qemu-iotests/137
> @@ -138,14 +138,21 @@ $QEMU_IO \
>      "$TEST_IMG" 2>&1 | _filter_qemu_io
>  
>  # The dirty bit must not be set
> -$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +# (Filter the external data file bit)
> +if $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features \
> +    | grep -q '\<0\>'
> +then
> +    echo 'ERROR: Dirty bit set'
> +else
> +    echo 'OK: Dirty bit not set'
> +fi
>  
>  # Similarly we can test whether corruption detection has been enabled:
> -# Create L1/L2, overwrite first entry in refcount block, allocate something.
> +# Create L1, overwrite refcounts, force allocation of L2 by writing
> +# data.
>  # Disabling the checks should fail, so the corruption must be detected.
>  _make_test_img 64M
> -$QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
> -poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00"
> +poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00\x00\x00\x00\x00\x00\x00"
>  $QEMU_IO \
>      -c "reopen -o overlap-check=none,lazy-refcounts=42" \
>      -c "write 64k 64k" \
> 



> diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
> index bd4523a853..86377c80cd 100644
> --- a/tests/qemu-iotests/137.out
> +++ b/tests/qemu-iotests/137.out
> @@ -36,11 +36,9 @@ qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.rc: Killed                  ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> -incompatible_features     []
> +OK: Dirty bit not set
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
> -wrote 65536/65536 bytes at offset 0
> -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off'
> -qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with qcow2_header); further corruption events will be suppressed
> +qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table at offset 0; further corruption events will be suppressed
>  write failed: Input/output error
>  *** done


Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 19/21] iotests: Make 198 work with data_file
  2019-10-15 14:27 ` [PATCH v2 19/21] iotests: Make 198 " Max Reitz
@ 2019-11-06 15:51   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:51 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> We do not care about the json:{} filenames here, so we can just filter
> them out and thus make the test work both with and without external data
> files.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/198     | 6 ++++--
>  tests/qemu-iotests/198.out | 4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
> index c8f824cfae..fb0d5a29d3 100755
> --- a/tests/qemu-iotests/198
> +++ b/tests/qemu-iotests/198
> @@ -92,13 +92,15 @@ echo
>  echo "== checking image base =="
>  $QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-specific \
>      | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
> -          -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
> +          -e '/lazy refcounts:/ D' -e '/corrupt:/ D' -e '/^\s*data file/ D' \
> +    | _filter_json_filename
>  
>  echo
>  echo "== checking image layer =="
>  $QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-specific \
>      | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
> -          -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
> +          -e '/lazy refcounts:/ D' -e '/corrupt:/ D' -e '/^\s*data file/ D' \
> +    | _filter_json_filename
>  
>  
>  # success, all done
> diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out
> index e86b175e39..831ce3a289 100644
> --- a/tests/qemu-iotests/198.out
> +++ b/tests/qemu-iotests/198.out
> @@ -32,7 +32,7 @@ read 16777216/16777216 bytes at offset 0
>  16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  
>  == checking image base ==
> -image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}}
> +image: json:{ /* filtered */ }
>  file format: IMGFMT
>  virtual size: 16 MiB (16777216 bytes)
>  Format specific information:
> @@ -74,7 +74,7 @@ Format specific information:
>          master key iters: 1024
>  
>  == checking image layer ==
> -image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}
> +image: json:{ /* filtered */ }
>  file format: IMGFMT
>  virtual size: 16 MiB (16777216 bytes)
>  backing file: TEST_DIR/t.IMGFMT.base


Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 20/21] iotests: Disable data_file where it cannot be used
  2019-10-15 14:27 ` [PATCH v2 20/21] iotests: Disable data_file where it cannot be used Max Reitz
@ 2019-11-06 15:52   ` Maxim Levitsky
  2019-11-07 11:36     ` Max Reitz
  0 siblings, 1 reply; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:52 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/007 | 5 +++--
>  tests/qemu-iotests/014 | 2 ++
>  tests/qemu-iotests/015 | 5 +++--
>  tests/qemu-iotests/026 | 5 ++++-
>  tests/qemu-iotests/029 | 5 +++--
>  tests/qemu-iotests/031 | 6 +++---
>  tests/qemu-iotests/036 | 5 +++--
>  tests/qemu-iotests/039 | 3 +++
>  tests/qemu-iotests/046 | 2 ++
>  tests/qemu-iotests/048 | 2 ++
>  tests/qemu-iotests/051 | 5 +++--
>  tests/qemu-iotests/058 | 5 +++--
>  tests/qemu-iotests/060 | 6 ++++--
>  tests/qemu-iotests/061 | 6 ++++--
>  tests/qemu-iotests/062 | 2 +-
>  tests/qemu-iotests/066 | 2 +-
>  tests/qemu-iotests/067 | 6 ++++--
>  tests/qemu-iotests/068 | 5 +++--
>  tests/qemu-iotests/071 | 3 +++
>  tests/qemu-iotests/073 | 2 ++
>  tests/qemu-iotests/074 | 2 ++
>  tests/qemu-iotests/080 | 5 +++--
>  tests/qemu-iotests/090 | 2 ++
>  tests/qemu-iotests/098 | 6 ++++--
>  tests/qemu-iotests/099 | 3 ++-
>  tests/qemu-iotests/103 | 5 +++--
>  tests/qemu-iotests/108 | 6 ++++--
>  tests/qemu-iotests/112 | 5 +++--
>  tests/qemu-iotests/114 | 2 ++
>  tests/qemu-iotests/121 | 3 +++
>  tests/qemu-iotests/138 | 2 ++
>  tests/qemu-iotests/156 | 2 ++
>  tests/qemu-iotests/176 | 7 +++++--
>  tests/qemu-iotests/191 | 2 ++
>  tests/qemu-iotests/201 | 6 +++---
>  tests/qemu-iotests/214 | 3 ++-
>  tests/qemu-iotests/217 | 3 ++-
>  tests/qemu-iotests/220 | 5 +++--
>  tests/qemu-iotests/243 | 6 ++++--
>  tests/qemu-iotests/244 | 5 +++--
>  tests/qemu-iotests/250 | 2 ++
>  tests/qemu-iotests/267 | 5 +++--
>  42 files changed, 117 insertions(+), 52 deletions(-)
> 


> diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
> index 7d3544b479..160683adf8 100755
> --- a/tests/qemu-iotests/007
> +++ b/tests/qemu-iotests/007
> @@ -41,8 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  # refcount_bits must be at least 4 so we can create ten internal snapshots
> -# (1 bit supports none, 2 bits support two, 4 bits support 14)
> -_unsupported_imgopts 'refcount_bits=\(1\|2\)[^0-9]'
> +# (1 bit supports none, 2 bits support two, 4 bits support 14);
> +# snapshot are generally impossible with external data files
> +_unsupported_imgopts 'refcount_bits=\(1\|2\)[^0-9]' data_file
ACK
>  
>  echo
>  echo "creating image"



> diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
> index 2f728a1956..e1221c0fff 100755
> --- a/tests/qemu-iotests/014
> +++ b/tests/qemu-iotests/014
> @@ -43,6 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# Compression and snapshots do not work with external data files
> +_unsupported_imgopts data_file
ACK
>  
>  TEST_OFFSETS="0 4294967296"
>  TEST_OPS="writev read write readv"



> diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015
> index eec5387f3d..4d8effd0ae 100755
> --- a/tests/qemu-iotests/015
> +++ b/tests/qemu-iotests/015
> @@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # actually any format that supports snapshots
>  _supported_fmt qcow2
>  _supported_proto generic
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
ACK
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
>  
>  echo
>  echo "creating image"


> diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
> index 3430029ed6..a4aa74764f 100755
> --- a/tests/qemu-iotests/026
> +++ b/tests/qemu-iotests/026
> @@ -49,7 +49,10 @@ _supported_cache_modes writethrough none
>  # 32 and 64 bits do not work either, however, due to different leaked cluster
>  # count on error.
>  # Thus, the only remaining option is refcount_bits=16.
> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +#
> +# As for data_file, none of the refcount tests can work for it.
ACK
> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' \
> +    data_file
>  
>  echo "Errors while writing 128 kB"
>  echo



> diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
> index 9254ede5e5..2161a4b87a 100755
> --- a/tests/qemu-iotests/029
> +++ b/tests/qemu-iotests/029
> @@ -42,8 +42,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  _unsupported_proto vxhs
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
ACK
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
>  
>  offset_size=24
>  offset_l1_size=36



> diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
> index c44fcf91bb..646ecd593f 100755
> --- a/tests/qemu-iotests/031
> +++ b/tests/qemu-iotests/031
> @@ -40,9 +40,9 @@ 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]\|$\)\)'
> +# We want to test compat=0.10, which does not support external data
> +# files or refcount widths other than 16
> +_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'

This is maybe another reason to split this test for compat=0.10 and for compat=1.1
But still can be done later of course.

>  
>  CLUSTER_SIZE=65536
>  



> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> index bbaf0ef45b..512598421c 100755
> --- a/tests/qemu-iotests/036
> +++ b/tests/qemu-iotests/036
> @@ -43,8 +43,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qcow2-specific low-level functionality
>  _supported_fmt qcow2
>  _supported_proto file
> -# Only qcow2v3 and later supports feature bits
> -_unsupported_imgopts 'compat=0.10'
> +# Only qcow2v3 and later supports feature bits;
> +# qcow2.py does not support external data files

Minor nitpick, maybe tag this with TODO or so. No need to do now.

> +_unsupported_imgopts 'compat=0.10' data_file
>  
>  echo
>  echo === Image with unknown incompatible feature bit ===



> diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
> index 99563bf126..ddce48ab47 100755
> --- a/tests/qemu-iotests/039
> +++ b/tests/qemu-iotests/039
> @@ -44,6 +44,9 @@ _supported_proto file
>  _supported_os Linux
>  _default_cache_mode writethrough
>  _supported_cache_modes writethrough
> +# Some of these test cases expect no external data file so that all
> +# clusters are part of the qcow2 image and refcounted
> +_unsupported_imgopts data_file
ACK
>  
>  size=128M
>  


> diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
> index 4e03ead7b1..a066eec605 100755
> --- a/tests/qemu-iotests/046
> +++ b/tests/qemu-iotests/046
> @@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file
> +# data_file does not support compressed clusters
> +_unsupported_imgopts data_file
This is a very nice test, which doesn't seem to  use compressed
clusters that much. I think it should be split as well.
No need to do this now of course, but maybe mark with TODO to 
avoid loosing that info.

>  
>  CLUSTER_SIZE=64k
>  size=128M



> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
> index a8feb76184..2af6b74b41 100755
> --- a/tests/qemu-iotests/048
> +++ b/tests/qemu-iotests/048
> @@ -49,6 +49,8 @@ _compare()
>  _supported_fmt raw qcow2 qed luks
>  _supported_proto file
>  _supported_os Linux
> +# Using 'cp' is incompatible with external data files
> +_unsupported_imgopts data_file
You could compare the external files instead in theory *I think*.
Another item on some TODO list I guess.

>  
>  # Remove once all tests are fixed to use TEST_IMG_FILE
>  # correctly and common.rc sets it unconditionally



> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
> index 9cd1d60d45..0053bad46a 100755
> --- a/tests/qemu-iotests/051
> +++ b/tests/qemu-iotests/051
> @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  # A compat=0.10 image is created in this test which does not support anything
> -# other than refcount_bits=16
Here also the compat=0.10 image is only a small part of the test,
although it seems to get used later in the rest of the test,

so the test I think should be split so that rest of the test could run in all
configurations. 


> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +# other than refcount_bits=16;
> +# it also will not support an external data file
> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
>  
>  do_run_qemu()
>  {



> diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
> index ed01115fa3..d5304bb404 100755
> --- a/tests/qemu-iotests/058
> +++ b/tests/qemu-iotests/058
> @@ -56,8 +56,9 @@ _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
>  _require_command QEMU_NBD
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
ACK
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
>  
>  nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
>  




> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> index 92243c2edd..8ad0d7a904 100755
> --- a/tests/qemu-iotests/060
> +++ b/tests/qemu-iotests/060
> @@ -48,8 +48,10 @@ _filter_io_error()
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# These tests only work for compat=1.1 images with refcount_bits=16
> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +# These tests only work for compat=1.1 images without an external
> +# data file with refcount_bits=16
Yea, with all hardcoded offsets, that isn't going to work.
ACK.
> +_unsupported_imgopts 'compat=0.10' data_file \
> +    'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>  
>  rt_offset=65536  # 0x10000 (XXX: just an assumption)
>  rb_offset=131072 # 0x20000 (XXX: just an assumption)



> diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
> index b4076d8e8b..4e218798d8 100755
> --- a/tests/qemu-iotests/061
> +++ b/tests/qemu-iotests/061
> @@ -42,8 +42,10 @@ _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
>  # Conversion between different compat versions can only really work
> -# with refcount_bits=16
> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +# with refcount_bits=16;
> +# we have explicit tests for data_file here, but the whole test does
> +# not work with it
> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
>  
>  echo
>  echo "=== Testing version downgrade with zero expansion ==="



> diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
> index ac0d2a9a3b..68e52a6402 100755
> --- a/tests/qemu-iotests/062
> +++ b/tests/qemu-iotests/062
> @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  # We need zero clusters and snapshots
> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
>  
>  IMG_SIZE=64M
>  
Maybe split that test as well in the long run.
ACK.


> diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
> index 00eb80d89e..0fff3e3a52 100755
> --- a/tests/qemu-iotests/066
> +++ b/tests/qemu-iotests/066
> @@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  # We need zero clusters and snapshots
> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
Yet again, one small test case forcing the whole test to be skipped.
This should be split as well eventually.
>  
>  # Intentionally create an unaligned image
>  IMG_SIZE=$((64 * 1024 * 1024 + 512))



> diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
> index 926c79b37c..3bc6e719eb 100755
> --- a/tests/qemu-iotests/067
> +++ b/tests/qemu-iotests/067
> @@ -32,8 +32,10 @@ status=1	# failure is the default!
>  
>  _supported_fmt qcow2
>  _supported_proto file
> -# Because anything other than 16 would change the output of query-block
> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +# Because anything other than 16 would change the output of query-block,
> +# and external data files would change the output of
> +# query-named-block-ndoes
> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
OK. There probably is a way to filter that, but I don't know if this is worth it.
>  
>  do_run_qemu()
>  {



> diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
> index 65650fca9a..c8748f5b02 100755
> --- a/tests/qemu-iotests/068
> +++ b/tests/qemu-iotests/068
> @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  # This tests qocw2-specific low-level functionality
>  _supported_fmt qcow2
>  _supported_proto generic
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
ACK
>  
>  IMG_SIZE=128K
>  



> diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
> index 4e31943244..88faebcc1d 100755
> --- a/tests/qemu-iotests/071
> +++ b/tests/qemu-iotests/071
> @@ -39,6 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _require_drivers blkdebug blkverify
> +# blkdebug can only inject errors on bs->file, not on the data_file,
> +# so thie test does not work with external data files
s/thie/this
ACK. I guess that it would be too much trouble to extend it to 
inject errors on the data file as well.

> +_unsupported_imgopts data_file
>  
>  do_run_qemu()
>  {



> diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
> index e684b1b780..903dc9c9ab 100755
> --- a/tests/qemu-iotests/073
> +++ b/tests/qemu-iotests/073
> @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  _unsupported_proto vxhs
> +# External data files do not support compressed clusters
> +_unsupported_imgopts data_file
This test should be split as well eventually.

>  
>  CLUSTER_SIZE=64k
>  size=128M



> diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
> index 62be89a0d9..db03edf0b0 100755
> --- a/tests/qemu-iotests/074
> +++ b/tests/qemu-iotests/074
> @@ -50,6 +50,8 @@ _compare()
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# blkdebug can only inject errors on bs->file
> +_unsupported_imgopts data_file
ACK, as above.
>  
>  # Setup test basic parameters
>  TEST_IMG2=$TEST_IMG.2



> diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
> index b1ecafb41e..a3d13c414e 100755
> --- a/tests/qemu-iotests/080
> +++ b/tests/qemu-iotests/080
> @@ -40,9 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# - Internal snapshots are (currently) impossible with refcount_bits=1
> +# - Internal snapshots are (currently) impossible with refcount_bits=1,
> +#   and generally impossible with external data files
>  # - This is generally a test for compat=1.1 images
> -_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10'
I would more say that the test is too hardcoded for more that exact
settings it expects. It is all right in this case IMHO.
ACK.

>  
>  header_size=104
>  



> diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090
> index 9f8cfbb80f..1246e4f910 100755
> --- a/tests/qemu-iotests/090
> +++ b/tests/qemu-iotests/090
> @@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file nfs
> +# External data files do not support compressed clusters
> +_unsupported_imgopts data_file
ACK
>  
>  IMG_SIZE=128K
>  



> diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
> index 700068b328..1e29d96b3d 100755
> --- a/tests/qemu-iotests/098
> +++ b/tests/qemu-iotests/098
> @@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file
> -# The code path we want to test here only works for compat=1.1 images
> -_unsupported_imgopts 'compat=0.10'
> +# The code path we want to test here only works for compat=1.1 images;
> +# blkdebug can only inject errors on bs->file, so external data files
> +# do not work with this test
> +_unsupported_imgopts 'compat=0.10' data_file
ACK, but this is already 3rd test we loose. Maybe add to a TODO to extend blkdebug
to access data file as well.
>  
>  for event in l1_update empty_image_prepare reftable_update refblock_alloc; do
>  




> diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
> index b383c11e6a..65e8e92572 100755
> --- a/tests/qemu-iotests/099
> +++ b/tests/qemu-iotests/099
> @@ -46,8 +46,9 @@ _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
>  _supported_proto file
>  _supported_os Linux
>  _require_drivers blkdebug blkverify
> +# data_file would change the json:{} filenames
True but maybe still worth it to support the case?

>  _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
> -    "subformat=twoGbMaxExtentSparse"
> +    "subformat=twoGbMaxExtentSparse" data_file
>  
>  do_run_qemu()
>  {



> diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
> index 554b9de054..8c1ebe0443 100755
> --- a/tests/qemu-iotests/103
> +++ b/tests/qemu-iotests/103
> @@ -38,8 +38,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file nfs
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
ACK.
The test also only needs the snapshot in a part of it, so maybe split as well
later.
>  
>  IMG_SIZE=64K
>  




> diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
> index b0a6ae597b..6bbeb4f996 100755
> --- a/tests/qemu-iotests/108
> +++ b/tests/qemu-iotests/108
> @@ -41,8 +41,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# This test directly modifies a refblock so it relies on refcount_bits being 16
> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> +# This test directly modifies a refblock so it relies on refcount_bits being 16;
> +# and the low-level modification it performs are not tuned for external data
> +# files
ACK
> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
>  
>  echo
>  echo '=== Repairing an image without any refcount table ==='



> diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
> index 6850225939..20ff5c224a 100755
> --- a/tests/qemu-iotests/112
> +++ b/tests/qemu-iotests/112
> @@ -40,8 +40,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  # This test will set refcount_bits on its own which would conflict with the
> -# manual setting; compat will be overridden as well
> -_unsupported_imgopts refcount_bits 'compat=0.10'
> +# manual setting; compat will be overridden as well;
> +# and external data files do not work well with our refcount testing
ACK.
> +_unsupported_imgopts refcount_bits 'compat=0.10' data_file
>  
>  print_refcount_bits()
>  {



> diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
> index f90a744fc0..26104fff6c 100755
> --- a/tests/qemu-iotests/114
> +++ b/tests/qemu-iotests/114
> @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto generic
>  _unsupported_proto vxhs
> +# qcow2.py does not work too well with external data files
ACK, but should be fixed later.
> +_unsupported_imgopts data_file
>  
>  
>  TEST_IMG="$TEST_IMG.base" _make_test_img 64M



> diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
> index 10db813d94..90ea0db737 100755
> --- a/tests/qemu-iotests/121
> +++ b/tests/qemu-iotests/121
> @@ -39,6 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# Refcount structures are used much differently with external data
> +# files
ACK.
> +_unsupported_imgopts data_file
>  
>  echo
>  echo '=== New refcount structures may not conflict with existing structures ==='



> diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
> index 66ae9d5e78..7b0bc62a74 100755
> --- a/tests/qemu-iotests/138
> +++ b/tests/qemu-iotests/138
> @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# These refcount calculations do not work with external data files
> +_unsupported_imgopts data_file
Thats why I don't like the hardcoded tests that much.
ACK.

>  
>  echo
>  echo '=== Check on an image with a multiple of 2^32 clusters ==='



> diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
> index 3f27db71f2..5559df63a5 100755
> --- a/tests/qemu-iotests/156
> +++ b/tests/qemu-iotests/156
> @@ -51,6 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2 qed
>  _supported_proto generic
>  _unsupported_proto vxhs
> +# Copying files around with cp does not work with external data files
> +_unsupported_imgopts data_file
Another place to fix later I guess.
ACK.

>  
>  # Create source disk
>  TEST_IMG="$TEST_IMG.backing" _make_test_img 1M




> diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
> index 50df4c00fa..117c8b6954 100755
> --- a/tests/qemu-iotests/176
> +++ b/tests/qemu-iotests/176
> @@ -47,8 +47,11 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# Persistent dirty bitmaps require compat=1.1
> -_unsupported_imgopts 'compat=0.10'
> +# Persistent dirty bitmaps require compat=1.1;
> +# Internal snapshots forbid using an external data file
> +# (they work with refcount_bits=1 here, though, because there actually
> +# is no data when creating the snapshot)
ACK
> +_unsupported_imgopts 'compat=0.10' data_file
>  
>  run_qemu()
>  {



> diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
> index 23ab0ce899..b05db68141 100755
> --- a/tests/qemu-iotests/191
> +++ b/tests/qemu-iotests/191
> @@ -43,6 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _supported_fmt qcow2
>  _supported_proto file
> +# An external data file would change the query-named-block-nodes output
> +_unsupported_imgopts data_file
ACK.
>  
>  size=64M
>  



> diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201
> index 7abf740fe4..3a458f18a0 100755
> --- a/tests/qemu-iotests/201
> +++ b/tests/qemu-iotests/201
> @@ -43,9 +43,9 @@ _supported_fmt qcow2
>  _supported_proto generic
>  _supported_os Linux
>  
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -# This was taken from test 080
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
ACK
>  
>  size=64M
>  _make_test_img $size



> diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
> index 21ec8a2ad8..0f2e61280a 100755
> --- a/tests/qemu-iotests/214
> +++ b/tests/qemu-iotests/214
> @@ -39,7 +39,8 @@ _supported_proto file
>  
>  # Repairing the corrupted image requires qemu-img check to store a
>  # refcount up to 3, which requires at least two refcount bits.
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# External data files do not support compressed clusters.
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
ACK
>  
>  
>  echo



> diff --git a/tests/qemu-iotests/217 b/tests/qemu-iotests/217
> index 58a78a6098..d89116ccad 100755
> --- a/tests/qemu-iotests/217
> +++ b/tests/qemu-iotests/217
> @@ -40,7 +40,8 @@ _supported_proto file
>  
>  # This test needs clusters with at least a refcount of 2 so that
>  # OFLAG_COPIED is not set.  refcount_bits=1 is therefore unsupported.
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# (As are external data files.)
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
>  
>  echo
>  echo '=== Simulating an I/O error during snapshot deletion ==='
ACK


> diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
> index 3769f372cb..a88c59152b 100755
> --- a/tests/qemu-iotests/220
> +++ b/tests/qemu-iotests/220
> @@ -37,8 +37,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# To use a different refcount width but 16 bits we need compat=1.1
> -_unsupported_imgopts 'compat=0.10'
> +# To use a different refcount width but 16 bits we need compat=1.1,
> +# and external data files do not support compressed clusters.
> +_unsupported_imgopts 'compat=0.10' data_file
>  
>  echo "== Creating huge file =="
>  
ACK.


> diff --git a/tests/qemu-iotests/243 b/tests/qemu-iotests/243
> index 3dc3b6a711..a61852f6d9 100755
> --- a/tests/qemu-iotests/243
> +++ b/tests/qemu-iotests/243
> @@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# External data files do not work with compat=0.10
> -_unsupported_imgopts 'compat=0.10'
> +# External data files do not work with compat=0.10, and because there
> +# is an explicit case for external data files here, we cannot allow
> +# the user to specify whether to use one
> +_unsupported_imgopts 'compat=0.10' data_file
>  
>  for mode in off metadata falloc full; do
>  



> diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
> index 13263292b0..0d1efee6ef 100755
> --- a/tests/qemu-iotests/244
> +++ b/tests/qemu-iotests/244
> @@ -41,8 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> -# External data files do not work with compat=0.10
> -_unsupported_imgopts 'compat=0.10'
> +# External data files do not work with compat=0.10, and because we use
> +# our own external data file, we cannot let the user specify one
> +_unsupported_imgopts 'compat=0.10' data_file
>  
>  echo
>  echo "=== Create and open image with external data file ==="



> diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250
> index 670cf19076..9bb6b94d74 100755
> --- a/tests/qemu-iotests/250
> +++ b/tests/qemu-iotests/250
> @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
> +# This test does not make much sense with external data files
> +_unsupported_imgopts data_file
>  
>  # This test checks that qcow2_process_discards does not truncate a discard
>  # request > 2G.



> diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267
> index eda45449d4..d2f0e5df59 100755
> --- a/tests/qemu-iotests/267
> +++ b/tests/qemu-iotests/267
> @@ -41,8 +41,9 @@ _supported_fmt qcow2
>  _supported_proto file
>  _supported_os Linux
>  
> -# Internal snapshots are (currently) impossible with refcount_bits=1
> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> +# Internal snapshots are (currently) impossible with refcount_bits=1,
> +# and generally impossible with external data files
> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
>  
>  do_run_qemu()
>  {


Overall I think that this patch reveals that we tend to have tests that have too many subtests
which force us to restrict the test to only the common configuration denominator of the
subtests, so it would be a good idea to go over these tests,
especially these that are blacklisted by this patch and try to split them.

Also there are too many tests that hardcode location of various metadata structures in the qcow2 file,
which make both the debug and addition of new features harder that it should be.
These tests should instead be able to query the qcow2 file for the actual metadata location
and cope with that. Having said that, its easier to say that than to do that, especially for tests
that try to do various corruptions, unusual metadata object sizes, etc. So I just want to note this.

Also there are various things like qcow2.py not working with external files that should be eventually
be fixed.

Overall I think that this patch is 100% good enough for now, so thanks a lot, and

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 21/21] iotests: Allow check -o data_file
  2019-10-15 14:27 ` [PATCH v2 21/21] iotests: Allow check -o data_file Max Reitz
@ 2019-11-06 15:52   ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:52 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> The problem with allowing the data_file option is that you want to use a
> different data file per image used in the test.  Therefore, we need to
> allow patterns like -o data_file='$TEST_IMG.data_file'.
> 
> Then, we need to filter it out from qemu-img map, qemu-img create, and
> remove the data file in _rm_test_img.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/common.filter | 23 +++++++++++++++++++++--
>  tests/qemu-iotests/common.rc     | 22 +++++++++++++++++++++-
>  2 files changed, 42 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
> index 63bc6f6f26..9dd05689d1 100644
> --- a/tests/qemu-iotests/common.filter
> +++ b/tests/qemu-iotests/common.filter
> @@ -121,7 +121,13 @@ _filter_actual_image_size()
>  # replace driver-specific options in the "Formatting..." line
>  _filter_img_create()
>  {
> -    $SED -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
> +    data_file_filter=()
> +    if data_file=$(_get_data_file "$TEST_IMG"); then
> +        data_file_filter=(-e "s# data_file=$data_file##")
> +    fi
> +
> +    $SED "${data_file_filter[@]}" \
> +        -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
>          -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
>          -e "s#$TEST_DIR#TEST_DIR#g" \
>          -e "s#$IMGFMT#IMGFMT#g" \
> @@ -204,9 +210,22 @@ _filter_img_info()
>  # human and json output
>  _filter_qemu_img_map()
>  {
> +    # Assuming the data_file value in $IMGOPTS contains a '$TEST_IMG',
> +    # create a filter that replaces the data file name by $TEST_IMG.
> +    # Example:
> +    #   In $IMGOPTS: 'data_file=$TEST_IMG.data_file'
> +    #   Then data_file_pattern == '\(.*\).data_file'
> +    #   And  data_file_filter  == -e 's#\(.*\).data_file#\1#
> +    data_file_filter=()
> +    if data_file_pattern=$(_get_data_file '\\(.*\\)'); then
> +        data_file_filter=(-e "s#$data_file_pattern#\\1#")
> +    fi
> +
>      $SED -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
>          -e 's/"offset": [0-9]\+/"offset": OFFSET/g' \
> -        -e 's/Mapped to *//' | _filter_testdir | _filter_imgfmt
> +        -e 's/Mapped to *//' \
> +        "${data_file_filter[@]}" \
> +        | _filter_testdir | _filter_imgfmt
>  }
>  
>  _filter_nbd()
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index f3784077de..bed789a691 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -277,6 +277,20 @@ _stop_nbd_server()
>      fi
>  }
>  
> +# Gets the data_file value from IMGOPTS and replaces the '$TEST_IMG'
> +# pattern by '$1'
> +# Caution: The replacement is done with sed, so $1 must be escaped
> +#          properly.  (The delimiter is '#'.)
> +_get_data_file()
> +{
> +    if ! echo "$IMGOPTS" | grep -q 'data_file='; then
> +        return 1
> +    fi
> +
> +    echo "$IMGOPTS" | sed -e 's/.*data_file=\([^,]*\).*/\1/' \
> +                    | sed -e "s#\\\$TEST_IMG#$1#"
> +}
> +
>  _make_test_img()
>  {
>      # extra qemu-img options can be added by tests
> @@ -297,7 +311,8 @@ _make_test_img()
>      fi
>  
>      if [ -n "$IMGOPTS" ]; then
> -        optstr=$(_optstr_add "$optstr" "$IMGOPTS")
> +        imgopts_expanded=$(echo "$IMGOPTS" | sed -e "s#\\\$TEST_IMG#$img_name#")
> +        optstr=$(_optstr_add "$optstr" "$imgopts_expanded")
>      fi
>      if [ -n "$IMGKEYSECRET" ]; then
>          object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
> @@ -376,6 +391,11 @@ _rm_test_img()
>          # Remove all the extents for vmdk
>          "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
>              | xargs -I {} rm -f "{}"
> +    elif [ "$IMGFMT" = "qcow2" ]; then
> +        # Remove external data file
> +        if data_file=$(_get_data_file "$img"); then
> +            rm -f "$data_file"
> +        fi
>      fi
>      rm -f "$img"
>  }


Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/21] iotests: Allow ./check -o data_file
  2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
                   ` (21 preceding siblings ...)
  2019-10-16  0:19 ` [PATCH v2 00/21] iotests: Allow ./check " no-reply
@ 2019-11-06 15:52 ` Maxim Levitsky
  22 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-06 15:52 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Hi,
> 
> The cover letter from v1 (explaining the motivation behind this series
> and the general structure) is here:
> 
> https://lists.nongnu.org/archive/html/qemu-block/2019-09/msg01323.html
> 
> 
> For v2, I’ve tried to address Maxim’s comments:
> - Patch 1 through 3: New
> - Patch 4: Only print feature bits instead of blacklisting stuff that we
>            don’t need
> - Patch 5:
>   - Fix typo
>   - Add comment why 098 needs compat=1.1
> - Patch 16: Use _check_test_img
> - Patch 17: Use the new _filter_json_filename
> - Patch 18: Rethink the incompatible feature filter approach: Instead of
>             filtering out the data_file bit, just check whether the
>             dirty bit is present (because that is all we want to know)
> - Patch 19: Use the new _filter_json_filename
> - Patch 20: Rebase conflicts due to the changes to patch 5
> - Patch 21:
>   - Add and use _get_data_file
>   - Add a comment how the data_file_filter in _filter_qemu_img_map works
> 

Thank you! I reviewed the series, and it looks fine now.
Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 03/21] iotests: Add _filter_json_filename
  2019-11-06 15:44   ` Maxim Levitsky
@ 2019-11-07  8:59     ` Max Reitz
  2019-11-07 10:01       ` Maxim Levitsky
  0 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-11-07  8:59 UTC (permalink / raw)
  To: Maxim Levitsky, qemu-block; +Cc: Kevin Wolf, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 1095 bytes --]

On 06.11.19 16:44, Maxim Levitsky wrote:
> On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>  tests/qemu-iotests/common.filter | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
>> index 9f418b4881..63bc6f6f26 100644
>> --- a/tests/qemu-iotests/common.filter
>> +++ b/tests/qemu-iotests/common.filter
>> @@ -227,5 +227,29 @@ _filter_qmp_empty_return()
>>      grep -v '{"return": {}}'
>>  }
>>  
>> +_filter_json_filename()
>> +{
>> +    $PYTHON -c 'import sys
>> +result, *fnames = sys.stdin.read().split("json:{")
> 
> Very minor nitpick, maybe I would give 'fnames' a more generic name,
> since its is just result of a split, thus not really a list of filenames.
> Feel free to ignore that though.

Hm...  It is a list of filenames, namely of all nested json:{}
filenames.  I could call it fname_split, but I actually think fnames is
not too wrong.

In any case, thanks for reviewing again!

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts
  2019-11-06 15:45   ` Maxim Levitsky
@ 2019-11-07  9:08     ` Max Reitz
  2019-11-07  9:56       ` Maxim Levitsky
  0 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-11-07  9:08 UTC (permalink / raw)
  To: Maxim Levitsky, qemu-block; +Cc: Kevin Wolf, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 2855 bytes --]

On 06.11.19 16:45, Maxim Levitsky wrote:
> On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
>> Some tests require compat=1.1 and thus set IMGOPTS='compat=1.1'
>> globally.  That is not how it should be done; instead, they should
>> simply set _unsupported_imgopts to compat=0.10 (compat=1.1 is the
>> default anyway).
>>
>> This makes the tests heed user-specified $IMGOPTS.  Some do not work
>> with all image options, though, so we need to disable them accordingly.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>  tests/qemu-iotests/036 | 3 +--
>>  tests/qemu-iotests/060 | 4 ++--
>>  tests/qemu-iotests/062 | 3 ++-
>>  tests/qemu-iotests/066 | 3 ++-
>>  tests/qemu-iotests/068 | 3 ++-
>>  tests/qemu-iotests/098 | 4 ++--
>>  6 files changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
>> index 5f929ad3be..bbaf0ef45b 100755
>> --- a/tests/qemu-iotests/036
>> +++ b/tests/qemu-iotests/036
>> @@ -43,9 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  # This tests qcow2-specific low-level functionality
>>  _supported_fmt qcow2
>>  _supported_proto file
>> -
>>  # Only qcow2v3 and later supports feature bits
>> -IMGOPTS="compat=1.1"
>> +_unsupported_imgopts 'compat=0.10'
>>  
>>  echo
>>  echo === Image with unknown incompatible feature bit ===
>> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
>> index b91d8321bb..9c2ef42522 100755
>> --- a/tests/qemu-iotests/060
>> +++ b/tests/qemu-iotests/060
>> @@ -48,6 +48,8 @@ _filter_io_error()
>>  _supported_fmt qcow2
>>  _supported_proto file
>>  _supported_os Linux
>> +# These tests only work for compat=1.1 images with refcount_bits=16
>> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> Looks like the reason for that is that the test hardcodes (or guesses that is) various qcow2 structures
> thing I have seen few times already in the iotests.
> Not now but sometime in the future it would be nice to extend qcow2.py (or something
> like that) to dump location of all qcow2 structures so that the guesswork could be eliminated.

With the peek_file* functions we have now it’s actually simple to dump
that location ($(peek_file_be "$TEST_IMG" 48 8) for the refcount table
offset, for example).

But it wouldn’t help, because compat=0.10 or refcount_bits != 16 won’t
change those locations.  So the locations aren’t the reason why we need
to forbid those options here.

The reason we need refcount_bits=16 is that we’re going to directly
manipulate a refcount block.  To do so, we need to know the refcount
width, and I don’t think it’s worth trying to implement something generic.

We need compat=1.1 because compat=0.10 doesn’t have feature bits, so
there’s no “corrupt” bit there.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
  2019-11-06 15:47   ` Maxim Levitsky
@ 2019-11-07  9:20     ` Max Reitz
  2019-11-07  9:52       ` Maxim Levitsky
  0 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-11-07  9:20 UTC (permalink / raw)
  To: Maxim Levitsky, qemu-block; +Cc: Kevin Wolf, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 3293 bytes --]

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 <mreitz@redhat.com>
>> ---
>>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o
  2019-11-07  9:20     ` Max Reitz
@ 2019-11-07  9:52       ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-07  9:52 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

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 <mreitz@redhat.com>
> > > ---
> > >  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





^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts
  2019-11-07  9:08     ` Max Reitz
@ 2019-11-07  9:56       ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-07  9:56 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Thu, 2019-11-07 at 10:08 +0100, Max Reitz wrote:
> On 06.11.19 16:45, Maxim Levitsky wrote:
> > On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> > > Some tests require compat=1.1 and thus set IMGOPTS='compat=1.1'
> > > globally.  That is not how it should be done; instead, they should
> > > simply set _unsupported_imgopts to compat=0.10 (compat=1.1 is the
> > > default anyway).
> > > 
> > > This makes the tests heed user-specified $IMGOPTS.  Some do not work
> > > with all image options, though, so we need to disable them accordingly.
> > > 
> > > Signed-off-by: Max Reitz <mreitz@redhat.com>
> > > ---
> > >  tests/qemu-iotests/036 | 3 +--
> > >  tests/qemu-iotests/060 | 4 ++--
> > >  tests/qemu-iotests/062 | 3 ++-
> > >  tests/qemu-iotests/066 | 3 ++-
> > >  tests/qemu-iotests/068 | 3 ++-
> > >  tests/qemu-iotests/098 | 4 ++--
> > >  6 files changed, 11 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> > > index 5f929ad3be..bbaf0ef45b 100755
> > > --- a/tests/qemu-iotests/036
> > > +++ b/tests/qemu-iotests/036
> > > @@ -43,9 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  # This tests qcow2-specific low-level functionality
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > > -
> > >  # Only qcow2v3 and later supports feature bits
> > > -IMGOPTS="compat=1.1"
> > > +_unsupported_imgopts 'compat=0.10'
> > >  
> > >  echo
> > >  echo === Image with unknown incompatible feature bit ===
> > > diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> > > index b91d8321bb..9c2ef42522 100755
> > > --- a/tests/qemu-iotests/060
> > > +++ b/tests/qemu-iotests/060
> > > @@ -48,6 +48,8 @@ _filter_io_error()
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > >  _supported_os Linux
> > > +# These tests only work for compat=1.1 images with refcount_bits=16
> > > +_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> > 
> > Looks like the reason for that is that the test hardcodes (or guesses that is) various qcow2 structures
> > thing I have seen few times already in the iotests.
> > Not now but sometime in the future it would be nice to extend qcow2.py (or something
> > like that) to dump location of all qcow2 structures so that the guesswork could be eliminated.
> 
> With the peek_file* functions we have now it’s actually simple to dump
> that location ($(peek_file_be "$TEST_IMG" 48 8) for the refcount table
> offset, for example).
> 
> But it wouldn’t help, because compat=0.10 or refcount_bits != 16 won’t
> change those locations.  So the locations aren’t the reason why we need
> to forbid those options here.
> 
> The reason we need refcount_bits=16 is that we’re going to directly
> manipulate a refcount block.  To do so, we need to know the refcount
> width, and I don’t think it’s worth trying to implement something generic.
> 
> We need compat=1.1 because compat=0.10 doesn’t have feature bits, so
> there’s no “corrupt” bit there.
> 
> Max
> 
This makes sense! Sorry for the noise!

Best regards,
	Maxim Levitsky





^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 03/21] iotests: Add _filter_json_filename
  2019-11-07  8:59     ` Max Reitz
@ 2019-11-07 10:01       ` Maxim Levitsky
  0 siblings, 0 replies; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-07 10:01 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Thu, 2019-11-07 at 09:59 +0100, Max Reitz wrote:
> On 06.11.19 16:44, Maxim Levitsky wrote:
> > On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> > > Signed-off-by: Max Reitz <mreitz@redhat.com>
> > > ---
> > >  tests/qemu-iotests/common.filter | 24 ++++++++++++++++++++++++
> > >  1 file changed, 24 insertions(+)
> > > 
> > > diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
> > > index 9f418b4881..63bc6f6f26 100644
> > > --- a/tests/qemu-iotests/common.filter
> > > +++ b/tests/qemu-iotests/common.filter
> > > @@ -227,5 +227,29 @@ _filter_qmp_empty_return()
> > >      grep -v '{"return": {}}'
> > >  }
> > >  
> > > +_filter_json_filename()
> > > +{
> > > +    $PYTHON -c 'import sys
> > > +result, *fnames = sys.stdin.read().split("json:{")
> > 
> > Very minor nitpick, maybe I would give 'fnames' a more generic name,
> > since its is just result of a split, thus not really a list of filenames.
> > Feel free to ignore that though.
> 
> Hm...  It is a list of filenames, namely of all nested json:{}
> filenames.  I could call it fname_split, but I actually think fnames is
> not too wrong.

Makes sense, I guess leave it as is.

> 
> In any case, thanks for reviewing again!

No problem! Thanks to you too for making these tests more generic,
this is IMHO very very good thing, especially with all the qcow2
corruptions we see recently.


Best regards,
	Maxim Levitsky


> 
> Max
> 




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 20/21] iotests: Disable data_file where it cannot be used
  2019-11-06 15:52   ` Maxim Levitsky
@ 2019-11-07 11:36     ` Max Reitz
  2019-11-07 15:19       ` Maxim Levitsky
  0 siblings, 1 reply; 48+ messages in thread
From: Max Reitz @ 2019-11-07 11:36 UTC (permalink / raw)
  To: Maxim Levitsky, qemu-block; +Cc: Kevin Wolf, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 14819 bytes --]

On 06.11.19 16:52, Maxim Levitsky wrote:
> On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>  tests/qemu-iotests/007 | 5 +++--
>>  tests/qemu-iotests/014 | 2 ++
>>  tests/qemu-iotests/015 | 5 +++--
>>  tests/qemu-iotests/026 | 5 ++++-
>>  tests/qemu-iotests/029 | 5 +++--
>>  tests/qemu-iotests/031 | 6 +++---
>>  tests/qemu-iotests/036 | 5 +++--
>>  tests/qemu-iotests/039 | 3 +++
>>  tests/qemu-iotests/046 | 2 ++
>>  tests/qemu-iotests/048 | 2 ++
>>  tests/qemu-iotests/051 | 5 +++--
>>  tests/qemu-iotests/058 | 5 +++--
>>  tests/qemu-iotests/060 | 6 ++++--
>>  tests/qemu-iotests/061 | 6 ++++--
>>  tests/qemu-iotests/062 | 2 +-
>>  tests/qemu-iotests/066 | 2 +-
>>  tests/qemu-iotests/067 | 6 ++++--
>>  tests/qemu-iotests/068 | 5 +++--
>>  tests/qemu-iotests/071 | 3 +++
>>  tests/qemu-iotests/073 | 2 ++
>>  tests/qemu-iotests/074 | 2 ++
>>  tests/qemu-iotests/080 | 5 +++--
>>  tests/qemu-iotests/090 | 2 ++
>>  tests/qemu-iotests/098 | 6 ++++--
>>  tests/qemu-iotests/099 | 3 ++-
>>  tests/qemu-iotests/103 | 5 +++--
>>  tests/qemu-iotests/108 | 6 ++++--
>>  tests/qemu-iotests/112 | 5 +++--
>>  tests/qemu-iotests/114 | 2 ++
>>  tests/qemu-iotests/121 | 3 +++
>>  tests/qemu-iotests/138 | 2 ++
>>  tests/qemu-iotests/156 | 2 ++
>>  tests/qemu-iotests/176 | 7 +++++--
>>  tests/qemu-iotests/191 | 2 ++
>>  tests/qemu-iotests/201 | 6 +++---
>>  tests/qemu-iotests/214 | 3 ++-
>>  tests/qemu-iotests/217 | 3 ++-
>>  tests/qemu-iotests/220 | 5 +++--
>>  tests/qemu-iotests/243 | 6 ++++--
>>  tests/qemu-iotests/244 | 5 +++--
>>  tests/qemu-iotests/250 | 2 ++
>>  tests/qemu-iotests/267 | 5 +++--
>>  42 files changed, 117 insertions(+), 52 deletions(-)

[...]

>> diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
>> index c44fcf91bb..646ecd593f 100755
>> --- a/tests/qemu-iotests/031
>> +++ b/tests/qemu-iotests/031
>> @@ -40,9 +40,9 @@ 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]\|$\)\)'
>> +# We want to test compat=0.10, which does not support external data
>> +# files or refcount widths other than 16
>> +_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> 
> This is maybe another reason to split this test for compat=0.10 and for compat=1.1
> But still can be done later of course.

Hm, but I don’t really think this test is important for external data
files.  There is no I/O.

[...]

>> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
>> index bbaf0ef45b..512598421c 100755
>> --- a/tests/qemu-iotests/036
>> +++ b/tests/qemu-iotests/036
>> @@ -43,8 +43,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  # This tests qcow2-specific low-level functionality
>>  _supported_fmt qcow2
>>  _supported_proto file
>> -# Only qcow2v3 and later supports feature bits
>> -_unsupported_imgopts 'compat=0.10'
>> +# Only qcow2v3 and later supports feature bits;
>> +# qcow2.py does not support external data files
> 
> Minor nitpick, maybe tag this with TODO or so. No need to do now.

Hm, well, and the same applies here.  (Just not a very important test.)

[...]

>> diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
>> index 4e03ead7b1..a066eec605 100755
>> --- a/tests/qemu-iotests/046
>> +++ b/tests/qemu-iotests/046
>> @@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  
>>  _supported_fmt qcow2
>>  _supported_proto file
>> +# data_file does not support compressed clusters
>> +_unsupported_imgopts data_file
> This is a very nice test, which doesn't seem to  use compressed
> clusters that much. I think it should be split as well.
> No need to do this now of course, but maybe mark with TODO to 
> avoid loosing that info.

The other problem is that blkdebug doesn’t work so well with external
data files, so basically this whole test doesn’t work.

[...]

>> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
>> index a8feb76184..2af6b74b41 100755
>> --- a/tests/qemu-iotests/048
>> +++ b/tests/qemu-iotests/048
>> @@ -49,6 +49,8 @@ _compare()
>>  _supported_fmt raw qcow2 qed luks
>>  _supported_proto file
>>  _supported_os Linux
>> +# Using 'cp' is incompatible with external data files
>> +_unsupported_imgopts data_file
> You could compare the external files instead in theory *I think*.
> Another item on some TODO list I guess.

This is a test of qemu-img compare, not of the image format.  So it
doesn’t make much sense to me to compare the external files, and also it
should be completely sufficient to run this test only without external
data files.

[...]

>> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
>> index 9cd1d60d45..0053bad46a 100755
>> --- a/tests/qemu-iotests/051
>> +++ b/tests/qemu-iotests/051
>> @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto file
>>  # A compat=0.10 image is created in this test which does not support anything
>> -# other than refcount_bits=16
> Here also the compat=0.10 image is only a small part of the test,
> although it seems to get used later in the rest of the test,
> 
> so the test I think should be split so that rest of the test could run in all
> configurations. 

This too isn’t an image format test (specifically, there’s no I/O but
for the snapshotting test, which mostly uses a different image anyway),
so I don’t think it’s necessary to allow this test for data_file.

[...]

>> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
>> index 92243c2edd..8ad0d7a904 100755
>> --- a/tests/qemu-iotests/060
>> +++ b/tests/qemu-iotests/060
>> @@ -48,8 +48,10 @@ _filter_io_error()
>>  _supported_fmt qcow2
>>  _supported_proto file
>>  _supported_os Linux
>> -# These tests only work for compat=1.1 images with refcount_bits=16
>> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>> +# These tests only work for compat=1.1 images without an external
>> +# data file with refcount_bits=16
> Yea, with all hardcoded offsets, that isn't going to work.

This isn’t about hardcoded offsets, it’s about the fact that the test
references data cluster that are part of the qcow2 file (i.e., not in an
external file).

[...]

>> diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
>> index ac0d2a9a3b..68e52a6402 100755
>> --- a/tests/qemu-iotests/062
>> +++ b/tests/qemu-iotests/062
>> @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto generic
>>  # We need zero clusters and snapshots
>> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
>> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
>>  
>>  IMG_SIZE=64M
>>  
> Maybe split that test as well in the long run.

How would that be possible, though?  There is only a single test case here.

>> diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
>> index 00eb80d89e..0fff3e3a52 100755
>> --- a/tests/qemu-iotests/066
>> +++ b/tests/qemu-iotests/066
>> @@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto generic
>>  # We need zero clusters and snapshots
>> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
>> +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
> Yet again, one small test case forcing the whole test to be skipped.
> This should be split as well eventually.

This I agree with.

>> diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
>> index 926c79b37c..3bc6e719eb 100755
>> --- a/tests/qemu-iotests/067
>> +++ b/tests/qemu-iotests/067
>> @@ -32,8 +32,10 @@ status=1	# failure is the default!
>>  
>>  _supported_fmt qcow2
>>  _supported_proto file
>> -# Because anything other than 16 would change the output of query-block
>> -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>> +# Because anything other than 16 would change the output of query-block,
>> +# and external data files would change the output of
>> +# query-named-block-ndoes
>> +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
> OK. There probably is a way to filter that, but I don't know if this is worth it.

Not really, because this again isn’t really a test of the image format.

[...]

>> diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
>> index e684b1b780..903dc9c9ab 100755
>> --- a/tests/qemu-iotests/073
>> +++ b/tests/qemu-iotests/073
>> @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto generic
>>  _unsupported_proto vxhs
>> +# External data files do not support compressed clusters
>> +_unsupported_imgopts data_file
> This test should be split as well eventually.

Hm, yes.  I don’t know if it can be fully split.  I think what would
work is a trimmed down copy just for external data files, but, well...

[...]

>> diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
>> index b1ecafb41e..a3d13c414e 100755
>> --- a/tests/qemu-iotests/080
>> +++ b/tests/qemu-iotests/080
>> @@ -40,9 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto file
>>  _supported_os Linux
>> -# - Internal snapshots are (currently) impossible with refcount_bits=1
>> +# - Internal snapshots are (currently) impossible with refcount_bits=1,
>> +#   and generally impossible with external data files
>>  # - This is generally a test for compat=1.1 images
>> -_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
>> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10'
> I would more say that the test is too hardcoded for more that exact
> settings it expects. It is all right in this case IMHO.
> ACK.

I suppose we’d want a different test for data file validation, if
anything, but I don’t think there is anything to validate there...

[...]

>> diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
>> index 700068b328..1e29d96b3d 100755
>> --- a/tests/qemu-iotests/098
>> +++ b/tests/qemu-iotests/098
>> @@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  
>>  _supported_fmt qcow2
>>  _supported_proto file
>> -# The code path we want to test here only works for compat=1.1 images
>> -_unsupported_imgopts 'compat=0.10'
>> +# The code path we want to test here only works for compat=1.1 images;
>> +# blkdebug can only inject errors on bs->file, so external data files
>> +# do not work with this test
>> +_unsupported_imgopts 'compat=0.10' data_file
> ACK, but this is already 3rd test we loose. Maybe add to a TODO to extend blkdebug
> to access data file as well.

That won’t work, though.  The problem is that in the block graph,
blkdebug just exists between the format and the file node.  You’d need a
second instance above the external data file node, but then those
instances wouldn’t share data, and qcow2 only issues blkdebug events to
the file node.

One could make qcow2 duplicate all events to the data file, but then you
still wouldn’t share the same state in both instances.

In all, it would just be a mess.

>> diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
>> index b383c11e6a..65e8e92572 100755
>> --- a/tests/qemu-iotests/099
>> +++ b/tests/qemu-iotests/099
>> @@ -46,8 +46,9 @@ _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
>>  _supported_proto file
>>  _supported_os Linux
>>  _require_drivers blkdebug blkverify
>> +# data_file would change the json:{} filenames
> True but maybe still worth it to support the case?

I don’t think so, because this is specifically a test to check those
filenames.

[...]

>> diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
>> index 554b9de054..8c1ebe0443 100755
>> --- a/tests/qemu-iotests/103
>> +++ b/tests/qemu-iotests/103
>> @@ -38,8 +38,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  
>>  _supported_fmt qcow2
>>  _supported_proto file nfs
>> -# Internal snapshots are (currently) impossible with refcount_bits=1
>> -_unsupported_imgopts 'refcount_bits=1[^0-9]'
>> +# Internal snapshots are (currently) impossible with refcount_bits=1,
>> +# and generally impossible with external data files
>> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
> ACK.
> The test also only needs the snapshot in a part of it, so maybe split as well
> later.

But this test too is just an interface test, so I don’t quite see the need.

[...]

>> diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
>> index f90a744fc0..26104fff6c 100755
>> --- a/tests/qemu-iotests/114
>> +++ b/tests/qemu-iotests/114
>> @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto generic
>>  _unsupported_proto vxhs
>> +# qcow2.py does not work too well with external data files
> ACK, but should be fixed later.

Probably, but I don’t think this test would benefit much from it.
(Because it isn’t too important to be able to run this with an external
data file)

[...]

>> diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
>> index 66ae9d5e78..7b0bc62a74 100755
>> --- a/tests/qemu-iotests/138
>> +++ b/tests/qemu-iotests/138
>> @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2
>>  _supported_proto file
>>  _supported_os Linux
>> +# These refcount calculations do not work with external data files
>> +_unsupported_imgopts data_file
> Thats why I don't like the hardcoded tests that much.

Good point.  I was wondering what the problem was here because I was
sure it didn’t have anything to do with something hard-coded, and it
doesn’t.

The actual reason is simply that there is no refcounting for external
data files.  I’ll fix the comment.

>> diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
>> index 3f27db71f2..5559df63a5 100755
>> --- a/tests/qemu-iotests/156
>> +++ b/tests/qemu-iotests/156
>> @@ -51,6 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>  _supported_fmt qcow2 qed
>>  _supported_proto generic
>>  _unsupported_proto vxhs
>> +# Copying files around with cp does not work with external data files
>> +_unsupported_imgopts data_file
> Another place to fix later I guess.

I don’t know, this type of storage migration simply doesn’t work this
way with external data files.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 20/21] iotests: Disable data_file where it cannot be used
  2019-11-07 11:36     ` Max Reitz
@ 2019-11-07 15:19       ` Maxim Levitsky
  2019-11-07 16:55         ` Max Reitz
  0 siblings, 1 reply; 48+ messages in thread
From: Maxim Levitsky @ 2019-11-07 15:19 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On Thu, 2019-11-07 at 12:36 +0100, Max Reitz wrote:
> On 06.11.19 16:52, Maxim Levitsky wrote:
> > On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> > > Signed-off-by: Max Reitz <mreitz@redhat.com>
> > > ---
> > >  tests/qemu-iotests/007 | 5 +++--
> > >  tests/qemu-iotests/014 | 2 ++
> > >  tests/qemu-iotests/015 | 5 +++--
> > >  tests/qemu-iotests/026 | 5 ++++-
> > >  tests/qemu-iotests/029 | 5 +++--
> > >  tests/qemu-iotests/031 | 6 +++---
> > >  tests/qemu-iotests/036 | 5 +++--
> > >  tests/qemu-iotests/039 | 3 +++
> > >  tests/qemu-iotests/046 | 2 ++
> > >  tests/qemu-iotests/048 | 2 ++
> > >  tests/qemu-iotests/051 | 5 +++--
> > >  tests/qemu-iotests/058 | 5 +++--
> > >  tests/qemu-iotests/060 | 6 ++++--
> > >  tests/qemu-iotests/061 | 6 ++++--
> > >  tests/qemu-iotests/062 | 2 +-
> > >  tests/qemu-iotests/066 | 2 +-
> > >  tests/qemu-iotests/067 | 6 ++++--
> > >  tests/qemu-iotests/068 | 5 +++--
> > >  tests/qemu-iotests/071 | 3 +++
> > >  tests/qemu-iotests/073 | 2 ++
> > >  tests/qemu-iotests/074 | 2 ++
> > >  tests/qemu-iotests/080 | 5 +++--
> > >  tests/qemu-iotests/090 | 2 ++
> > >  tests/qemu-iotests/098 | 6 ++++--
> > >  tests/qemu-iotests/099 | 3 ++-
> > >  tests/qemu-iotests/103 | 5 +++--
> > >  tests/qemu-iotests/108 | 6 ++++--
> > >  tests/qemu-iotests/112 | 5 +++--
> > >  tests/qemu-iotests/114 | 2 ++
> > >  tests/qemu-iotests/121 | 3 +++
> > >  tests/qemu-iotests/138 | 2 ++
> > >  tests/qemu-iotests/156 | 2 ++
> > >  tests/qemu-iotests/176 | 7 +++++--
> > >  tests/qemu-iotests/191 | 2 ++
> > >  tests/qemu-iotests/201 | 6 +++---
> > >  tests/qemu-iotests/214 | 3 ++-
> > >  tests/qemu-iotests/217 | 3 ++-
> > >  tests/qemu-iotests/220 | 5 +++--
> > >  tests/qemu-iotests/243 | 6 ++++--
> > >  tests/qemu-iotests/244 | 5 +++--
> > >  tests/qemu-iotests/250 | 2 ++
> > >  tests/qemu-iotests/267 | 5 +++--
> > >  42 files changed, 117 insertions(+), 52 deletions(-)
> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
> > > index c44fcf91bb..646ecd593f 100755
> > > --- a/tests/qemu-iotests/031
> > > +++ b/tests/qemu-iotests/031
> > > @@ -40,9 +40,9 @@ 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]\|$\)\)'
> > > +# We want to test compat=0.10, which does not support external data
> > > +# files or refcount widths other than 16
> > > +_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> > 
> > This is maybe another reason to split this test for compat=0.10 and for compat=1.1
> > But still can be done later of course.
> 
> Hm, but I don’t really think this test is important for external data
> files.  There is no I/O.
I guess both yes and no, the external data file is a header extension as well.
I am looking at the tests from the point of view of someone that
doesn't know the qcow2 internally well yet, so I noted all the tests
that looked like they can still catch something.


> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> > > index bbaf0ef45b..512598421c 100755
> > > --- a/tests/qemu-iotests/036
> > > +++ b/tests/qemu-iotests/036
> > > @@ -43,8 +43,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  # This tests qcow2-specific low-level functionality
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > > -# Only qcow2v3 and later supports feature bits
> > > -_unsupported_imgopts 'compat=0.10'
> > > +# Only qcow2v3 and later supports feature bits;
> > > +# qcow2.py does not support external data files
> > 
> > Minor nitpick, maybe tag this with TODO or so. No need to do now.
> 
> Hm, well, and the same applies here.  (Just not a very important test.)
Same here, in theory external data file is a feature, and it could
'interact' with other features, but most likely you are right here as well.

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
> > > index 4e03ead7b1..a066eec605 100755
> > > --- a/tests/qemu-iotests/046
> > > +++ b/tests/qemu-iotests/046
> > > @@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > > +# data_file does not support compressed clusters
> > > +_unsupported_imgopts data_file
> > 
> > This is a very nice test, which doesn't seem to  use compressed
> > clusters that much. I think it should be split as well.
> > No need to do this now of course, but maybe mark with TODO to 
> > avoid loosing that info.
> 
> The other problem is that blkdebug doesn’t work so well with external
> data files, so basically this whole test doesn’t work.
Yes, I see now that the test uses the blkdebug.

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
> > > index a8feb76184..2af6b74b41 100755
> > > --- a/tests/qemu-iotests/048
> > > +++ b/tests/qemu-iotests/048
> > > @@ -49,6 +49,8 @@ _compare()
> > >  _supported_fmt raw qcow2 qed luks
> > >  _supported_proto file
> > >  _supported_os Linux
> > > +# Using 'cp' is incompatible with external data files
> > > +_unsupported_imgopts data_file
> > 
> > You could compare the external files instead in theory *I think*.
> > Another item on some TODO list I guess.
> 
> This is a test of qemu-img compare, not of the image format.  So it
> doesn’t make much sense to me to compare the external files, and also it
> should be completely sufficient to run this test only without external
> data files.
Yes but on the other hand, its is kind of nice to test that it can compare correctly
two qcow2 files which have external data files attached.


> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
> > > index 9cd1d60d45..0053bad46a 100755
> > > --- a/tests/qemu-iotests/051
> > > +++ b/tests/qemu-iotests/051
> > > @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > >  # A compat=0.10 image is created in this test which does not support anything
> > > -# other than refcount_bits=16
> > 
> > Here also the compat=0.10 image is only a small part of the test,
> > although it seems to get used later in the rest of the test,
> > 
> > so the test I think should be split so that rest of the test could run in all
> > configurations. 
> 
> This too isn’t an image format test (specifically, there’s no I/O but
> for the snapshotting test, which mostly uses a different image anyway),
> so I don’t think it’s necessary to allow this test for data_file.
Same here, I agree but still what if there is some interaction between backing
file and data file?

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> > > index 92243c2edd..8ad0d7a904 100755
> > > --- a/tests/qemu-iotests/060
> > > +++ b/tests/qemu-iotests/060
> > > @@ -48,8 +48,10 @@ _filter_io_error()
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > >  _supported_os Linux
> > > -# These tests only work for compat=1.1 images with refcount_bits=16
> > > -_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> > > +# These tests only work for compat=1.1 images without an external
> > > +# data file with refcount_bits=16
> > 
> > Yea, with all hardcoded offsets, that isn't going to work.
> 
> This isn’t about hardcoded offsets, it’s about the fact that the test
> references data cluster that are part of the qcow2 file (i.e., not in an
> external file).
That true too! In theory, the test could have asked the qcow2 image
where the data clusters are instead.

I think that in the long term, it would add a value to have some kind
of qcow2 specific test framework that would allow to query the qcow2 contents,
and manipulate it in the out of spec ways. Not now of course.



> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
> > > index ac0d2a9a3b..68e52a6402 100755
> > > --- a/tests/qemu-iotests/062
> > > +++ b/tests/qemu-iotests/062
> > > @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto generic
> > >  # We need zero clusters and snapshots
> > > -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
> > > +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
> > >  
> > >  IMG_SIZE=64M
> > >  
> > 
> > Maybe split that test as well in the long run.
> 
> How would that be possible, though?  There is only a single test case here.
Oops, I probably meant test 061, which might have a value to be split in 
two tests, one that upgrades/downgrades the version (and thus indeed can't use
any compat=1.1 features) and other test that works only on changing features of compat=1.1
images, where it could have used both different refcount bit settings and external data file.
(I suppose you can't take a regular qcow2 image and move its data clusters to an external data file, but still)


> 
> > > diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
> > > index 00eb80d89e..0fff3e3a52 100755
> > > --- a/tests/qemu-iotests/066
> > > +++ b/tests/qemu-iotests/066
> > > @@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto generic
> > >  # We need zero clusters and snapshots
> > > -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]'
> > > +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
> > 
> > Yet again, one small test case forcing the whole test to be skipped.
> > This should be split as well eventually.
> 
> This I agree with.
> 
> > > diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
> > > index 926c79b37c..3bc6e719eb 100755
> > > --- a/tests/qemu-iotests/067
> > > +++ b/tests/qemu-iotests/067
> > > @@ -32,8 +32,10 @@ status=1	# failure is the default!
> > >  
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > > -# Because anything other than 16 would change the output of query-block
> > > -_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
> > > +# Because anything other than 16 would change the output of query-block,
> > > +# and external data files would change the output of
> > > +# query-named-block-ndoes
> > > +_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
> > 
> > OK. There probably is a way to filter that, but I don't know if this is worth it.
> 
> Not really, because this again isn’t really a test of the image format.
I think I agree on this test now. Still in theory it adds/removes lot of block devices,
thus the qcow2 driver now has to open/close the external file, which might reveal some bugs.

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
> > > index e684b1b780..903dc9c9ab 100755
> > > --- a/tests/qemu-iotests/073
> > > +++ b/tests/qemu-iotests/073
> > > @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto generic
> > >  _unsupported_proto vxhs
> > > +# External data files do not support compressed clusters
> > > +_unsupported_imgopts data_file
> > 
> > This test should be split as well eventually.
> 
> Hm, yes.  I don’t know if it can be fully split.  I think what would
> work is a trimmed down copy just for external data files, but, well...
That what I was thinking as well...

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
> > > index b1ecafb41e..a3d13c414e 100755
> > > --- a/tests/qemu-iotests/080
> > > +++ b/tests/qemu-iotests/080
> > > @@ -40,9 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > >  _supported_os Linux
> > > -# - Internal snapshots are (currently) impossible with refcount_bits=1
> > > +# - Internal snapshots are (currently) impossible with refcount_bits=1,
> > > +#   and generally impossible with external data files
> > >  # - This is generally a test for compat=1.1 images
> > > -_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
> > > +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10'
> > 
> > I would more say that the test is too hardcoded for more that exact
> > settings it expects. It is all right in this case IMHO.
> > ACK.
> 
> I suppose we’d want a different test for data file validation, if
> anything, but I don’t think there is anything to validate there...
> 
Well the external data file as I understand is an extension on its own,
so in theory if you put some garbage there, it could reveal some bugs.
What if for example data file points to the same qcow2 file?
(or points through a symlink?) or it is NULL, or whatever.
The test for example tests for 'Invalid backing file size'
I guess that is what you mean here.

> [...]
> 
> > > diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
> > > index 700068b328..1e29d96b3d 100755
> > > --- a/tests/qemu-iotests/098
> > > +++ b/tests/qemu-iotests/098
> > > @@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > > -# The code path we want to test here only works for compat=1.1 images
> > > -_unsupported_imgopts 'compat=0.10'
> > > +# The code path we want to test here only works for compat=1.1 images;
> > > +# blkdebug can only inject errors on bs->file, so external data files
> > > +# do not work with this test
> > > +_unsupported_imgopts 'compat=0.10' data_file
> > 
> > ACK, but this is already 3rd test we loose. Maybe add to a TODO to extend blkdebug
> > to access data file as well.
> 
> That won’t work, though.  The problem is that in the block graph,
> blkdebug just exists between the format and the file node.  You’d need a
> second instance above the external data file node, but then those
> instances wouldn’t share data, and qcow2 only issues blkdebug events to
> the file node.
> 
> One could make qcow2 duplicate all events to the data file, but then you
> still wouldn’t share the same state in both instances.
> 
> In all, it would just be a mess.

I agree. That is more or less what I suspected.
In theory you could make single blkdebug instance have 2 inputs and 2 outputs
so it could filter both IO channels. Interesting how we deal with backing files,
since even without data file the qcow2 driver accesses two block devices, and
with data file it can access 3.




> 
> > > diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
> > > index b383c11e6a..65e8e92572 100755
> > > --- a/tests/qemu-iotests/099
> > > +++ b/tests/qemu-iotests/099
> > > @@ -46,8 +46,9 @@ _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
> > >  _supported_proto file
> > >  _supported_os Linux
> > >  _require_drivers blkdebug blkverify
> > > +# data_file would change the json:{} filenames
> > 
> > True but maybe still worth it to support the case?
> 
> I don’t think so, because this is specifically a test to check those
> filenames.
All right!
> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
> > > index 554b9de054..8c1ebe0443 100755
> > > --- a/tests/qemu-iotests/103
> > > +++ b/tests/qemu-iotests/103
> > > @@ -38,8 +38,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  
> > >  _supported_fmt qcow2
> > >  _supported_proto file nfs
> > > -# Internal snapshots are (currently) impossible with refcount_bits=1
> > > -_unsupported_imgopts 'refcount_bits=1[^0-9]'
> > > +# Internal snapshots are (currently) impossible with refcount_bits=1,
> > > +# and generally impossible with external data files
> > > +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
> > 
> > ACK.
> > The test also only needs the snapshot in a part of it, so maybe split as well
> > later.
> 
> But this test too is just an interface test, so I don’t quite see the need.
All right.

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
> > > index f90a744fc0..26104fff6c 100755
> > > --- a/tests/qemu-iotests/114
> > > +++ b/tests/qemu-iotests/114
> > > @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto generic
> > >  _unsupported_proto vxhs
> > > +# qcow2.py does not work too well with external data files
> > 
> > ACK, but should be fixed later.
> 
> Probably, but I don’t think this test would benefit much from it.
> (Because it isn’t too important to be able to run this with an external
> data file)
Looking again, I agree, but like I mentioned earlier, it might be worth
it to have test that fuzzes the backing file location (if we don't have one that is).

> 
> [...]
> 
> > > diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
> > > index 66ae9d5e78..7b0bc62a74 100755
> > > --- a/tests/qemu-iotests/138
> > > +++ b/tests/qemu-iotests/138
> > > @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2
> > >  _supported_proto file
> > >  _supported_os Linux
> > > +# These refcount calculations do not work with external data files
> > > +_unsupported_imgopts data_file
> > 
> > Thats why I don't like the hardcoded tests that much.
> 
> Good point.  I was wondering what the problem was here because I was
> sure it didn’t have anything to do with something hard-coded, and it
> doesn’t.
> 
> The actual reason is simply that there is no refcounting for external
> data files.  I’ll fix the comment.
Thanks!

> 
> > > diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
> > > index 3f27db71f2..5559df63a5 100755
> > > --- a/tests/qemu-iotests/156
> > > +++ b/tests/qemu-iotests/156
> > > @@ -51,6 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  _supported_fmt qcow2 qed
> > >  _supported_proto generic
> > >  _unsupported_proto vxhs
> > > +# Copying files around with cp does not work with external data files
> > > +_unsupported_imgopts data_file
> > 
> > Another place to fix later I guess.
> 
> I don’t know, this type of storage migration simply doesn’t work this
> way with external data files.
I am curios why? The test seems only to use external snapshots, so why it
would be different, other that copying the external files.

> 
> Max
> 

I want to note again, that I noted all the tests just in case,
most if not all of them probably indeed are best to be
blacklisted for external files.


Best regards,
	Maxim Levitsky




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 20/21] iotests: Disable data_file where it cannot be used
  2019-11-07 15:19       ` Maxim Levitsky
@ 2019-11-07 16:55         ` Max Reitz
  0 siblings, 0 replies; 48+ messages in thread
From: Max Reitz @ 2019-11-07 16:55 UTC (permalink / raw)
  To: Maxim Levitsky, qemu-block; +Cc: Kevin Wolf, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 12476 bytes --]

On 07.11.19 16:19, Maxim Levitsky wrote:
> On Thu, 2019-11-07 at 12:36 +0100, Max Reitz wrote:
>> On 06.11.19 16:52, Maxim Levitsky wrote:
>>> On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
>>>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>>>> ---
>>>>  tests/qemu-iotests/007 | 5 +++--
>>>>  tests/qemu-iotests/014 | 2 ++
>>>>  tests/qemu-iotests/015 | 5 +++--
>>>>  tests/qemu-iotests/026 | 5 ++++-
>>>>  tests/qemu-iotests/029 | 5 +++--
>>>>  tests/qemu-iotests/031 | 6 +++---
>>>>  tests/qemu-iotests/036 | 5 +++--
>>>>  tests/qemu-iotests/039 | 3 +++
>>>>  tests/qemu-iotests/046 | 2 ++
>>>>  tests/qemu-iotests/048 | 2 ++
>>>>  tests/qemu-iotests/051 | 5 +++--
>>>>  tests/qemu-iotests/058 | 5 +++--
>>>>  tests/qemu-iotests/060 | 6 ++++--
>>>>  tests/qemu-iotests/061 | 6 ++++--
>>>>  tests/qemu-iotests/062 | 2 +-
>>>>  tests/qemu-iotests/066 | 2 +-
>>>>  tests/qemu-iotests/067 | 6 ++++--
>>>>  tests/qemu-iotests/068 | 5 +++--
>>>>  tests/qemu-iotests/071 | 3 +++
>>>>  tests/qemu-iotests/073 | 2 ++
>>>>  tests/qemu-iotests/074 | 2 ++
>>>>  tests/qemu-iotests/080 | 5 +++--
>>>>  tests/qemu-iotests/090 | 2 ++
>>>>  tests/qemu-iotests/098 | 6 ++++--
>>>>  tests/qemu-iotests/099 | 3 ++-
>>>>  tests/qemu-iotests/103 | 5 +++--
>>>>  tests/qemu-iotests/108 | 6 ++++--
>>>>  tests/qemu-iotests/112 | 5 +++--
>>>>  tests/qemu-iotests/114 | 2 ++
>>>>  tests/qemu-iotests/121 | 3 +++
>>>>  tests/qemu-iotests/138 | 2 ++
>>>>  tests/qemu-iotests/156 | 2 ++
>>>>  tests/qemu-iotests/176 | 7 +++++--
>>>>  tests/qemu-iotests/191 | 2 ++
>>>>  tests/qemu-iotests/201 | 6 +++---
>>>>  tests/qemu-iotests/214 | 3 ++-
>>>>  tests/qemu-iotests/217 | 3 ++-
>>>>  tests/qemu-iotests/220 | 5 +++--
>>>>  tests/qemu-iotests/243 | 6 ++++--
>>>>  tests/qemu-iotests/244 | 5 +++--
>>>>  tests/qemu-iotests/250 | 2 ++
>>>>  tests/qemu-iotests/267 | 5 +++--
>>>>  42 files changed, 117 insertions(+), 52 deletions(-)
>>
>> [...]
>>
>>>> diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
>>>> index c44fcf91bb..646ecd593f 100755
>>>> --- a/tests/qemu-iotests/031
>>>> +++ b/tests/qemu-iotests/031
>>>> @@ -40,9 +40,9 @@ 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]\|$\)\)'
>>>> +# We want to test compat=0.10, which does not support external data
>>>> +# files or refcount widths other than 16
>>>> +_unsupported_imgopts data_file 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>>>
>>> This is maybe another reason to split this test for compat=0.10 and for compat=1.1
>>> But still can be done later of course.
>>
>> Hm, but I don’t really think this test is important for external data
>> files.  There is no I/O.
> I guess both yes and no, the external data file is a header extension as well.

Yes, but the test already involves a header extension.

>>>> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
>>>> index bbaf0ef45b..512598421c 100755
>>>> --- a/tests/qemu-iotests/036
>>>> +++ b/tests/qemu-iotests/036
>>>> @@ -43,8 +43,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>>>  # This tests qcow2-specific low-level functionality
>>>>  _supported_fmt qcow2
>>>>  _supported_proto file
>>>> -# Only qcow2v3 and later supports feature bits
>>>> -_unsupported_imgopts 'compat=0.10'
>>>> +# Only qcow2v3 and later supports feature bits;
>>>> +# qcow2.py does not support external data files
>>>
>>> Minor nitpick, maybe tag this with TODO or so. No need to do now.
>>
>> Hm, well, and the same applies here.  (Just not a very important test.)
> Same here, in theory external data file is a feature, and it could
> 'interact' with other features, but most likely you are right here as well.

Well, but the test currently doesn’t involve any known feature bits.
It’s mostly about checking what our qcow2 driver does with unknown
feature bits.

(If it wanted to involve known feature bits, it could have easily used
e.g. the dirty feature.)

>>>> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
>>>> index a8feb76184..2af6b74b41 100755
>>>> --- a/tests/qemu-iotests/048
>>>> +++ b/tests/qemu-iotests/048
>>>> @@ -49,6 +49,8 @@ _compare()
>>>>  _supported_fmt raw qcow2 qed luks
>>>>  _supported_proto file
>>>>  _supported_os Linux
>>>> +# Using 'cp' is incompatible with external data files
>>>> +_unsupported_imgopts data_file
>>>
>>> You could compare the external files instead in theory *I think*.
>>> Another item on some TODO list I guess.
>>
>> This is a test of qemu-img compare, not of the image format.  So it
>> doesn’t make much sense to me to compare the external files, and also it
>> should be completely sufficient to run this test only without external
>> data files.
> Yes but on the other hand, its is kind of nice to test that it can compare correctly
> two qcow2 files which have external data files attached.

But then we need to compare the qcow2 files themselves, and that doesn’t
work precisely because of the cp.

(I suppose we could work around it by sprinkling a dose of option
parsing, qemu-img amend, etc. on it, but I don’t see the point.)

>>>> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
>>>> index 9cd1d60d45..0053bad46a 100755
>>>> --- a/tests/qemu-iotests/051
>>>> +++ b/tests/qemu-iotests/051
>>>> @@ -39,8 +39,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>>>  _supported_fmt qcow2
>>>>  _supported_proto file
>>>>  # A compat=0.10 image is created in this test which does not support anything
>>>> -# other than refcount_bits=16
>>>
>>> Here also the compat=0.10 image is only a small part of the test,
>>> although it seems to get used later in the rest of the test,
>>>
>>> so the test I think should be split so that rest of the test could run in all
>>> configurations. 
>>
>> This too isn’t an image format test (specifically, there’s no I/O but
>> for the snapshotting test, which mostly uses a different image anyway),
>> so I don’t think it’s necessary to allow this test for data_file.
> Same here, I agree but still what if there is some interaction between backing
> file and data file?

I’d suspect 244 is the better place to put such tests.

>>>> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
>>>> index 92243c2edd..8ad0d7a904 100755
>>>> --- a/tests/qemu-iotests/060
>>>> +++ b/tests/qemu-iotests/060
>>>> @@ -48,8 +48,10 @@ _filter_io_error()
>>>>  _supported_fmt qcow2
>>>>  _supported_proto file
>>>>  _supported_os Linux
>>>> -# These tests only work for compat=1.1 images with refcount_bits=16
>>>> -_unsupported_imgopts 'compat=0.10' 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
>>>> +# These tests only work for compat=1.1 images without an external
>>>> +# data file with refcount_bits=16
>>>
>>> Yea, with all hardcoded offsets, that isn't going to work.
>>
>> This isn’t about hardcoded offsets, it’s about the fact that the test
>> references data cluster that are part of the qcow2 file (i.e., not in an
>> external file).
> That true too! In theory, the test could have asked the qcow2 image
> where the data clusters are instead.

That isn’t what I mean.  This test lets a data cluster point into the
refcount structure; with an external data file, it wouldn’t actually
point into the metadata, because all data clusters must be in the
external file, so there’s no corruption then.

[...]

>>>> diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
>>>> index b1ecafb41e..a3d13c414e 100755
>>>> --- a/tests/qemu-iotests/080
>>>> +++ b/tests/qemu-iotests/080
>>>> @@ -40,9 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>>>  _supported_fmt qcow2
>>>>  _supported_proto file
>>>>  _supported_os Linux
>>>> -# - Internal snapshots are (currently) impossible with refcount_bits=1
>>>> +# - Internal snapshots are (currently) impossible with refcount_bits=1,
>>>> +#   and generally impossible with external data files
>>>>  # - This is generally a test for compat=1.1 images
>>>> -_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
>>>> +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10'
>>>
>>> I would more say that the test is too hardcoded for more that exact
>>> settings it expects. It is all right in this case IMHO.
>>> ACK.
>>
>> I suppose we’d want a different test for data file validation, if
>> anything, but I don’t think there is anything to validate there...
>>
> Well the external data file as I understand is an extension on its own,
> so in theory if you put some garbage there, it could reveal some bugs.
> What if for example data file points to the same qcow2 file?
> (or points through a symlink?)

To my knowledge, we’ve kind of given up on detecting loops because you
can always make one if you really want to...

> or it is NULL, or whatever.
> The test for example tests for 'Invalid backing file size'
> I guess that is what you mean here.

Well, in any case it’d be something for a completely new test case.

>>>> diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
>>>> index 700068b328..1e29d96b3d 100755
>>>> --- a/tests/qemu-iotests/098
>>>> +++ b/tests/qemu-iotests/098
>>>> @@ -40,8 +40,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>>>  
>>>>  _supported_fmt qcow2
>>>>  _supported_proto file
>>>> -# The code path we want to test here only works for compat=1.1 images
>>>> -_unsupported_imgopts 'compat=0.10'
>>>> +# The code path we want to test here only works for compat=1.1 images;
>>>> +# blkdebug can only inject errors on bs->file, so external data files
>>>> +# do not work with this test
>>>> +_unsupported_imgopts 'compat=0.10' data_file
>>>
>>> ACK, but this is already 3rd test we loose. Maybe add to a TODO to extend blkdebug
>>> to access data file as well.
>>
>> That won’t work, though.  The problem is that in the block graph,
>> blkdebug just exists between the format and the file node.  You’d need a
>> second instance above the external data file node, but then those
>> instances wouldn’t share data, and qcow2 only issues blkdebug events to
>> the file node.
>>
>> One could make qcow2 duplicate all events to the data file, but then you
>> still wouldn’t share the same state in both instances.
>>
>> In all, it would just be a mess.
> 
> I agree. That is more or less what I suspected.
> In theory you could make single blkdebug instance have 2 inputs and 2 outputs
> so it could filter both IO channels.

This wouldn’t work because no node is supposed to know its parents.  So
it can’t distinguish between the two “outputs”.

We’d need a shared state somewhere and then two different blkdebug
instances that access it with some runtime option to tell each one what
it’s supposed to do.  But that’s what I mean by “mess”. :-)

> Interesting how we deal with backing files,
> since even without data file the qcow2 driver accesses two block devices, and
> with data file it can access 3.

We simply never inject errors on the backing file. (AFAIK)

[...]

>>>> diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
>>>> index 3f27db71f2..5559df63a5 100755
>>>> --- a/tests/qemu-iotests/156
>>>> +++ b/tests/qemu-iotests/156
>>>> @@ -51,6 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>>>  _supported_fmt qcow2 qed
>>>>  _supported_proto generic
>>>>  _unsupported_proto vxhs
>>>> +# Copying files around with cp does not work with external data files
>>>> +_unsupported_imgopts data_file
>>>
>>> Another place to fix later I guess.
>>
>> I don’t know, this type of storage migration simply doesn’t work this
>> way with external data files.
> I am curios why? The test seems only to use external snapshots, so why it
> would be different, other that copying the external files.

One would also need to adjust the qcow2 file to point to the copied data
file.

> I want to note again, that I noted all the tests just in case,
> most if not all of them probably indeed are best to be
> blacklisted for external files.

Yep, and it’s definitely good to have a kind of external perspective on
it. :-)

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2019-11-07 16:57 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 14:27 [PATCH v2 00/21] iotests: Allow ./check -o data_file Max Reitz
2019-10-15 14:27 ` [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts Max Reitz
2019-11-06 15:37   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits Max Reitz
2019-11-06 15:37   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 03/21] iotests: Add _filter_json_filename Max Reitz
2019-11-06 15:44   ` Maxim Levitsky
2019-11-07  8:59     ` Max Reitz
2019-11-07 10:01       ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 04/21] iotests: Filter refcount_order in 036 Max Reitz
2019-11-06 15:45   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts Max Reitz
2019-11-06 15:45   ` Maxim Levitsky
2019-11-07  9:08     ` Max Reitz
2019-11-07  9:56       ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 06/21] iotests: Drop compat=1.1 in 050 Max Reitz
2019-10-15 14:27 ` [PATCH v2 07/21] iotests: Let _make_test_img parse its parameters Max Reitz
2019-10-15 14:27 ` [PATCH v2 08/21] iotests: Add -o and --no-opts to _make_test_img Max Reitz
2019-10-15 14:27 ` [PATCH v2 09/21] iotests: Inject space into -ocompat=0.10 in 051 Max Reitz
2019-10-15 14:27 ` [PATCH v2 10/21] iotests: Replace IMGOPTS= by -o Max Reitz
2019-11-06 15:47   ` Maxim Levitsky
2019-11-07  9:20     ` Max Reitz
2019-11-07  9:52       ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 11/21] iotests: Replace IMGOPTS='' by --no-opts Max Reitz
2019-10-15 14:27 ` [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267 Max Reitz
2019-11-06 15:50   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 13/21] iotests: Avoid qemu-img create Max Reitz
2019-10-15 14:27 ` [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images Max Reitz
2019-11-06 15:47   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 15/21] iotests: Avoid cp/mv of " Max Reitz
2019-10-15 14:27 ` [PATCH v2 16/21] iotests: Make 091 work with data_file Max Reitz
2019-11-06 15:50   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 17/21] iotests: Make 110 " Max Reitz
2019-11-06 15:50   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 18/21] iotests: Make 137 " Max Reitz
2019-11-06 15:51   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 19/21] iotests: Make 198 " Max Reitz
2019-11-06 15:51   ` Maxim Levitsky
2019-10-15 14:27 ` [PATCH v2 20/21] iotests: Disable data_file where it cannot be used Max Reitz
2019-11-06 15:52   ` Maxim Levitsky
2019-11-07 11:36     ` Max Reitz
2019-11-07 15:19       ` Maxim Levitsky
2019-11-07 16:55         ` Max Reitz
2019-10-15 14:27 ` [PATCH v2 21/21] iotests: Allow check -o data_file Max Reitz
2019-11-06 15:52   ` Maxim Levitsky
2019-10-16  0:19 ` [PATCH v2 00/21] iotests: Allow ./check " no-reply
2019-10-16  7:18   ` Max Reitz
2019-11-06 15:52 ` Maxim Levitsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.