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

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

Commit Message

Thomas Huth Dec. 2, 2019, 10:10 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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Max Reitz Jan. 20, 2020, 2:50 p.m. UTC | #1
On 02.12.19 11:10, 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 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 90970b0549..bce3035d5a 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -642,7 +642,11 @@ 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
> +    fi
>  fi
>  
>  default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
> @@ -830,7 +834,7 @@ do
>                  run_command="$PYTHON $seq"
>              else
>                  run_command="false"
> -                echo "Unsupported Python version" > $seq.notrun
> +                echo "Unsupported Python version or missing virtio-blk" > $seq.notrun

A $python_unusable_because might be helpful (set in to-be-added else
branches for the ifs that set python_usable to true), but either way:

Reviewed-by: Max Reitz <mreitz@redhat.com>

>              fi
>          else
>              run_command="./$seq"
>
Thomas Huth Jan. 20, 2020, 4:05 p.m. UTC | #2
On 20/01/2020 15.50, Max Reitz wrote:
> On 02.12.19 11:10, 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 | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
>> index 90970b0549..bce3035d5a 100755
>> --- a/tests/qemu-iotests/check
>> +++ b/tests/qemu-iotests/check
>> @@ -642,7 +642,11 @@ 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
>> +    fi
>>  fi
>>  
>>  default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
>> @@ -830,7 +834,7 @@ do
>>                  run_command="$PYTHON $seq"
>>              else
>>                  run_command="false"
>> -                echo "Unsupported Python version" > $seq.notrun
>> +                echo "Unsupported Python version or missing virtio-blk" > $seq.notrun
> 
> A $python_unusable_because might be helpful (set in to-be-added else
> branches for the ifs that set python_usable to true), but either way:

Sounds like a good idea, I'll give it a try and send a v5.

 Thanks,
  Thomas

Patch
diff mbox series

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 90970b0549..bce3035d5a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -642,7 +642,11 @@  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
+    fi
 fi
 
 default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
@@ -830,7 +834,7 @@  do
                 run_command="$PYTHON $seq"
             else
                 run_command="false"
-                echo "Unsupported Python version" > $seq.notrun
+                echo "Unsupported Python version or missing virtio-blk" > $seq.notrun
             fi
         else
             run_command="./$seq"