================ @@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: + Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): + def test_functions_registered(self): + IGNORED = set(["_FuncPtr", "_name", "_handle"]) + lib_functions = set(vars(conf.lib).keys()) ---------------- Endilll wrote:
I think what this test actually tests is whether `getattr` was called on `conf.lib` with everything that's in FUNCTION_LIST, i.e. it test `register_function` and code around it: ```python import ctypes from pprint import pprint lib = ctypes.cdll.LoadLibrary("/home/user/endill/ramdisk/llvm-build/lib/libclang.so") print("--- before getattr") pprint(vars(lib)) getattr(lib, "clang_createIndex") print("--- after getattr") pprint(vars(lib)) ``` outputs: ``` --- before getattr {'_FuncPtr': <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>, '_handle': 906416256, '_name': '/home/user/endill/ramdisk/llvm-build/lib/libclang.so'} --- after getattr {'_FuncPtr': <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>, '_handle': 906416256, '_name': '/home/user/endill/ramdisk/llvm-build/lib/libclang.so', 'clang_createIndex': <_FuncPtr object at 0x7f8296567dd0>} ``` So for purposes of testing for completeness of `FUNCTION_LIST`, this is an echo chamber. I'm looking into other ways to test that. https://github.com/llvm/llvm-project/pull/140015 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits