diff mbox series

[v7,11/21] iotests.py: execute_setup_common(): add required_fmts argument

Message ID 20201021145859.11201-12-vsementsov@virtuozzo.com
State Accepted
Commit 18654716455b295a8bc18863da988f5ed7db259f
Headers show
Series preallocate filter | expand

Commit Message

Vladimir Sementsov-Ogievskiy Oct. 21, 2020, 2:58 p.m. UTC
Add a parameter to skip test if some needed additional formats are not
supported (for example filter drivers).

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/iotests.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Max Reitz Nov. 13, 2020, 2:42 p.m. UTC | #1
On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:
> Add a parameter to skip test if some needed additional formats are not

> supported (for example filter drivers).

> 

> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---

>   tests/qemu-iotests/iotests.py | 9 ++++++++-

>   1 file changed, 8 insertions(+), 1 deletion(-)


Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 0e3d1d0ba3..274396b14e 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1109,6 +1109,11 @@  def _verify_aio_mode(supported_aio_modes: Sequence[str] = ()) -> None:
     if supported_aio_modes and (aiomode not in supported_aio_modes):
         notrun('not suitable for this aio mode: %s' % aiomode)
 
+def _verify_formats(required_formats: Sequence[str] = ()) -> None:
+    usf_list = list(set(required_formats) - set(supported_formats()))
+    if usf_list:
+        notrun(f'formats {usf_list} are not whitelisted')
+
 def supports_quorum():
     return 'quorum' in qemu_img_pipe('--help')
 
@@ -1266,7 +1271,8 @@  def execute_setup_common(supported_fmts: Sequence[str] = (),
                          supported_aio_modes: Sequence[str] = (),
                          unsupported_fmts: Sequence[str] = (),
                          supported_protocols: Sequence[str] = (),
-                         unsupported_protocols: Sequence[str] = ()) -> bool:
+                         unsupported_protocols: Sequence[str] = (),
+                         required_fmts: Sequence[str] = ()) -> bool:
     """
     Perform necessary setup for either script-style or unittest-style tests.
 
@@ -1292,6 +1298,7 @@  def execute_setup_common(supported_fmts: Sequence[str] = (),
     _verify_platform(supported=supported_platforms)
     _verify_cache_mode(supported_cache_modes)
     _verify_aio_mode(supported_aio_modes)
+    _verify_formats(required_fmts)
 
     return debug