[libvirt-python PATCH 1/3] test: workaround missing VIR_TYPED_PARAM enums in API definition

Daniel P. Berrangé posted 3 patches 5 years, 9 months ago
There is a newer version of this series
[libvirt-python PATCH 1/3] test: workaround missing VIR_TYPED_PARAM enums in API definition
Posted by Daniel P. Berrangé 5 years, 9 months ago
On Ubuntu 1804 with libvirt 4.0.0 libvirt-python build fails

running test
/usr/bin/python3 sanitytest.py build/lib.linux-x86_64-3.6 /usr/share/libvirt/api/libvirt-api.xml
Cannot get a value of enum VIR_TYPED_PARAM_BOOLEAN (originally VIR_DOMAIN_BLKIO_PARAM_BOOLEAN)
Cannot get a value of enum VIR_TYPED_PARAM_DOUBLE (originally VIR_DOMAIN_BLKIO_PARAM_DOUBLE)
Cannot get a value of enum VIR_TYPED_PARAM_INT (originally VIR_DOMAIN_BLKIO_PARAM_INT)
...snip...

The code generated for the binding is still correct and so we can just
whitelist this error scenario.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 sanitytest.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sanitytest.py b/sanitytest.py
index 1bedd55..f187c15 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -73,7 +73,11 @@ for n in second_pass:
             val = int(v[val])
             break
 
-    if type(val) != int:
+    # Version 4.0.0 was broken as missing VIR_TYPED_PARAM enums
+    # constants. This is harmless from POV of validating API
+    # coverage so ignore this error.
+    if (type(val) != int and
+        not val.startswith("VIR_TYPED_PARAM_")):
         fail = True
         print("Cannot get a value of enum %s (originally %s)" % (val, name))
     enumvals[typ][name] = val
-- 
2.25.4

Re: [libvirt-python PATCH 1/3] test: workaround missing VIR_TYPED_PARAM enums in API definition
Posted by Andrea Bolognani 5 years, 9 months ago
On Wed, 2020-04-29 at 14:36 +0100, Daniel P. Berrangé wrote:
> On Ubuntu 1804 with libvirt 4.0.0 libvirt-python build fails

s/1804/18.04/

> +++ b/sanitytest.py
> @@ -73,7 +73,11 @@ for n in second_pass:
> -    if type(val) != int:
> +    # Version 4.0.0 was broken as missing VIR_TYPED_PARAM enums
> +    # constants. This is harmless from POV of validating API
> +    # coverage so ignore this error.
> +    if (type(val) != int and
> +        not val.startswith("VIR_TYPED_PARAM_")):

Should this comment also contain a reference to Ubuntu 18.04? Or is
the issue present in any build of libvirt 4.0.0?


Unfortunately I don't feel qualified to review this patch. I suggest
that you post it on its own and get someone with libvirt-python
knowledge to review it.

-- 
Andrea Bolognani / Red Hat / Virtualization

Re: [libvirt-python PATCH 1/3] test: workaround missing VIR_TYPED_PARAM enums in API definition
Posted by Daniel P. Berrangé 5 years, 9 months ago
On Thu, Apr 30, 2020 at 10:18:31AM +0200, Andrea Bolognani wrote:
> On Wed, 2020-04-29 at 14:36 +0100, Daniel P. Berrangé wrote:
> > On Ubuntu 1804 with libvirt 4.0.0 libvirt-python build fails
> 
> s/1804/18.04/
> 
> > +++ b/sanitytest.py
> > @@ -73,7 +73,11 @@ for n in second_pass:
> > -    if type(val) != int:
> > +    # Version 4.0.0 was broken as missing VIR_TYPED_PARAM enums
> > +    # constants. This is harmless from POV of validating API
> > +    # coverage so ignore this error.
> > +    if (type(val) != int and
> > +        not val.startswith("VIR_TYPED_PARAM_")):
> 
> Should this comment also contain a reference to Ubuntu 18.04? Or is
> the issue present in any build of libvirt 4.0.0?

Any 4.0.0

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|