[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 17/18] iotests: add test 257 for bitmap-mode
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH v4 17/18] iotests: add test 257 for bitmap-mode backups |
Date: |
Wed, 10 Jul 2019 21:51:13 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
On 7/9/19 7:25 PM, John Snow wrote:
> Signed-off-by: John Snow <address@hidden>
> ---
> tests/qemu-iotests/257 | 416 +++++++
> tests/qemu-iotests/257.out | 2247 ++++++++++++++++++++++++++++++++++++
> tests/qemu-iotests/group | 1 +
> 3 files changed, 2664 insertions(+)
> create mode 100755 tests/qemu-iotests/257
> create mode 100644 tests/qemu-iotests/257.out
>
> diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257
> new file mode 100755
> index 0000000000..75a651c7c3
> --- /dev/null
> +++ b/tests/qemu-iotests/257
> @@ -0,0 +1,416 @@
> +#!/usr/bin/env python
> +#
> +# Test bitmap-sync backups (incremental, differential, and partials)
> +#
> +# Copyright (c) 2019 John Snow for Red Hat, Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +# owner=address@hidden
> +
> +from collections import namedtuple
> +import math
> +import os
> +
> +import iotests
> +from iotests import log, qemu_img
> +
> +SIZE = 64 * 1024 * 1024
> +GRANULARITY = 64 * 1024
> +
> +Pattern = namedtuple('Pattern', ['byte', 'offset', 'size'])
> +def mkpattern(byte, offset, size=GRANULARITY):
> + """Constructor for Pattern() with default size"""
> + return Pattern(byte, offset, size)
> +
> +class PatternGroup:
> + """Grouping of Pattern objects. Initialize with an iterable of
> Patterns."""
> + def __init__(self, patterns):
> + self.patterns = patterns
> +
> + def bits(self, granularity):
> + """Calculate the unique bits dirtied by this pattern grouping"""
> + res = set()
> + for pattern in self.patterns:
> + lower = math.floor(pattern.offset / granularity)
> + upper = math.floor((pattern.offset + pattern.size - 1) /
> granularity)
> + res = res | set(range(lower, upper + 1))
> + return res
> +
Squashing in:
- lower = math.floor(pattern.offset / granularity)
- upper = math.floor((pattern.offset + pattern.size - 1) /
granularity)
+ lower = pattern.offset // granularity
+ upper = (pattern.offset + pattern.size - 1) // granularity
To quiet the Python2 beast.
--js
- [Qemu-devel] [PATCH v4 15/18] iotests: teach FilePath to produce multiple paths, (continued)
- [Qemu-devel] [PATCH v4 15/18] iotests: teach FilePath to produce multiple paths, John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 16/18] iotests: Add virtio-scsi device helper, John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 11/18] block/backup: upgrade copy_bitmap to BdrvDirtyBitmap, John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 05/18] block/backup: Add mirror sync mode 'bitmap', John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 09/18] block/dirty-bitmap: add bdrv_dirty_bitmap_merge_internal, John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 18/18] block/backup: loosen restriction on readonly bitmaps, John Snow, 2019/07/09
- [Qemu-devel] [PATCH v4 17/18] iotests: add test 257 for bitmap-mode backups, John Snow, 2019/07/09
- Re: [Qemu-devel] [PATCH v4 00/18] bitmaps: introduce 'bitmap' sync mode, Max Reitz, 2019/07/10
- Re: [Qemu-devel] [PATCH v4 00/18] bitmaps: introduce 'bitmap' sync mode, John Snow, 2019/07/15
- Re: [Qemu-devel] [PATCH v4 00/18] bitmaps: introduce 'bitmap' sync mode, Fabian Grünbichler, 2019/07/22