diff mbox series

[03/67] iotests.py: Add unsupported_imgopts

Message ID 20191001194715.2796-4-mreitz@redhat.com (mailing list archive)
State New, archived
Headers show
Series iotests: Honor $IMGOPTS in Python tests | expand

Commit Message

Max Reitz Oct. 1, 2019, 7:46 p.m. UTC
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/iotests.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

John Snow Oct. 1, 2019, 10:18 p.m. UTC | #1
On 10/1/19 3:46 PM, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index cdcb62c4ac..b5ea424de4 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -998,7 +998,8 @@ def execute_setup_common(supported_fmts=[],
>                           supported_cache_modes=[],
>                           unsupported_fmts=[],
>                           supported_protocols=[],
> -                         unsupported_protocols=[]):
> +                         unsupported_protocols=[],
> +                         unsupported_imgopts=[]):
>      """
>      Perform necessary setup for either script-style or unittest-style tests.
>      """
> @@ -1016,6 +1017,10 @@ def execute_setup_common(supported_fmts=[],
>      verify_platform(supported=supported_platforms)
>      verify_cache_mode(supported_cache_modes)
>  
> +    for opt in imgopts:
> +        if any(unsupported in opt for unsupported in unsupported_imgopts):

any() is cool and I don't use it as often as I should.

> +            notrun('not suitable for this option: %s' % opt)
> +
>      debug = '-d' in sys.argv
>      if debug:
>          sys.argv.remove('-d')
> 

Reviewed-by: John Snow <jsnow@redhat.com>
Vladimir Sementsov-Ogievskiy Oct. 3, 2019, 3:21 p.m. UTC | #2
01.10.2019 22:46, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/iotests.py | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index cdcb62c4ac..b5ea424de4 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -998,7 +998,8 @@ def execute_setup_common(supported_fmts=[],
>                            supported_cache_modes=[],
>                            unsupported_fmts=[],
>                            supported_protocols=[],
> -                         unsupported_protocols=[]):
> +                         unsupported_protocols=[],
> +                         unsupported_imgopts=[]):
>       """
>       Perform necessary setup for either script-style or unittest-style tests.
>       """
> @@ -1016,6 +1017,10 @@ def execute_setup_common(supported_fmts=[],
>       verify_platform(supported=supported_platforms)
>       verify_cache_mode(supported_cache_modes)
>   
> +    for opt in imgopts:
> +        if any(unsupported in opt for unsupported in unsupported_imgopts):
> +            notrun('not suitable for this option: %s' % opt)
> +

same suggestion

>       debug = '-d' in sys.argv
>       if debug:
>           sys.argv.remove('-d')
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index cdcb62c4ac..b5ea424de4 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -998,7 +998,8 @@  def execute_setup_common(supported_fmts=[],
                          supported_cache_modes=[],
                          unsupported_fmts=[],
                          supported_protocols=[],
-                         unsupported_protocols=[]):
+                         unsupported_protocols=[],
+                         unsupported_imgopts=[]):
     """
     Perform necessary setup for either script-style or unittest-style tests.
     """
@@ -1016,6 +1017,10 @@  def execute_setup_common(supported_fmts=[],
     verify_platform(supported=supported_platforms)
     verify_cache_mode(supported_cache_modes)
 
+    for opt in imgopts:
+        if any(unsupported in opt for unsupported in unsupported_imgopts):
+            notrun('not suitable for this option: %s' % opt)
+
     debug = '-d' in sys.argv
     if debug:
         sys.argv.remove('-d')