mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
iotests: bash tests: filter compression type
We want iotests pass with both the default zlib compression and with IMGOPTS='compression_type=zstd'. Actually the only test that is interested in real compression type in test output is 287 (test for qcow2 compression type), so implement specific option for it. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20211223160144.1097696-17-vsementsov@virtuozzo.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
parent
72be51ddb3
commit
dba5aee4da
|
@ -17,7 +17,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
corrupt: true
|
||||
|
|
|
@ -525,7 +525,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file: TEST_DIR/t.IMGFMT.data
|
||||
|
@ -552,7 +552,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file: foo
|
||||
|
@ -567,7 +567,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file raw: false
|
||||
|
@ -583,7 +583,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file: TEST_DIR/t.IMGFMT.data
|
||||
|
@ -597,7 +597,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file: TEST_DIR/t.IMGFMT.data
|
||||
|
@ -612,7 +612,7 @@ virtual size: 64 MiB (67108864 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
data file: TEST_DIR/t.IMGFMT.data
|
||||
|
|
|
@ -17,7 +17,7 @@ virtual size: 128 MiB (134217728 bytes)
|
|||
cluster_size: 4096
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -31,7 +31,7 @@ virtual size: 128 MiB (134217728 bytes)
|
|||
cluster_size: 8192
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -329,7 +329,7 @@ virtual size: 128 MiB (134217728 bytes)
|
|||
cluster_size: 4096
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -342,7 +342,7 @@ virtual size: 128 MiB (134217728 bytes)
|
|||
cluster_size: 8192
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -639,7 +639,7 @@ virtual size: 128 MiB (134217728 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -652,7 +652,7 @@ virtual size: 130 MiB (136314880 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: false
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
@ -665,7 +665,7 @@ virtual size: 132 MiB (138412032 bytes)
|
|||
cluster_size: 65536
|
||||
Format specific information:
|
||||
compat: 1.1
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
lazy refcounts: true
|
||||
refcount bits: 16
|
||||
corrupt: false
|
||||
|
|
|
@ -36,7 +36,7 @@ image: json:{ /* filtered */ }
|
|||
file format: IMGFMT
|
||||
virtual size: 16 MiB (16777216 bytes)
|
||||
Format specific information:
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
encrypt:
|
||||
ivgen alg: plain64
|
||||
hash alg: sha256
|
||||
|
@ -81,7 +81,7 @@ virtual size: 16 MiB (16777216 bytes)
|
|||
backing file: TEST_DIR/t.IMGFMT.base
|
||||
backing file format: IMGFMT
|
||||
Format specific information:
|
||||
compression type: zlib
|
||||
compression type: COMPRESSION_TYPE
|
||||
encrypt:
|
||||
ivgen alg: plain64
|
||||
hash alg: sha256
|
||||
|
|
|
@ -61,13 +61,13 @@ echo
|
|||
echo "=== Testing compression type incompatible bit setting for zlib ==="
|
||||
echo
|
||||
_make_test_img -o compression_type=zlib 64M
|
||||
_qcow2_dump_header | grep incompatible_features
|
||||
_qcow2_dump_header --no-filter-compression | grep incompatible_features
|
||||
|
||||
echo
|
||||
echo "=== Testing compression type incompatible bit setting for zstd ==="
|
||||
echo
|
||||
_make_test_img -o compression_type=zstd 64M
|
||||
_qcow2_dump_header | grep incompatible_features
|
||||
_qcow2_dump_header --no-filter-compression | grep incompatible_features
|
||||
|
||||
echo
|
||||
echo "=== Testing zlib with incompatible bit set ==="
|
||||
|
@ -75,7 +75,7 @@ echo
|
|||
_make_test_img -o compression_type=zlib 64M
|
||||
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 3
|
||||
# to make sure the bit was actually set
|
||||
_qcow2_dump_header | grep incompatible_features
|
||||
_qcow2_dump_header --no-filter-compression | grep incompatible_features
|
||||
|
||||
if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then
|
||||
echo "Error: The image opened successfully. The image must not be opened."
|
||||
|
@ -87,7 +87,7 @@ echo
|
|||
_make_test_img -o compression_type=zstd 64M
|
||||
$PYTHON qcow2.py "$TEST_IMG" set-header incompatible_features 0
|
||||
# to make sure the bit was actually unset
|
||||
_qcow2_dump_header | grep incompatible_features
|
||||
_qcow2_dump_header --no-filter-compression | grep incompatible_features
|
||||
|
||||
if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then
|
||||
echo "Error: The image opened successfully. The image must not be opened."
|
||||
|
|
|
@ -247,6 +247,7 @@ _filter_img_info()
|
|||
-e "/block_state_zero: \\(on\\|off\\)/d" \
|
||||
-e "/log_size: [0-9]\\+/d" \
|
||||
-e "s/iters: [0-9]\\+/iters: 1024/" \
|
||||
-e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \
|
||||
-e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/" | \
|
||||
while IFS='' read -r line; do
|
||||
if [[ $format_specific == 1 ]]; then
|
||||
|
@ -337,5 +338,12 @@ _filter_authz_check_tls()
|
|||
$SED -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check for DISTINGUISHED-NAME is denied/'
|
||||
}
|
||||
|
||||
_filter_qcow2_compression_type_bit()
|
||||
{
|
||||
$SED -e 's/\(incompatible_features\s\+\)\[3\(, \)\?/\1[/' \
|
||||
-e 's/\(incompatible_features.*\), 3\]/\1]/' \
|
||||
-e 's/\(incompatible_features.*\), 3\(,.*\)/\1\2/'
|
||||
}
|
||||
|
||||
# make sure this script returns success
|
||||
true
|
||||
|
|
|
@ -699,6 +699,7 @@ _img_info()
|
|||
-e "s#$TEST_DIR#TEST_DIR#g" \
|
||||
-e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \
|
||||
-e "s#$IMGFMT#IMGFMT#g" \
|
||||
-e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \
|
||||
-e "/^disk size:/ D" \
|
||||
-e "/actual-size/ D" | \
|
||||
while IFS='' read -r line; do
|
||||
|
@ -998,12 +999,23 @@ _require_one_device_of()
|
|||
|
||||
_qcow2_dump_header()
|
||||
{
|
||||
if [[ "$1" == "--no-filter-compression" ]]; then
|
||||
local filter_compression=0
|
||||
shift
|
||||
else
|
||||
local filter_compression=1
|
||||
fi
|
||||
|
||||
img="$1"
|
||||
if [ -z "$img" ]; then
|
||||
img="$TEST_IMG"
|
||||
fi
|
||||
|
||||
if [[ $filter_compression == 0 ]]; then
|
||||
$PYTHON qcow2.py "$img" dump-header
|
||||
else
|
||||
$PYTHON qcow2.py "$img" dump-header | _filter_qcow2_compression_type_bit
|
||||
fi
|
||||
}
|
||||
|
||||
# make sure this script returns success
|
||||
|
|
Loading…
Reference in a new issue