diff mbox series

[RFC] tests/avocado: probe for multi-process support before running test

Message ID 20230321111752.2681128-1-alex.bennee@linaro.org
State New
Headers show
Series [RFC] tests/avocado: probe for multi-process support before running test | expand

Commit Message

Alex Bennée March 21, 2023, 11:17 a.m. UTC
A recent attempt to let avocado run more tests on the CentOS stream
build failed because there was no gating on the multiprocess feature.
Like missing accelerators avocado should gracefully skip when the
feature is not enabled.

In this case we use the existence of the proxy device as a proxy for
multi-process support.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Cc: Jagannathan Raman <jag.raman@oracle.com>
Cc: John G Johnson <john.g.johnson@oracle.com>
---
 tests/avocado/avocado_qemu/__init__.py | 10 ++++++++++
 tests/avocado/multiprocess.py          |  1 +
 2 files changed, 11 insertions(+)

Comments

Philippe Mathieu-Daudé March 21, 2023, 1:38 p.m. UTC | #1
On 21/3/23 12:17, Alex Bennée wrote:
> A recent attempt to let avocado run more tests on the CentOS stream
> build failed because there was no gating on the multiprocess feature.
> Like missing accelerators avocado should gracefully skip when the
> feature is not enabled.
> 
> In this case we use the existence of the proxy device as a proxy for
> multi-process support.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
> Cc: Jagannathan Raman <jag.raman@oracle.com>
> Cc: John G Johnson <john.g.johnson@oracle.com>
> ---
>   tests/avocado/avocado_qemu/__init__.py | 10 ++++++++++
>   tests/avocado/multiprocess.py          |  1 +
>   2 files changed, 11 insertions(+)


> +        """
> +        Test for the presence of the x-pci-proxy-dev which is required
> +        to support multiprocess.
> +        """
> +        devhelp = run_cmd([self.qemu_bin,
> +                           '-M', 'none', '-device', 'help'])[0];
> +        if devhelp.find('x-pci-proxy-dev') < 0:
> +            self.cancel('no support for multiprocess device emulation')

FYI a more generic alternative to this method:
https://lore.kernel.org/qemu-devel/20200129212345.20547-14-philmd@redhat.com/

But yours just works :)
Alex Bennée March 21, 2023, 6:19 p.m. UTC | #2
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 21/3/23 12:17, Alex Bennée wrote:
>> A recent attempt to let avocado run more tests on the CentOS stream
>> build failed because there was no gating on the multiprocess feature.
>> Like missing accelerators avocado should gracefully skip when the
>> feature is not enabled.
>> In this case we use the existence of the proxy device as a proxy for
>> multi-process support.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
>> Cc: Jagannathan Raman <jag.raman@oracle.com>
>> Cc: John G Johnson <john.g.johnson@oracle.com>
>> ---
>>   tests/avocado/avocado_qemu/__init__.py | 10 ++++++++++
>>   tests/avocado/multiprocess.py          |  1 +
>>   2 files changed, 11 insertions(+)
>
>
>> +        """
>> +        Test for the presence of the x-pci-proxy-dev which is required
>> +        to support multiprocess.
>> +        """
>> +        devhelp = run_cmd([self.qemu_bin,
>> +                           '-M', 'none', '-device', 'help'])[0];
>> +        if devhelp.find('x-pci-proxy-dev') < 0:
>> +            self.cancel('no support for multiprocess device emulation')
>
> FYI a more generic alternative to this method:
> https://lore.kernel.org/qemu-devel/20200129212345.20547-14-philmd@redhat.com/
>
> But yours just works :)

For now I want to keep it simple. We should replace it with yours once
we get a chance. Are you happy for a r-b?
Philippe Mathieu-Daudé March 22, 2023, 8:40 a.m. UTC | #3
On 21/3/23 19:19, Alex Bennée wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>> On 21/3/23 12:17, Alex Bennée wrote:
>>> A recent attempt to let avocado run more tests on the CentOS stream
>>> build failed because there was no gating on the multiprocess feature.
>>> Like missing accelerators avocado should gracefully skip when the
>>> feature is not enabled.
>>> In this case we use the existence of the proxy device as a proxy for
>>> multi-process support.
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
>>> Cc: Jagannathan Raman <jag.raman@oracle.com>
>>> Cc: John G Johnson <john.g.johnson@oracle.com>
>>> ---
>>>    tests/avocado/avocado_qemu/__init__.py | 10 ++++++++++
>>>    tests/avocado/multiprocess.py          |  1 +
>>>    2 files changed, 11 insertions(+)

>>> +        """
>>> +        Test for the presence of the x-pci-proxy-dev which is required
>>> +        to support multiprocess.
>>> +        """
>>> +        devhelp = run_cmd([self.qemu_bin,
>>> +                           '-M', 'none', '-device', 'help'])[0];
>>> +        if devhelp.find('x-pci-proxy-dev') < 0:
>>> +            self.cancel('no support for multiprocess device emulation')
>>
>> FYI a more generic alternative to this method:
>> https://lore.kernel.org/qemu-devel/20200129212345.20547-14-philmd@redhat.com/
>>
>> But yours just works :)
> 
> For now I want to keep it simple. We should replace it with yours once
> we get a chance. Are you happy for a r-b?

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index a313e88c07..cb71f50db9 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -309,6 +309,16 @@  def require_netdev(self, netdevname):
         if netdevhelp.find('\n' + netdevname + '\n') < 0:
             self.cancel('no support for user networking')
 
+    def require_multiprocess(self):
+        """
+        Test for the presence of the x-pci-proxy-dev which is required
+        to support multiprocess.
+        """
+        devhelp = run_cmd([self.qemu_bin,
+                           '-M', 'none', '-device', 'help'])[0];
+        if devhelp.find('x-pci-proxy-dev') < 0:
+            self.cancel('no support for multiprocess device emulation')
+
     def _new_vm(self, name, *args):
         self._sd = tempfile.TemporaryDirectory(prefix="qemu_")
         vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
diff --git a/tests/avocado/multiprocess.py b/tests/avocado/multiprocess.py
index 80a3b8f442..9112a4cacc 100644
--- a/tests/avocado/multiprocess.py
+++ b/tests/avocado/multiprocess.py
@@ -22,6 +22,7 @@  def do_test(self, kernel_url, initrd_url, kernel_command_line,
                 machine_type):
         """Main test method"""
         self.require_accelerator('kvm')
+        self.require_multiprocess()
 
         # Create socketpair to connect proxy and remote processes
         proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,