[libvirt] [PATCH 1/2] test: let qemuhotplugtest report details of init fails

Christian Ehrhardt posted 2 patches 6 years ago
There is a newer version of this series
[libvirt] [PATCH 1/2] test: let qemuhotplugtest report details of init fails
Posted by Christian Ehrhardt 6 years ago
If virHostdevManagerGetDefault in qemuhotplugtest fails it works
for quite a while to later segfault when accessing
mgr->activePCIHostdevs.

Report the error details and break on a failed init to see the
real issue right away.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 tests/qemuhotplugtest.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index a60c8d1c93..94440791d5 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -634,6 +634,11 @@ mymain(void)
         return EXIT_FAILURE;
 
     driver.hostdevMgr = virHostdevManagerGetDefault();
+    if (driver.hostdevMgr == NULL) {
+        VIR_TEST_VERBOSE("Could not initialize HostdevManager - %s\n",
+                virGetLastErrorMessage());
+        return EXIT_FAILURE;
+    }
 
 
 #define DO_TEST(file, ACTION, dev, fial, kep, ...) \
-- 
2.25.0


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/2] test: let qemuhotplugtest report details of init fails
Posted by Daniel Henrique Barboza 6 years ago

On 1/15/20 1:37 PM, Christian Ehrhardt wrote:
> If virHostdevManagerGetDefault in qemuhotplugtest fails it works
> for quite a while to later segfault when accessing
> mgr->activePCIHostdevs.
> 
> Report the error details and break on a failed init to see the
> real issue right away.
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>   tests/qemuhotplugtest.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
> index a60c8d1c93..94440791d5 100644
> --- a/tests/qemuhotplugtest.c
> +++ b/tests/qemuhotplugtest.c
> @@ -634,6 +634,11 @@ mymain(void)
>           return EXIT_FAILURE;
>   
>       driver.hostdevMgr = virHostdevManagerGetDefault();
> +    if (driver.hostdevMgr == NULL) {
> +        VIR_TEST_VERBOSE("Could not initialize HostdevManager - %s\n",
> +                virGetLastErrorMessage());

Suggestion/nit: make 'virGetLastErrorMessage()' with the same identation of
the string above it:

> +        VIR_TEST_VERBOSE("Could not initialize HostdevManager - %s\n",
> +                         virGetLastErrorMessage());


LGTM regardless, so


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>



> +        return EXIT_FAILURE;
> +    }
>   
>   
>   #define DO_TEST(file, ACTION, dev, fial, kep, ...) \
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list