qemu-devel
[Top][All Lists]
Advanced

[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: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v11 3/3] qemu-img info: bitmaps extension new test 239
Date: Fri, 1 Feb 2019 11:23:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

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))

> +    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 <address@hidden>

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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