qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 2/9] iotests: add script_initialize


From: John Snow
Subject: Re: [PATCH v6 2/9] iotests: add script_initialize
Date: Tue, 3 Mar 2020 16:12:50 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1


On 2/27/20 8:47 AM, Max Reitz wrote:
> On 27.02.20 01:06, John Snow wrote:
>> Like script_main, but doesn't require a single point of entry.
>> Replace all existing initialization sections with this drop-in replacement.
>>
>> This brings debug support to all existing script-style iotests.
>>
>> Signed-off-by: John Snow <address@hidden>
>> ---
>>  tests/qemu-iotests/149        |  3 +-
>>  tests/qemu-iotests/194        |  4 +-
>>  tests/qemu-iotests/202        |  4 +-
>>  tests/qemu-iotests/203        |  4 +-
>>  tests/qemu-iotests/206        |  2 +-
>>  tests/qemu-iotests/207        |  6 ++-
>>  tests/qemu-iotests/208        |  2 +-
>>  tests/qemu-iotests/209        |  2 +-
>>  tests/qemu-iotests/210        |  6 ++-
>>  tests/qemu-iotests/211        |  6 ++-
>>  tests/qemu-iotests/212        |  6 ++-
>>  tests/qemu-iotests/213        |  6 ++-
>>  tests/qemu-iotests/216        |  4 +-
>>  tests/qemu-iotests/218        |  2 +-
>>  tests/qemu-iotests/219        |  2 +-
>>  tests/qemu-iotests/222        |  7 ++--
>>  tests/qemu-iotests/224        |  4 +-
>>  tests/qemu-iotests/228        |  6 ++-
>>  tests/qemu-iotests/234        |  4 +-
>>  tests/qemu-iotests/235        |  4 +-
>>  tests/qemu-iotests/236        |  2 +-
>>  tests/qemu-iotests/237        |  2 +-
>>  tests/qemu-iotests/238        |  2 +
>>  tests/qemu-iotests/242        |  2 +-
>>  tests/qemu-iotests/246        |  2 +-
>>  tests/qemu-iotests/248        |  2 +-
>>  tests/qemu-iotests/254        |  2 +-
>>  tests/qemu-iotests/255        |  2 +-
>>  tests/qemu-iotests/256        |  2 +-
>>  tests/qemu-iotests/258        |  7 ++--
>>  tests/qemu-iotests/260        |  4 +-
>>  tests/qemu-iotests/262        |  4 +-
>>  tests/qemu-iotests/264        |  4 +-
>>  tests/qemu-iotests/277        |  2 +
>>  tests/qemu-iotests/280        |  8 ++--
>>  tests/qemu-iotests/283        |  4 +-
>>  tests/qemu-iotests/iotests.py | 73 +++++++++++++++++++++++------------
>>  37 files changed, 128 insertions(+), 80 deletions(-)
> 
> Reviewed-by: Max Reitz <address@hidden>
> 
> [...]
> 
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index e8a0ea14fc..fdcf8a940c 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
> 
> [...]
> 
>> @@ -1092,13 +1105,18 @@ def execute_unittest(output, verbosity, debug):
>>  
>>              sys.stderr.write(out)
>>  
>> -def execute_test(test_function=None,
>> -                 supported_fmts=[],
>> -                 supported_platforms=None,
>> -                 supported_cache_modes=[], supported_aio_modes={},
>> -                 unsupported_fmts=[], supported_protocols=[],
>> -                 unsupported_protocols=[]):
>> -    """Run either unittest or script-style tests."""
>> +def execute_setup_common(supported_fmts: Collection[str] = (),
> 
> First time I see something like this, but I suppose it means any
> collection (i.e. list or tuple in this case) that has str values?
> 
> Max
> 

Yes. Testing the waters for idiomatic type annotations. We chose our
python version to allow us to use them, so I'm pushing on that boundary.

A Collection in this case is a Python ABC that collects the Sized,
Iterable and Container ABCs.

Roughly:
Sized: provides __len__          (len(x))
Iterable: provides __iter__      ("for x in y")
Container: provides __contains__ ("if 'x' in y")

In this case, we want Iterable (to enumerate the atoms) and Sized (to
provide truth-testing that returns False when the collection has a size
of zero.) "Collection" is the nearest available type that describes all
of the desired types of duck, without becoming overly specific for
features of the type we are not using.

More information:
https://docs.python.org/3.6/library/collections.abc.html#module-collections.abc

>> +                         supported_platforms: Collection[str] = (),
>> +                         supported_cache_modes: Collection[str] = (),
>> +                         supported_aio_modes: Collection[str] = (),
>> +                         unsupported_fmts: Collection[str] = (),
>> +                         supported_protocols: Collection[str] = (),
>> +                         unsupported_protocols: Collection[str] = ()) -> 
>> bool:
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]