[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v11 3/3] qemu-img info: bitmaps extension new te
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v11 3/3] qemu-img info: bitmaps extension new test 239 |
Date: |
Fri, 1 Feb 2019 18:34:01 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Am 01.02.2019 um 18:23 hat Eric Blake geschrieben:
> On 1/31/19 7:46 AM, Andrey Shinkevich wrote:
> > A new test file 239 added to the qemu-iotests set. It checks
> > the output format of 'qemu-img info' for bitmaps extension of
> > qcow2 specific information.
> >
> > Signed-off-by: Andrey Shinkevich <address@hidden>
> > ---
> > tests/qemu-iotests/239 | 74 ++++++++++++++++++++++++++
> > tests/qemu-iotests/239.out | 130
> > +++++++++++++++++++++++++++++++++++++++++++++
> > tests/qemu-iotests/group | 1 +
> > 3 files changed, 205 insertions(+)
> > create mode 100755 tests/qemu-iotests/239
> > create mode 100644 tests/qemu-iotests/239.out
>
> Kevin just sent a pull request with 239 consumed for something else (a
> test for dmg; also consumed 240); I don't mind renumbering the test as
> 242 or later as part of staging if we are happy with this version of the
> test. But I also see that Vladimir had some suggestions, so I wouldn't
> be surprised if you want to send a v12.
>
> >
> > diff --git a/tests/qemu-iotests/239 b/tests/qemu-iotests/239
> > new file mode 100755
> > index 0000000..bee7943
> > --- /dev/null
> > +++ b/tests/qemu-iotests/239
> > @@ -0,0 +1,74 @@
> > +#!/usr/bin/env python
> > +#
> > +# Test for qcow2 bitmap printed information
> > +#
> > +# Copyright (c) 2018 Virtuozzo International GmbH
>
> Want to claim 2019?
>
>
> > +def add_bitmap(bitmap_number, persistent, disabled):
> > + granularity = 2**(13 + bitmap_number)
> > + bitmap_name = 'bitmap-' + str(bitmap_number-1)
> > + vm = iotests.VM().add_drive(disk)
> > + vm.launch()
> > + vm.qmp_log('block-dirty-bitmap-add', node='drive0', name=bitmap_name,
> > + granularity=granularity, persistent=persistent,
> > + disabled=disabled)
> > + vm.shutdown()
> > +
> > +def write_to_disk(offset, size):
> > + write = 'write {} {}K'.format(offset, size)
> > + qemu_io('-f', iotests.imgfmt, '-c', write, disk)
> > + log('Write ' + str(size) + 'K to disk at offset ' + str(hex(offset)))
> > +
> > +
> > +qemu_img_create('-f', iotests.imgfmt, disk, '1M')
> > +
> > +for num in range(1, 4):
> > + disabled = False
> > + if num == 2:
> > + disabled = True
> > + add_bitmap(num, bool(num-1), disabled)
>
> I don't know the pythonic way of coercing a bool value out of a check
> for whether another value is a particular integer; but I see that you
> did it in two different styles. I don't know if this works, but it
> would at least look more consistent:
>
> add_bitmap(num, bool(num == 1), bool(num == 2))
Hm...
>>> num = 0
>>> type(num == 2)
<class 'bool'>
Why all the bool() calls when the result of == is already a bool?
Kevin
signature.asc
Description: PGP signature