[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 15/18] iotests: Make 137 work with data_file
From: |
Maxim Levitsky |
Subject: |
Re: [PATCH 15/18] iotests: Make 137 work with data_file |
Date: |
Sun, 29 Sep 2019 19:38:30 +0300 |
On Fri, 2019-09-27 at 11:42 +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).
>
> Doing so means this test works both with and without external data
> files.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> tests/qemu-iotests/137 | 10 ++++++----
> tests/qemu-iotests/137.out | 4 +---
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
> index 6cf2997577..dd3484205e 100755
> --- a/tests/qemu-iotests/137
> +++ b/tests/qemu-iotests/137
> @@ -138,14 +138,16 @@ $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)
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features \
> + | sed -e 's/0x4/0x0/'
Maybe it is better to filter all the feature bits, but the dirty bit,
since only it is needed here, so that when we start running tests with
more features, we won't need to do this again?
>
> # 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"
I am wondering if there is any better way to do this (regardless of this patch),
Basically the above code pokes into the 3rd cluster on the disk I *think*, and
I don't
understand why it has to contain refcounts. Hmm...
First cluster I can guess will have the header, 2nd cluster probably L1 table,
and 3rd, refcounts?
If so, the test should specify that it needs 64K clusters, because the day will
come when
we will need to test this as well, but I guess in a separate patch,
> $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 1c6569eb2c..bd5f76d604 100644
> --- a/tests/qemu-iotests/137.out
> +++ b/tests/qemu-iotests/137.out
> @@ -38,9 +38,7 @@ wrote 512/512 bytes at offset 0
> ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}"
> _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" )
> incompatible_features 0x0
> 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
Best regards,
Maxim Levitsky
[PATCH 16/18] iotests: Make 198 work with data_file, Max Reitz, 2019/09/27
[PATCH 17/18] iotests: Disable data_file where it cannot be used, Max Reitz, 2019/09/27
[PATCH 18/18] iotests: Allow check -o data_file, Max Reitz, 2019/09/27