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

Daniel P. Berrangé berrange at redhat.com
Wed Apr 29 13:36:58 UTC 2020


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 at 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




More information about the libvir-list mailing list