[v5,5/6] iotests: Skip Python-based tests if QEMU does not support virtio-blk
diff mbox series

Message ID 20200121095205.26323-6-thuth@redhat.com
State New
Headers show
Series
  • Enable more iotests during "make check-block"
Related show

Commit Message

Thomas Huth Jan. 21, 2020, 9:52 a.m. UTC
We are going to enable some of the python-based tests in the "auto" group,
and these tests require virtio-blk to work properly. Running iotests
without virtio-blk likely does not make too much sense anyway, so instead
of adding a check for the availability of virtio-blk to each and every
test (which does not sound very appealing), let's rather add a check for
this a central spot in the "check" script instead (so that it is still
possible to run "make check" for qemu-system-tricore for example).

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qemu-iotests/check | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 30, 2020, 10:31 p.m. UTC | #1
On 1/21/20 10:52 AM, Thomas Huth wrote:
> We are going to enable some of the python-based tests in the "auto" group,
> and these tests require virtio-blk to work properly. Running iotests
> without virtio-blk likely does not make too much sense anyway, so instead
> of adding a check for the availability of virtio-blk to each and every
> test (which does not sound very appealing), let's rather add a check for
> this a central spot in the "check" script instead (so that it is still
> possible to run "make check" for qemu-system-tricore for example).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/qemu-iotests/check | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 2890785a10..1629b6c914 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -642,7 +642,15 @@ fi
>   python_usable=false
>   if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6) else 1)'
>   then
> -    python_usable=true
> +    # Our python framework also requires virtio-blk
> +    if "$QEMU_PROG" -M none -device help | grep -q virtio-blk >/dev/null 2>&1

FYI I proposed a patch adding a binary_get_devices() helper:
https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg07314.html

You could use something such

   @SkipUntil('virtio-blk' in binary_get_devices(qemu_bin))

> +    then
> +        python_usable=true
> +    else
> +        python_unusable_because="Missing virtio-blk in QEMU binary"
> +    fi
> +else
> +    python_unusable_because="Unsupported Python version"
>   fi
>   
>   default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
> @@ -830,7 +838,7 @@ do
>                   run_command="$PYTHON $seq"
>               else
>                   run_command="false"
> -                echo "Unsupported Python version" > $seq.notrun
> +                echo "$python_unusable_because" > $seq.notrun
>               fi
>           else
>               run_command="./$seq"
>
Thomas Huth Jan. 31, 2020, 7:08 a.m. UTC | #2
On 30/01/2020 23.31, Philippe Mathieu-Daudé wrote:
> On 1/21/20 10:52 AM, Thomas Huth wrote:
>> We are going to enable some of the python-based tests in the "auto"
>> group,
>> and these tests require virtio-blk to work properly. Running iotests
>> without virtio-blk likely does not make too much sense anyway, so instead
>> of adding a check for the availability of virtio-blk to each and every
>> test (which does not sound very appealing), let's rather add a check for
>> this a central spot in the "check" script instead (so that it is still
>> possible to run "make check" for qemu-system-tricore for example).
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   tests/qemu-iotests/check | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
>> index 2890785a10..1629b6c914 100755
>> --- a/tests/qemu-iotests/check
>> +++ b/tests/qemu-iotests/check
>> @@ -642,7 +642,15 @@ fi
>>   python_usable=false
>>   if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6)
>> else 1)'
>>   then
>> -    python_usable=true
>> +    # Our python framework also requires virtio-blk
>> +    if "$QEMU_PROG" -M none -device help | grep -q virtio-blk
>> >/dev/null 2>&1
> 
> FYI I proposed a patch adding a binary_get_devices() helper:
> https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg07314.html
> 
> You could use something such
> 
>   @SkipUntil('virtio-blk' in binary_get_devices(qemu_bin))

Unfortunately, that doesn't scale here. You'd have to add this to almost
all python-based iotests, since the virtio-blk dependency is hard-wired
deep in the code there (look at the add_drive function).

 Thomas
Philippe Mathieu-Daudé Jan. 31, 2020, 2:34 p.m. UTC | #3
On 1/31/20 8:08 AM, Thomas Huth wrote:
> On 30/01/2020 23.31, Philippe Mathieu-Daudé wrote:
>> On 1/21/20 10:52 AM, Thomas Huth wrote:
>>> We are going to enable some of the python-based tests in the "auto"
>>> group,
>>> and these tests require virtio-blk to work properly. Running iotests
>>> without virtio-blk likely does not make too much sense anyway, so instead
>>> of adding a check for the availability of virtio-blk to each and every
>>> test (which does not sound very appealing), let's rather add a check for
>>> this a central spot in the "check" script instead (so that it is still
>>> possible to run "make check" for qemu-system-tricore for example).
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>    tests/qemu-iotests/check | 12 ++++++++++--
>>>    1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
>>> index 2890785a10..1629b6c914 100755
>>> --- a/tests/qemu-iotests/check
>>> +++ b/tests/qemu-iotests/check
>>> @@ -642,7 +642,15 @@ fi
>>>    python_usable=false
>>>    if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6)
>>> else 1)'
>>>    then
>>> -    python_usable=true
>>> +    # Our python framework also requires virtio-blk
>>> +    if "$QEMU_PROG" -M none -device help | grep -q virtio-blk
>>>> /dev/null 2>&1
>>
>> FYI I proposed a patch adding a binary_get_devices() helper:
>> https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg07314.html
>>
>> You could use something such
>>
>>    @SkipUntil('virtio-blk' in binary_get_devices(qemu_bin))
> 
> Unfortunately, that doesn't scale here. You'd have to add this to almost
> all python-based iotests, since the virtio-blk dependency is hard-wired
> deep in the code there (look at the add_drive function).

I see.

Back to your patch:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Patch
diff mbox series

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 2890785a10..1629b6c914 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -642,7 +642,15 @@  fi
 python_usable=false
 if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6) else 1)'
 then
-    python_usable=true
+    # Our python framework also requires virtio-blk
+    if "$QEMU_PROG" -M none -device help | grep -q virtio-blk >/dev/null 2>&1
+    then
+        python_usable=true
+    else
+        python_unusable_because="Missing virtio-blk in QEMU binary"
+    fi
+else
+    python_unusable_because="Unsupported Python version"
 fi
 
 default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
@@ -830,7 +838,7 @@  do
                 run_command="$PYTHON $seq"
             else
                 run_command="false"
-                echo "Unsupported Python version" > $seq.notrun
+                echo "$python_unusable_because" > $seq.notrun
             fi
         else
             run_command="./$seq"