[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/69] iotests: Cache supported_formats()
From: |
Max Reitz |
Subject: |
[PULL 07/69] iotests: Cache supported_formats() |
Date: |
Mon, 28 Oct 2019 13:13:59 +0100 |
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Reviewed-by: Andrey Shinkevich <address@hidden>
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 936d33df61..a4a2238b42 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -921,9 +921,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
--
2.21.0
- [PULL 00/69] Block patches for softfreeze, Max Reitz, 2019/10/28
- [PULL 01/69] iotests: Prefer null-co over null-aio, Max Reitz, 2019/10/28
- [PULL 02/69] iotests: Allow skipping test cases, Max Reitz, 2019/10/28
- [PULL 04/69] iotests: Let skip_if_unsupported accept a function, Max Reitz, 2019/10/28
- [PULL 03/69] iotests: Use case_skip() in skip_if_unsupported(), Max Reitz, 2019/10/28
- [PULL 06/69] iotests: Test driver whitelisting in 136, Max Reitz, 2019/10/28
- [PULL 05/69] iotests: Test driver whitelisting in 093, Max Reitz, 2019/10/28
- [PULL 07/69] iotests: Cache supported_formats(),
Max Reitz <=
- [PULL 08/69] hbitmap: handle set/reset with zero length, Max Reitz, 2019/10/28
- [PULL 10/69] block/block-backend: add blk_co_pwritev_part, Max Reitz, 2019/10/28
- [PULL 09/69] block/mirror: simplify do_sync_target_write, Max Reitz, 2019/10/28
- [PULL 11/69] block/mirror: support unaligned write in active mirror, Max Reitz, 2019/10/28
- [PULL 12/69] Revert "mirror: Only mirror granularity-aligned chunks", Max Reitz, 2019/10/28
- [PULL 13/69] iotests: Introduce $SOCK_DIR, Max Reitz, 2019/10/28
- [PULL 14/69] iotests.py: Store socket files in $SOCK_DIR, Max Reitz, 2019/10/28
- [PULL 15/69] iotests.py: Add @base_dir to FilePaths etc., Max Reitz, 2019/10/28
- [PULL 16/69] iotests: Filter $SOCK_DIR, Max Reitz, 2019/10/28
- [PULL 17/69] iotests: Let common.nbd create socket in $SOCK_DIR, Max Reitz, 2019/10/28