On 2018-04-26 18:19, Roman Kagan wrote: > Add helper functions to query the block drivers actually supported by > QEMU using "-drive format=?". This allows to skip certain tests that > require drivers not built in or whitelisted in QEMU. > > Signed-off-by: Roman Kagan <rka...@virtuozzo.com> > --- > tests/qemu-iotests/common.rc | 19 +++++++++++++++++++ > tests/qemu-iotests/iotests.py | 30 +++++++++++++++++++++++++++--- > 2 files changed, 46 insertions(+), 3 deletions(-)
[...] > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index e2abf0cb53..698ef2b2c0 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py [...] > @@ -550,13 +561,26 @@ def verify_cache_mode(supported_cache_modes=[]): > if supported_cache_modes and (cachemode not in supported_cache_modes): > notrun('not suitable for this cache mode: %s' % cachemode) > > +rw_formats = None > + > +def supports_format(format_name): > + format_message = qemu_pipe('-drive', 'format=?') > + global rw_formats > + if rw_formats is None: > + rw_formats = format_message.splitlines()[0].split(':')[1].split() Isn't it sufficient to call qemu_pipe() only if rw_formats is None? The rest looks good. Max > + return format_name in rw_formats > + > +def require_formats(*formats): > + for fmt in formats: > + if not supports_format(fmt): > + notrun('%s does not support format %s' % (qemu_prog, fmt)) > + > def supports_quorum(): > - return 'quorum' in qemu_img_pipe('--help') > + return supports_format('quorum') > > def verify_quorum(): > '''Skip test suite if quorum support is not available''' > - if not supports_quorum(): > - notrun('quorum support missing') > + require_formats('quorum') > > def main(supported_fmts=[], supported_oses=['linux'], > supported_cache_modes=[], > unsupported_fmts=[]): >
signature.asc
Description: OpenPGP digital signature