qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 34/34] iotests: Add tests for qcow2 images with extended L


From: Max Reitz
Subject: Re: [PATCH v9 34/34] iotests: Add tests for qcow2 images with extended L2 entries
Date: Fri, 3 Jul 2020 11:49:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 28.06.20 13:02, Alberto Garcia wrote:
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  tests/qemu-iotests/271     | 901 +++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/271.out | 724 +++++++++++++++++++++++++++++
>  tests/qemu-iotests/group   |   1 +
>  3 files changed, 1626 insertions(+)
>  create mode 100755 tests/qemu-iotests/271
>  create mode 100644 tests/qemu-iotests/271.out
> 
> diff --git a/tests/qemu-iotests/271 b/tests/qemu-iotests/271
> new file mode 100755
> index 0000000000..5ef3ebb2bf
> --- /dev/null
> +++ b/tests/qemu-iotests/271

[...]

> +# get standard environment, filters and checks
> +. ./common.rc
> +. ./common.filter
> +
> +_supported_fmt qcow2
> +_supported_proto file nfs
> +_supported_os Linux
> +_unsupported_imgopts extended_l2 compat=0.10 cluster_size data_file

I’d also add a 'refcount_bits=1[^0-9]', because this test doesn’t pass
with refcount-bits=1 (due to taking a snapshot at one point).

> +
> +l2_offset=$((0x40000))
> +
> +_verify_img()
> +{
> +    $QEMU_IMG compare "$TEST_IMG" "$TEST_IMG.raw" | grep -v 'Images are 
> identical'
> +    $QEMU_IMG check "$TEST_IMG" | _filter_qemu_img_check | \
> +        grep -v 'No errors were found on the image'
> +}
> +
> +# Compare the bitmap of an extended L2 entry against an expected value
> +_verify_l2_bitmap()
> +{
> +    entry_no="$1"            # L2 entry number, starting from 0
> +    expected_alloc="$alloc"  # Space-separated list of allocated subcluster 
> indexes
> +    expected_zero="$zero"    # Space-separated list of zero subcluster 
> indexes
> +
> +    offset=$(($l2_offset + $entry_no * 16))
> +    entry=$(peek_file_be "$TEST_IMG" $offset 8)
> +    offset=$(($offset + 8))
> +    bitmap=$(peek_file_be "$TEST_IMG" $offset 8)
> +
> +    expected_bitmap=0
> +    for bit in $expected_alloc; do
> +        expected_bitmap=$(($expected_bitmap | (1 << $bit)))
> +    done
> +    for bit in $expected_zero; do
> +        expected_bitmap=$(($expected_bitmap | (1 << (32 + $bit))))
> +    done
> +    printf -v expected_bitmap "%llu" $expected_bitmap # Convert to unsigned

Does the length modifier “ll” actually do anything?

> +
> +    printf "L2 entry #%d: 0x%016lx %016lx\n" "$entry_no" "$entry" "$bitmap"

Or the “l” here?

> +    if [ "$bitmap" != "$expected_bitmap" ]; then
> +        printf "ERROR: expecting bitmap       0x%016lx\n" "$expected_bitmap"

(or here)

> +    fi
> +}
Apart from those nit picks, I didn’t find anything to complain about.
My brain feels like mush now, though, after having brooded over this
test for over an hour...

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]