[clang] [clang][python][test] Move python binding tests to lit framework (PR #142948)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 09:50:49 PDT 2025
================
@@ -0,0 +1,22 @@
+def is_libclang_loadable():
+ try:
+ sys.path.append(os.path.join(config.clang_src_dir, "bindings/python"))
+ from clang.cindex import Config
+ conf = Config()
+ Config.set_library_path(config.clang_lib_dir)
+ conf.lib
+ return True
+ except Exception as e:
+ # Benign error modes.
+ if "wrong ELF class: ELFCLASS32" in str(e):
+ return False
+ elif "No such file or directory" in str(e):
+ return False
+ # Unknown error modes.
+ else:
+ return True
----------------
dwblaikie wrote:
This seems backwards - (either the implementation or the comment) if the error modes are benign, wouldn't that mean it's OK/libclang /is/ loadable?
(& also in general, I'd have thought we'd look for specific error modes we can recover from, and anything else means "no recovery" rather than assuming anything other than these bad ones are good?)
https://github.com/llvm/llvm-project/pull/142948
More information about the cfe-commits
mailing list