iotests: Fix unsupported_imgopts for refcount_bits
PATCH 1/1 iotests: Fix unsupported_imgopts for refcount_bits
Many _unsupported_imgopts lines for refcount_bits values use something like "refcount_bits=1[^0-9]" to forbid everything but "refcount_bits=1" (e.g. "refcount_bits=16" is allowed).
That does not work when $IMGOPTS does not have any entry past the refcount_bits option, which now became apparent with the "check" script rewrite.
Use \b instead of [^0-9] to check for a word boundary, which is what we really want.
---
Reproducible with:
$ ./check -qcow2 -o refcount_bits=1 (The tests touched here should be skipped)
I don't know whether \b is portable. I hope it is. (This is why I CC-ed you, Eric.)
Then again, it appears that nobody ever runs the iotests with refcount_bits=1 but me, and I do that on Linux. So even if it isn't portable, it shouldn't be an issue in practice... O:)
--- tests/qemu-iotests/007 | 2 +- tests/qemu-iotests/015 | 2 +- tests/qemu-iotests/029 | 2 +- tests/qemu-iotests/058 | 2 +- tests/qemu-iotests/062 | 2 +- tests/qemu-iotests/066 | 2 +- tests/qemu-iotests/068 | 2 +- tests/qemu-iotests/080 | 2 +- tests/qemu-iotests/103 | 2 +- tests/qemu-iotests/201 | 2 +- tests/qemu-iotests/214 | 2 +- tests/qemu-iotests/217 | 2 +- tests/qemu-iotests/267 | 2 +- tests/qemu-iotests/271 | 3 ++- tests/qemu-iotests/286 | 2 +- 15 files changed, 16 insertions(+), 15 deletions(-)
tests/qemu-iotests/007 +1 -1
@@ -44,7 +44,7 @@ _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); # snapshot are generally impossible with external data files -_unsupported_imgopts 'refcount_bits=\(1\|2\)[^0-9]' data_file +_unsupported_imgopts 'refcount_bits=\(1\|2\)\b' data_file echo echo "creating image"
tests/qemu-iotests/015 +1 -1
@@ -43,7 +43,7 @@ _supported_fmt qcow2 _supported_proto generic # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file echo echo "creating image"
tests/qemu-iotests/029 +1 -1
@@ -44,7 +44,7 @@ _supported_fmt qcow2 _supported_proto generic # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file offset_size=24 offset_l1_size=36
tests/qemu-iotests/058 +1 -1
@@ -59,7 +59,7 @@ _supported_os Linux _require_command QEMU_NBD # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
tests/qemu-iotests/062 +1 -1
@@ -42,7 +42,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]' data_file +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1\b' data_file IMG_SIZE=64M
tests/qemu-iotests/066 +1 -1
@@ -43,7 +43,7 @@ _supported_proto generic # We need zero clusters and snapshots # (TODO: Consider splitting the snapshot part into a separate test # file, so this one runs with refcount_bits=1 and data_file) -_unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1\b' data_file # Intentionally create an unaligned image IMG_SIZE=$((64 * 1024 * 1024 + 512))
tests/qemu-iotests/068 +1 -1
@@ -42,7 +42,7 @@ _supported_fmt qcow2 _supported_proto generic # 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 +_unsupported_imgopts 'compat=0.10' 'refcount_bits=1\b' data_file IMG_SIZE=128K
tests/qemu-iotests/080 +1 -1
@@ -44,7 +44,7 @@ _supported_os Linux # - 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]' data_file 'compat=0.10' +_unsupported_imgopts 'refcount_bits=1\b' data_file 'compat=0.10' header_size=112
tests/qemu-iotests/103 +1 -1
@@ -41,7 +41,7 @@ _supported_fmt qcow2 _supported_proto file nfs fuse # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file IMG_SIZE=64K
tests/qemu-iotests/201 +1 -1
@@ -46,7 +46,7 @@ _supported_os Linux # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file size=64M _make_test_img $size
tests/qemu-iotests/214 +1 -1
@@ -41,7 +41,7 @@ _supported_proto file fuse # Repairing the corrupted image requires qemu-img check to store a # refcount up to 3, which requires at least two refcount bits. # External data files do not support compressed clusters. -_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file +_unsupported_imgopts 'refcount_bits=1\b' data_file echo
tests/qemu-iotests/217 +1 -1
@@ -42,7 +42,7 @@ _supported_proto file fuse # This test needs clusters with at least a refcount of 2 so that # OFLAG_COPIED is not set. refcount_bits=1 is therefore unsupported. # (As are external data files.) -_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file +_unsupported_imgopts 'refcount_bits=1\b' data_file echo echo '=== Simulating an I/O error during snapshot deletion ==='
tests/qemu-iotests/267 +1 -1
@@ -45,7 +45,7 @@ _require_drivers copy-on-read # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file _require_devices virtio-blk
tests/qemu-iotests/271 +2 -1
@@ -43,7 +43,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file nfs _supported_os Linux -_unsupported_imgopts extended_l2 compat=0.10 cluster_size data_file refcount_bits=1[^0-9] +_unsupported_imgopts extended_l2 compat=0.10 cluster_size data_file \ + 'refcount_bits=1\b' l2_offset=$((0x40000))
tests/qemu-iotests/286 +1 -1
@@ -39,7 +39,7 @@ _supported_fmt qcow2 _supported_proto file fuse # 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 +_unsupported_imgopts 'refcount_bits=1\b' data_file _make_test_img 64M
Signature · 1 line
2.29.2
Quoted 10 lines · Max Reitz
Many
_unsupported_imgoptslines forrefcount_bitsvalues use something like "refcount_bits=1[^0-9]" to forbid everything but "refcount_bits=1" (e.g. "refcount_bits=16" is allowed).That does not work when $IMGOPTS does not have any entry past the
refcount_bitsoption, which now became apparent with the "check" script rewrite.Use \b instead of [^0-9] to check for a word boundary, which is what we really want.
\b is a Linux-ism (that is, glibc supports it, but BSD libc does not).
https://mail-index.netbsd.org/tech-userlevel/2012/12/02/msg006954.html
Quoted 9 lines
Signed-off-by Max Reitz <[email protected]>---
Reproducible with:$ ./check -qcow2 -o refcount_bits=1 (The tests touched here should be skipped)I don't know whether \b is portable. I hope it is. (This is why I CC-ed you, Eric.)
No, it's not portable. \> and [[:>:]] are other spellings for the same task, equally non-portable.
Quoted 4 lines
Then again, it appears that nobody ever runs the iotests with refcount_bits=1 but me, and I do that on Linux. So even if it isn't portable, it shouldn't be an issue in practice... O:)
What exactly is failing? Is it merely a case of our python script running the regex against "${unsupported_imgopts}" instead of "${unsupported_imgsopts} " with an added trailing space to guarantee that we have something to match against?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 9 lines · Eric Blake
Quoted 8 lines · Max Reitz
Many
_unsupported_imgoptslines forrefcount_bitsvalues use something like "refcount_bits=1[^0-9]" to forbid everything but "refcount_bits=1" (e.g. "refcount_bits=16" is allowed).That does not work when $IMGOPTS does not have any entry past the
refcount_bitsoption, which now became apparent with the "check" script rewrite.
Quoted 6 lines
Quoted 2 lines
Use \b instead of [^0-9] to check for a word boundary, which is what we really want.
\b is a Linux-ism (that is, glibc supports it, but BSD libc does not).
https://mail-index.netbsd.org/tech-userlevel/2012/12/02/msg006954.html
:(
Quoted 14 lines
Quoted 9 lines
Signed-off-by Max Reitz <[email protected]>---
Reproducible with:$ ./check -qcow2 -o refcount_bits=1 (The tests touched here should be skipped)I don't know whether \b is portable. I hope it is. (This is why I CC-ed you, Eric.)
No, it's not portable. \> and [[:>:]] are other spellings for the same task, equally non-portable.
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
Then again, it appears that nobody ever runs the iotests with refcount_bits=1 but me, and I do that on Linux. So even if it isn't portable, it shouldn't be an issue in practice... O:)
What exactly is failing? Is it merely a case of our python script running the regex against "${unsupported_imgopts}" instead of "${unsupported_imgsopts} " with an added trailing space to guarantee that we have something to match against?
A bit of a hack, but one that indeed works, yes. Thanks!
Max