[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v4 7/7] iotests: Cache supported_formats()
From: |
Andrey Shinkevich |
Subject: |
Re: [Qemu-block] [PATCH v4 7/7] iotests: Cache supported_formats() |
Date: |
Tue, 17 Sep 2019 15:50:36 +0000 |
On 17/09/2019 12:20, Max Reitz wrote:
> Signed-off-by: Max Reitz <address@hidden>
> Reviewed-by: John Snow <address@hidden>
> ---
> tests/qemu-iotests/iotests.py | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index a42702b6b9..b30044e1cc 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -885,9 +885,17 @@ def qemu_pipe(*args):
> def supported_formats(read_only=False):
> '''Set 'read_only' to True to check ro-whitelist
> Otherwise, rw-whitelist is checked'''
> - format_message = qemu_pipe("-drive", "format=help")
> - line = 1 if read_only else 0
> - return format_message.splitlines()[line].split(":")[1].split()
> +
> + if not hasattr(supported_formats, "formats"):
> + supported_formats.formats = {}
> +
> + if read_only not in supported_formats.formats:
> + format_message = qemu_pipe("-drive", "format=help")
> + line = 1 if read_only else 0
> + supported_formats.formats[read_only] = \
> + format_message.splitlines()[line].split(":")[1].split()
> +
> + return supported_formats.formats[read_only]
>
> def skip_if_unsupported(required_formats=[], read_only=False):
> '''Skip Test Decorator
>
Reviewed-by: Andrey Shinkevich <address@hidden>
--
With the best regards,
Andrey Shinkevich