qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Denis Plotnikov <dplotnikov@virtuozzo.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, berto@igalia.com,
	qemu-block@nongnu.org, armbru@redhat.com, den@openvz.org
Subject: Re: [PATCH v20 4/4] iotests: 287: add qcow2 compression type test
Date: Mon, 27 Apr 2020 15:29:04 +0200	[thread overview]
Message-ID: <c0fdc097-dabd-4661-fce9-a63a24a8d792@redhat.com> (raw)
In-Reply-To: <20200421081117.7595-5-dplotnikov@virtuozzo.com>


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

On 21.04.20 10:11, Denis Plotnikov wrote:
> The test checks fulfilling qcow2 requirements for the compression
> type feature and zstd compression type operability.
> 
> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> ---
>  tests/qemu-iotests/287     | 146 +++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/287.out |  67 +++++++++++++++++
>  tests/qemu-iotests/group   |   1 +
>  3 files changed, 214 insertions(+)
>  create mode 100755 tests/qemu-iotests/287
>  create mode 100644 tests/qemu-iotests/287.out
> 
> diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287
> new file mode 100755
> index 0000000000..156acc40ad
> --- /dev/null
> +++ b/tests/qemu-iotests/287
> @@ -0,0 +1,146 @@
> +#!/usr/bin/env bash
> +#
> +# Test case for an image using zstd compression
> +#
> +# Copyright (c) 2020 Virtuozzo International GmbH
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +# creator
> +owner=dplotnikov@virtuozzo.com
> +
> +seq="$(basename $0)"
> +echo "QA output created by $seq"
> +
> +status=1	# failure is the default!
> +
> +# standard environment
> +. ./common.rc
> +. ./common.filter
> +
> +# This tests qocw2-specific low-level functionality
> +_supported_fmt qcow2
> +_supported_proto file
> +_supported_os Linux

This test doesn’t work with compat=0.10 (because we can’t store a
non-default compression type there) or data_file (because those don’t
support compression), so those options should be marked as unsupported.

(It does seem to work with any refcount_bits, though.)

> +
> +COMPR_IMG="$TEST_IMG.compressed"
> +RAND_FILE="$TEST_DIR/rand_data"
> +
> +_cleanup()
> +{
> +	_cleanup_test_img
> +	rm -f "$COMPR_IMG"

Using _rm_test_img() would be nicer.  There shouldn’t be a functional
difference here because there’d only be one with external data files (I
think), which won’t work with this test, but still.

> +	rm -f "$RAND_FILE"
> +}
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +# for all the cases
> +CLUSTER_SIZE=65536
> +
> +# Check if we can run this test.
> +if IMGOPTS='compression_type=zstd' _make_test_img 64M |
> +    grep "Invalid parameter 'zstd'"; then
> +    _notrun "ZSTD is disabled"
> +fi
> +
> +echo
> +echo "=== Testing compression type incompatible bit setting for zlib ==="
> +echo
> +IMGOPTS='compression_type=zlib' _make_test_img 64M

Please use -o so user options are still considered.

(i.e., _make_test_img -o compression_type=zlib)

[...]

> +echo
> +echo "=== Testing incompressible cluster processing with zstd ==="
> +echo
> +# create a 2M image and fill it with 1M likely incompressible data
> +# and 1M compressible data
> +dd if=/dev/urandom of="$RAND_FILE" bs=1M count=1 seek=1
> +QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" \
> +$QEMU_IO -f raw -c "write -P 0xFA 0 1M" "$RAND_FILE" | _filter_qemu_io
> +$QEMU_IMG convert -f raw -O $IMGFMT -c "$RAND_FILE" "$TEST_IMG" | _filter_qemu_io
> +
> +$QEMU_IMG convert -O $IMGFMT -c -o compression_type=zstd \
> +                  "$TEST_IMG" "$COMPR_IMG"

Again, it would be nice to not discard the user-supplied options here,
and maybe it would also be nicer to explicitly pass the compression type
for the first convert, too.  So we’d use
  -o "$(_optstr_add "$IMGOPTS" "compression_type=zlib")"
for the first convert, and
  -o "$(_optstr_add "$IMGOPTS" "compression_type=zstd")"
for the second one.

Max


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

  parent reply	other threads:[~2020-04-27 13:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  8:11 [PATCH v20 0/4] qcow2: Implement zstd cluster compression methodi Denis Plotnikov
2020-04-21  8:11 ` [PATCH v20 1/4] qcow2: introduce compression type feature Denis Plotnikov
2020-04-21 10:40   ` Alberto Garcia
2020-04-27 12:35   ` Max Reitz
2020-04-21  8:11 ` [PATCH v20 2/4] qcow2: rework the cluster compression routine Denis Plotnikov
2020-04-27 12:36   ` Max Reitz
2020-04-21  8:11 ` [PATCH v20 3/4] qcow2: add zstd cluster compression Denis Plotnikov
2020-04-27 12:35   ` Max Reitz
2020-04-27 19:26     ` Denis Plotnikov
2020-04-28  6:16       ` Max Reitz
2020-04-28  7:23         ` Denis Plotnikov
2020-04-28 10:17           ` Max Reitz
2020-04-21  8:11 ` [PATCH v20 4/4] iotests: 287: add qcow2 compression type test Denis Plotnikov
2020-04-21 12:06   ` Vladimir Sementsov-Ogievskiy
2020-04-27 13:29   ` Max Reitz [this message]
2020-04-28 11:41     ` Denis Plotnikov
2020-04-28 12:55       ` Max Reitz
2020-04-28 13:01         ` Eric Blake
2020-04-28 13:34           ` Denis Plotnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0fdc097-dabd-4661-fce9-a63a24a8d792@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=den@openvz.org \
    --cc=dplotnikov@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).