[Top][All Lists]

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

Re: [PATCH v14 4/4] iotests: 287: add qcow2 compression type test

From: Eric Blake
Subject: Re: [PATCH v14 4/4] iotests: 287: add qcow2 compression type test
Date: Tue, 31 Mar 2020 13:58:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 3/31/20 1:43 PM, Eric Blake wrote:

Is it also worth trying to generate an image with (pseudo-)random contents, and trying qemu-img convert to prove that uncompressable clusters are handled sanely?  Ideally, there would be a way to use a fixed PRNG and seed that produces a deterministic sequence that cannot be compressed, but even if we can't meet the ideal, having a test that non-deterministically is likely to generate an uncompressable cluster in most runs is better than nothing (such as 1M of data copied from /dev/urandom, then qemu-img convert on that data).

For an example,

nbdkit -U - random 1M seed=1234 --run 'qemu-img convert $nbd file'

produces 'file' containing deterministic pseudo-random data. And 'zstd file' proves that the data was non-compressible in bulk:
$ zstd file
file                  :100.00%   (1048576 => 1048613 bytes, file.zst)

In fact, inspecting od output, I can see that the first few bytes of the original file are replayed verbatim after a 12-byte header in the .zst file.

But we don't have any other uses of nbdkit in our iotests, so I'm not sure if making this the first test to depend on that is ideal.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

reply via email to

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