[clang] [clang][python][test] Move python binding tests to lit framework (PR #142948)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 6 10:53:17 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:
Ah, OK. Some more comments might be helpful - like "if the failure is unexpected, return true, allowing the test to run and fail so developers can see the failure" or something like that?
https://github.com/llvm/llvm-project/pull/142948
More information about the cfe-commits
mailing list