[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 8/8] iotests: Cache supported_formats()
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH v3 8/8] iotests: Cache supported_formats() |
Date: |
Tue, 20 Aug 2019 17:10:10 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Any particular reason? I guess an "itch."
On 8/19/19 4:18 PM, Max Reitz wrote:
> Signed-off-by: Max Reitz <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 8f315538e9..f6492b355f 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -884,9 +884,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()
> +
Seems a little odd to use a boolean as a dict key, but I guess it works
and is fine.
> + return supported_formats.formats[read_only]
>
> def skip_if_unsupported(required_formats=[], read_only=False):
> '''Skip Test Decorator
>
Eh, why not.
Reviewed-by: John Snow <address@hidden>
- Re: [Qemu-devel] [PATCH v3 2/8] iotests: Prefer null-co over null-aio, (continued)
- [Qemu-devel] [PATCH v3 3/8] iotests: Allow skipping test cases, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v3 4/8] iotests: Use case_skip() in skip_if_unsupported(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v3 5/8] iotests: Let skip_if_unsupported() accept a method, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v3 6/8] iotests: Test driver whitelisting in 093, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v3 7/8] iotests: Test driver whitelisting in 136, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v3 8/8] iotests: Cache supported_formats(), Max Reitz, 2019/08/19
- Re: [Qemu-devel] [PATCH v3 8/8] iotests: Cache supported_formats(),
John Snow <=