aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2018-04-09 14:44:17 +0300
committerKevin Wolf <kwolf@redhat.com>2018-04-10 16:33:08 +0200
commitf48351d2f3dd94aa499f4197ae37a059559506bf (patch)
tree4e9547ba1967319375dcfd9530937552f21b556e /tests/qemu-iotests/iotests.py
parent07c13a71721d9f8c690b66752964e254af247475 (diff)
iotests.py: improve verify_image_format helper
Support "generic" formats like in bash tests with their _supported_fmt generic The test, supporting "generic" formats will run if IMGFMT_GENERIC = true, which is default, except for bochs and cloop. However, you can use verify_image_format(['generic', 'bochs']), which will run for all except cloop (for this moment). Also, add an assert (we don't want set both arguments) and remove duplication. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 1623257e32..97131b1f86 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -532,9 +532,17 @@ def notrun(reason):
sys.exit(0)
def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
- if supported_fmts and (imgfmt not in supported_fmts):
- notrun('not suitable for this image format: %s' % imgfmt)
- if unsupported_fmts and (imgfmt in unsupported_fmts):
+ assert not (supported_fmts and unsupported_fmts)
+
+ if 'generic' in supported_fmts and \
+ os.environ.get('IMGFMT_GENERIC', 'true') == 'true':
+ # similar to
+ # _supported_fmt generic
+ # for bash tests
+ return
+
+ not_sup = supported_fmts and (imgfmt not in supported_fmts)
+ if not_sup or (imgfmt in unsupported_fmts):
notrun('not suitable for this image format: %s' % imgfmt)
def verify_platform(supported_oses=['linux']):