1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-18 20:23:49 +03:00

sanitytest: move C API binding check into a helper method

This is a step towards turning the sanitytest.py file into a normal
python unittest.

Best viewed with the '-b' flag to diff.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2022-03-22 17:52:55 +00:00
parent d4dfac2a43
commit 45fa54ab67

View File

@@ -349,7 +349,9 @@ for klass in gotfunctions:
if verbose: if verbose:
print("PASS %s.%s" % (klass, func)) print("PASS %s.%s" % (klass, func))
# Phase 7: Validate that all the low level C APIs have binding
# Validate that all the low level C APIs have binding
def validate_c_api_bindings_present(finalklassmap):
for name, (klass, func, cname) in sorted(finalklassmap.items()): for name, (klass, func, cname) in sorted(finalklassmap.items()):
pyname = cname pyname = cname
if pyname == "virSetErrorFunc": if pyname == "virSetErrorFunc":
@@ -366,7 +368,13 @@ for name, (klass, func, cname) in sorted(finalklassmap.items()):
try: try:
thing = getattr(libvirt.libvirtmod, pyname) thing = getattr(libvirt.libvirtmod, pyname)
except AttributeError: except AttributeError:
print("FAIL libvirt.libvirtmod.%s (C binding does not exist)" % pyname) raise Exception("libvirt.libvirtmod.%s (C binding does not exist)" % pyname)
try:
validate_c_api_bindings_present(finalklassmap)
except Exception as e:
print("FAIL: %s" % e)
fail = True fail = True
if fail: if fail: