qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD


From: Nir Soffer
Subject: Re: [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD
Date: Mon, 27 Jul 2020 17:44:22 +0300

On Mon, Jul 27, 2020 at 5:41 PM Eric Blake <eblake@redhat.com> wrote:
>
> On 7/27/20 9:35 AM, Nir Soffer wrote:
>
> >> I guess it's okay that you don't create a real tar file here, but
> >> listing the commands to create it (even as a comment) is better than
> >> just saying "trust me".  And it doesn't seem like that much more work -
> >> it looks like the key to your test is that you created a tar file
> >> containing two files, where the first file was less than 512 bytes and
> >> the second file is your target destination that you will be rewriting.
> >
> > The real code is more complicated, something like:
> >
> >      offset = tar.fileobj.tell() + BLOCK_SIZE
> >
> >      with open(tar.name, "r+") as f:
> >          f.truncate(offset + measure["required"])
> >
> >      convert_image(image, tar.name, offset)
> >
> >      check = check_image(tar.name, offset)
> >      size = check["image-end-offset"]
> >
> >      member = tarfile.TarInfo(name)
> >      member.size = size
> >      tar.addfile(member)
> >
> >      tar_size = offset + round_up(size)
> >
> >      tar.fileobj.seek(tar_size)
> >      with open(tar.name, "r+") as f:
> >          f.truncate(tar_size)
> >
> > I'm not sure it helps qemu developers working on these tests.
>
> The closer the iotest is to reality, the more likely it will serve as a
> good regression test.  Cutting corners risks a test that passes in
> isolation even when we've done something that breaks the overall process
> in one of the corners you cut.

I'll add this code then.

> >>
> >> At any rate, given the urgency of getting pull requests for -rc2 in
> >> before slamming Peter tomorrow, I'll probably try to touch up the issues
> >> Max pointed out and queue it today.
> >
> > Thanks Max and Eric.
> >
> > Should I post a fixed version later today?
>
> A v2 would be helpful.

Will post later today.




reply via email to

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