[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/9] iotests: replace xrange() by range() for py
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH 5/9] iotests: replace xrange() by range() for python3 compatibility |
Date: |
Wed, 20 Dec 2017 10:06:19 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Tue, Dec 19, 2017 at 02:34:21PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> tests/qemu-iotests/044 | 14 +++++++-------
> tests/qemu-iotests/163 | 2 +-
> 2 files changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Daniel P. Berrange <address@hidden>
>
> diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044
> index 11ea0f4d35..1e96800176 100755
> --- a/tests/qemu-iotests/044
> +++ b/tests/qemu-iotests/044
> @@ -52,23 +52,23 @@ class TestRefcountTableGrowth(iotests.QMPTestCase):
> # Write a refcount table
> fd.seek(off_reftable)
>
> - for i in xrange(0, h.refcount_table_clusters):
> + for i in range(0, h.refcount_table_clusters):
> sector = ''.join(struct.pack('>Q',
> off_refblock + i * 64 * 512 + j * 512)
> - for j in xrange(0, 64))
> + for j in range(0, 64))
> fd.write(sector)
>
> # Write the refcount blocks
> assert(fd.tell() == off_refblock)
> - sector = ''.join(struct.pack('>H', 1) for j in xrange(0, 64 *
> 256))
> - for block in xrange(0, h.refcount_table_clusters):
> + sector = ''.join(struct.pack('>H', 1) for j in range(0, 64 *
> 256))
> + for block in range(0, h.refcount_table_clusters):
> fd.write(sector)
>
> # Write the L1 table
> assert(fd.tell() == off_l1)
> assert(off_l2 + 512 * h.l1_size == off_data)
> table = ''.join(struct.pack('>Q', (1 << 63) | off_l2 + 512 * j)
> - for j in xrange(0, h.l1_size))
> + for j in range(0, h.l1_size))
> fd.write(table)
>
> # Write the L2 tables
> @@ -79,14 +79,14 @@ class TestRefcountTableGrowth(iotests.QMPTestCase):
> off = off_data
> while remaining > 1024 * 512:
> pytable = list((1 << 63) | off + 512 * j
> - for j in xrange(0, 1024))
> + for j in range(0, 1024))
> table = struct.pack('>1024Q', *pytable)
> fd.write(table)
> remaining = remaining - 1024 * 512
> off = off + 1024 * 512
>
> table = ''.join(struct.pack('>Q', (1 << 63) | off + 512 * j)
> - for j in xrange(0, remaining / 512))
> + for j in range(0, remaining / 512))
> fd.write(table)
>
>
> diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
> index 403842354e..fb0d0257ec 100644
> --- a/tests/qemu-iotests/163
> +++ b/tests/qemu-iotests/163
> @@ -41,7 +41,7 @@ class ShrinkBaseClass(iotests.QMPTestCase):
> div_roundup = lambda n, d: (n + d - 1) / d
>
> def split_by_n(data, n):
> - for x in xrange(0, len(data), n):
> + for x in range(0, len(data), n):
> yield struct.unpack('>Q', data[x:x + n])[0] & l1_mask
>
> def check_l1_table(h, l1_data):
> --
> 2.15.1
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [Qemu-devel] [PATCH 0/9] iotests: python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 1/9] qemu.py: replace iteritems() by items() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 2/9] qmp.py: encode JSON unicode as byte strings for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 3/9] iotests: replace print statement by print() function for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 4/9] iotests: use octal numbers for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 5/9] iotests: replace xrange() by range() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- Re: [Qemu-devel] [PATCH 5/9] iotests: replace xrange() by range() for python3 compatibility,
Daniel P. Berrange <=
- [Qemu-devel] [PATCH 6/9] iotests: replace dict.has_key() by 'in' operator for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 7/9] iotests: replace lambda function by lambda expression for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 8/9] iotests: replace assertEquals() by assertEqual() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-devel] [PATCH 9/9] iotests.py: use io.StringIO with python3, Philippe Mathieu-Daudé, 2017/12/19
- Re: [Qemu-devel] [PATCH 0/9] iotests: python3 compatibility, Paolo Bonzini, 2017/12/19