[all-commits] [llvm/llvm-project] 2532bd: [clang][python][test] Move python binding tests to...

Jannick Kremer via All-commits all-commits at lists.llvm.org
Thu Jul 3 04:57:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2532bde0388980ac7e299b02bc554e6fde6c686e
      https://github.com/llvm/llvm-project/commit/2532bde0388980ac7e299b02bc554e6fde6c686e
  Author: Jannick Kremer <jannick.kremer at mailbox.org>
  Date:   2025-07-03 (Thu, 03 Jul 2025)

  Changed paths:
    M .github/workflows/libclang-python-tests.yml
    M clang/CMakeLists.txt
    R clang/bindings/python/tests/CMakeLists.txt
    R clang/bindings/python/tests/__init__.py
    R clang/bindings/python/tests/cindex/INPUTS/a.inc
    R clang/bindings/python/tests/cindex/INPUTS/b.inc
    R clang/bindings/python/tests/cindex/INPUTS/compile_commands.json
    R clang/bindings/python/tests/cindex/INPUTS/header1.h
    R clang/bindings/python/tests/cindex/INPUTS/header2.h
    R clang/bindings/python/tests/cindex/INPUTS/header3.h
    R clang/bindings/python/tests/cindex/INPUTS/hello.cpp
    R clang/bindings/python/tests/cindex/INPUTS/include.cpp
    R clang/bindings/python/tests/cindex/INPUTS/parse_arguments.c
    R clang/bindings/python/tests/cindex/INPUTS/testfile.c
    R clang/bindings/python/tests/cindex/__init__.py
    R clang/bindings/python/tests/cindex/test_access_specifiers.py
    R clang/bindings/python/tests/cindex/test_cdb.py
    R clang/bindings/python/tests/cindex/test_code_completion.py
    R clang/bindings/python/tests/cindex/test_comment.py
    R clang/bindings/python/tests/cindex/test_cursor.py
    R clang/bindings/python/tests/cindex/test_cursor_kind.py
    R clang/bindings/python/tests/cindex/test_diagnostics.py
    R clang/bindings/python/tests/cindex/test_enums.py
    R clang/bindings/python/tests/cindex/test_exception_specification_kind.py
    R clang/bindings/python/tests/cindex/test_file.py
    R clang/bindings/python/tests/cindex/test_index.py
    R clang/bindings/python/tests/cindex/test_lib.py
    R clang/bindings/python/tests/cindex/test_linkage.py
    R clang/bindings/python/tests/cindex/test_location.py
    R clang/bindings/python/tests/cindex/test_rewrite.py
    R clang/bindings/python/tests/cindex/test_source_range.py
    R clang/bindings/python/tests/cindex/test_tls_kind.py
    R clang/bindings/python/tests/cindex/test_token_kind.py
    R clang/bindings/python/tests/cindex/test_tokens.py
    R clang/bindings/python/tests/cindex/test_translation_unit.py
    R clang/bindings/python/tests/cindex/test_type.py
    R clang/bindings/python/tests/cindex/util.py
    M clang/test/CMakeLists.txt
    A clang/test/bindings/python/bindings.sh
    A clang/test/bindings/python/lit.local.cfg
    A clang/test/bindings/python/tests/__init__.py
    A clang/test/bindings/python/tests/cindex/INPUTS/a.inc
    A clang/test/bindings/python/tests/cindex/INPUTS/b.inc
    A clang/test/bindings/python/tests/cindex/INPUTS/compile_commands.json
    A clang/test/bindings/python/tests/cindex/INPUTS/header1.h
    A clang/test/bindings/python/tests/cindex/INPUTS/header2.h
    A clang/test/bindings/python/tests/cindex/INPUTS/header3.h
    A clang/test/bindings/python/tests/cindex/INPUTS/hello.cpp
    A clang/test/bindings/python/tests/cindex/INPUTS/include.cpp
    A clang/test/bindings/python/tests/cindex/INPUTS/parse_arguments.c
    A clang/test/bindings/python/tests/cindex/INPUTS/testfile.c
    A clang/test/bindings/python/tests/cindex/__init__.py
    A clang/test/bindings/python/tests/cindex/test_access_specifiers.py
    A clang/test/bindings/python/tests/cindex/test_cdb.py
    A clang/test/bindings/python/tests/cindex/test_code_completion.py
    A clang/test/bindings/python/tests/cindex/test_comment.py
    A clang/test/bindings/python/tests/cindex/test_cursor.py
    A clang/test/bindings/python/tests/cindex/test_cursor_kind.py
    A clang/test/bindings/python/tests/cindex/test_diagnostics.py
    A clang/test/bindings/python/tests/cindex/test_enums.py
    A clang/test/bindings/python/tests/cindex/test_exception_specification_kind.py
    A clang/test/bindings/python/tests/cindex/test_file.py
    A clang/test/bindings/python/tests/cindex/test_index.py
    A clang/test/bindings/python/tests/cindex/test_lib.py
    A clang/test/bindings/python/tests/cindex/test_linkage.py
    A clang/test/bindings/python/tests/cindex/test_location.py
    A clang/test/bindings/python/tests/cindex/test_rewrite.py
    A clang/test/bindings/python/tests/cindex/test_source_range.py
    A clang/test/bindings/python/tests/cindex/test_tls_kind.py
    A clang/test/bindings/python/tests/cindex/test_token_kind.py
    A clang/test/bindings/python/tests/cindex/test_tokens.py
    A clang/test/bindings/python/tests/cindex/test_translation_unit.py
    A clang/test/bindings/python/tests/cindex/test_type.py
    A clang/test/bindings/python/tests/cindex/util.py

  Log Message:
  -----------
  [clang][python][test] Move python binding tests to lit framework (#146844)

As discussed in PR #142353, the current testsuite of the `clang` Python
bindings has several issues:

- It `libclang.so` cannot be loaded into `python` to run the testsuite,
the whole `ninja check-all` aborts.
- The result of running the testsuite isn't report like the `lit`-based
tests, rendering them almost invisible.
- The testsuite is disabled in a non-obvious way (`RUN_PYTHON_TESTS`) in
`tests/CMakeLists.txt`, which again doesn't show up in the test results.

All these issues can be avoided by integrating the Python bindings tests
with `lit`, which is what this patch does:

- The actual test lives in `clang/test/bindings/python/bindings.sh` and
is run by `lit`.
- The current `clang/bindings/python/tests` directory (minus the
now-subperfluous `CMakeLists.txt`) is moved into the same directory.
- The check if `libclang` is loadable (originally from PR #142353) is
now handled via a new `lit` feature, `libclang-loadable`.
- The various ways to disable the tests have been turned into `XFAIL`s
as appropriate. This isn't complete and not completely tested yet.

Tested on `sparc-sun-solaris2.11`, `sparcv9-sun-solaris2.11`,
`i386-pc-solaris2.11`, `amd64-pc-solaris2.11`, `i686-pc-linux-gnu`, and
`x86_64-pc-linux-gnu`.

Co-authored-by: Rainer Orth <ro at gcc.gnu.org>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list