mirror of https://github.com/xemu-project/xemu.git
iotests: Cache supported_formats()
Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 20190917092004.999-8-mreitz@redhat.com Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
753b31b5f3
commit
767de537b1
|
@ -921,9 +921,17 @@ def qemu_pipe(*args):
|
||||||
def supported_formats(read_only=False):
|
def supported_formats(read_only=False):
|
||||||
'''Set 'read_only' to True to check ro-whitelist
|
'''Set 'read_only' to True to check ro-whitelist
|
||||||
Otherwise, rw-whitelist is checked'''
|
Otherwise, rw-whitelist is checked'''
|
||||||
format_message = qemu_pipe("-drive", "format=help")
|
|
||||||
line = 1 if read_only else 0
|
if not hasattr(supported_formats, "formats"):
|
||||||
return format_message.splitlines()[line].split(":")[1].split()
|
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):
|
def skip_if_unsupported(required_formats=[], read_only=False):
|
||||||
'''Skip Test Decorator
|
'''Skip Test Decorator
|
||||||
|
|
Loading…
Reference in New Issue