[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 3/4] iotests: Test driver whitelisting in 093
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH 3/4] iotests: Test driver whitelisting in 093 |
Date: |
Fri, 17 May 2019 13:44:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 17.05.19 13:00, Kevin Wolf wrote:
> Am 17.05.2019 um 11:56 hat Max Reitz geschrieben:
>> null-aio may not be whitelisted. If it is not, fall back to null-co.
>> This may run tests twice in the same configuration, but this is the
>> simplest way to effectively skip the tests in setUp() (without changing
>> the output, and while having the respective driver in a class
>> attribute).
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> tests/qemu-iotests/093 | 15 ++++++++++++---
>> 1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
>> index bd56c94708..d6f285001a 100755
>> --- a/tests/qemu-iotests/093
>> +++ b/tests/qemu-iotests/093
>> @@ -22,9 +22,11 @@
>> import iotests
>>
>> nsec_per_sec = 1000000000
>> +supported_null_drivers = list(filter(lambda f: f.startswith('null-'),
>> + iotests.supported_formats()))
>
> Is this just a convoluted way of writing the following?
>
> supported_null_drivers = [ f for f in iotests.supported_formats()
> if f.startswith('null-') ]
Well, it’s a different way, yes. I would call it the Ruby way, but that
would have been "iotests.supported_formats() & ['null-co', 'null-aio']".
(And with list(set() & set()) it suddenly isn’t short anymore.)
Sorry, I’m just not suited for Python.
>> class ThrottleTestCase(iotests.QMPTestCase):
>> - test_img = "null-aio://"
>> + test_driver = "null-aio"
>> max_drives = 3
>>
>> def blockstats(self, device):
>> @@ -36,9 +38,14 @@ class ThrottleTestCase(iotests.QMPTestCase):
>> raise Exception("Device not found for blockstats: %s" % device)
>>
>> def setUp(self):
>> + global supported_null_drivers
>> + if self.test_driver not in supported_null_drivers:
>> + # Silently fall back to supported driver
>> + self.test_driver = supported_null_drivers[0]
>
> I think this is what you mentioned in the cover letter:
>
>> Final note: The best thing would probably to skip the null-aio tests in
>> 093/136 if there is no null-aio support. However, I didn’t get anything
>> to work: Annotating with @iotests.skip_if_unsupported() didn’t work
>> because the format name is a class instance attribute; and just
>> iotests.skipTest() didn’t work because that would print 's' characters
>> instead of '.' in the output (and emit the number of skipped tests), so
>> the comparison against the reference output fails...
>
> With a little modification to the @skip_if_unsupported() decorator it
> can be done. I think I'd prefer this (hacked up on top of this series):
Hm. I really don’t like having to put it above every single test
method, and putting it above setUp() has the problem of not actually
skipping the test.
I guess I’ll look back into filtering the test output to remove the
“skipped” stuff.
Max
signature.asc
Description: OpenPGP digital signature