[clang] [clang][python][test] Move python binding tests to lit framework (PR #142948)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 6 05:35:27 PDT 2025


rorth wrote:

> @rorth have you tested that your `is_libclang_loadable` works as intended w.r.t the "Benign error modes"? Do correct me if I made a mistake here, but I just tried testing this by manually adding `raise Exception("wrong ELF class: ELFCLASS32")` at the start of `get_cindex_library` and then running the tests via `build/bin/llvm-lit clang/test/bindings/python`, and this just gives me a regular `FAIL`. Adding some debugging statements into `is_libclang_loadable` shows that the `except` block is never entered for some reason...

As mentioned in the description, I've tested the patch in a variety of configurations:
- Solaris/amd64 (where `libclang.so` matches `python`, causing the test to `PASS`)
- Solaris/i386 (where the 32-bit `libclang.so` cannot be loaded into the system `python`, which causes the test to become `UNSUPPORTED`.
- Similarly Solaris/sparcv9, Solaris/sparc, Linux/x86_64, Linux/i686 (and also, not mentioned above) Linux/sparc64 and Linux/sparc.

Besides, I've manually moved `libclang.so` aside to test the `libclang` missing case.

I've got no explanation why your explicit `raise` didn't come through (but then I known very little Python).

https://github.com/llvm/llvm-project/pull/142948


More information about the cfe-commits mailing list