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 <andrey.shinkev...@virtuozzo.com> > --- > 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)) > + write_to_disk((num-1)*chunk, chunk) Does PEP8 want spaces around those operators? > + print_bitmap() > + log('') > + > +vm = iotests.VM().add_drive(disk) > +vm.launch() > +log('Checking \"in-use\" flag...') > +print_bitmap() > +vm.shutdown() The test output looks like reasonable coverage. Tested-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature