[Top][All Lists]

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

Re: [Qemu-block] [Qemu-devel] [PATCH v4 1/4] iotests: add script_initial

From: John Snow
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v4 1/4] iotests: add script_initialize
Date: Mon, 16 Sep 2019 12:32:11 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 9/16/19 10:56 AM, Vladimir Sementsov-Ogievskiy wrote:
> 12.09.2019 3:16, 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.
>> Note: supported_oses=['linux'] was omitted, as it is a default argument.
> But after this patch all test which didn't check os start to check linux
> (as it's default).. So all tests which worked on other platforms will now
> be skipped on these other platforms?

def verify_platform(supported_oses=['linux']):
    if True not in [sys.platform.startswith(x) for x in supported_oses]:
        notrun('not suitable for this OS: %s' % sys.platform)

It was already the default. I didn't *make* it the default. There is no
change here. Feel free to propose a fix, but I don't think it's within
the scope of this series.

> Finally do we support something except linux for iotests?
> for bash tests _supported_os also used only with "Linux" in 87 tests..

Evidently, not really. See bc521696607c5348fcd8a9e57b408d0ac0dbe2f8

> May be we'd better drop both _supported_os and supported_oses alltogether,
> and don't care?

Beyond the scope of this series.

> Anyway, if we support only linux, any reason to skip almost all tests,
> if someone tries to run test on other platform? Let him run what he wants.

Maybe true, maybe not.

>> Signed-off-by: John Snow <address@hidden>
>> ---
> [..]
>> +def execute_test(test_function=None, *args, **kwargs):
>> +    """Run either unittest or script-style tests."""
>> +
>> +    debug = execute_setup_common(*args, **kwargs)
>>       if not test_function:
>> -        execute_unittest(output, verbosity, debug)
>> +        execute_unittest(debug)
>>       else:
>>           test_function()
>> +# This is called from script-style iotests without a single point of entry
>> +def script_initialize(*args, **kwargs):
>> +    """Initialize script-style tests without running any tests."""
>> +    execute_setup_common(*args, **kwargs)
>> +
>> +# This is called from script-style iotests with a single point of entry
>>   def script_main(test_function, *args, **kwargs):
>>       """Run script-style tests outside of the unittest framework"""
>>       execute_test(test_function, *args, **kwargs)
>> +# This is called from unittest style iotests
>>   def main(*args, **kwargs):
>>       """Run tests using the unittest framework"""
> Hmm, now two different styles of code documenting used: comment and 
> doc-string,
> both containing almost equal meaning.. I don't like it, still don't really 
> mind.

I think I was trying to document what the function /does/ separately
from a note about explaining how and where it is used. It's quite nearly
redundant and if it's distracting I can remove it.

reply via email to

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