Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang/python] Add Python libclang unit tests to CI #76601

Closed
linux4life798 opened this issue Dec 30, 2023 · 4 comments · Fixed by #77219
Closed

[clang/python] Add Python libclang unit tests to CI #76601

linux4life798 opened this issue Dec 30, 2023 · 4 comments · Fixed by #77219
Labels

Comments

@linux4life798
Copy link
Contributor

linux4life798 commented Dec 30, 2023

It doesn't look like any GitHub workflows ever run the libclang Python binding unittests (target check-clang-python).

This should be added to the clang CI to promote ease of development.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Dec 30, 2023
@linux4life798
Copy link
Contributor Author

@EugeneZelenko EugeneZelenko added test-suite clang:as-a-library libclang and C++ API github:workflow and removed clang Clang issues not falling into any other category test-suite labels Dec 30, 2023
@linux4life798
Copy link
Contributor Author

It looks like the check-all target, which is built/run from llvm-tests.yml, does include the check-clang-python target. I think we should still have this test explicitly run in the clang specific tests (clang-tests.yml) and also add the last few supported Python versions to the test matrix.

The following output is from https://github.com/llvm/llvm-project/actions/runs/6703627427/job/18214521420:

...
[4639/5636] cd /home/runner/work/llvm-project/llvm-project/clang/bindings/python && /usr/local/bin/cmake -E env CLANG_NO_DEFAULT_CONFIG=1 CLANG_LIBRARY_PATH=/home/runner/work/llvm-project/llvm-project/build/lib /opt/hostedtoolcache/Python/3.11.6/x64/bin/python3.11 -m unittest discover
.................................................................................................................................
----------------------------------------------------------------------
Ran 129 tests in 1.390s

OK
...

@linux4life798
Copy link
Contributor Author

linux4life798 commented Dec 31, 2023

There is something wrong with the TranslationUnit unittest on Windows.
See the error in https://github.com/linux4life798/llvm-project/actions/runs/7372545686/job/20060970297.

FAIL: test_unsaved_files (tests.cindex.test_translation_unit.TestTranslationUnit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\llvm-project\llvm-project\clang\bindings\python\tests\cindex\test_translation_unit.py", line 105, in test_unsaved_files

    self.assertEqual(spellings[-1], "y")

AssertionError: 'SOME_DEFINE' != 'y'

- SOME_DEFINE

+ y

@linux4life798 linux4life798 changed the title [clang/python] Add Python libclang unittests to CI [clang/python] Add Python libclang unit tests to CI Jan 2, 2024
@linux4life798
Copy link
Contributor Author

linux4life798 commented Jan 6, 2024

Basic CI testing for the Python binding has been merged in #76784.

The next step is to test on the oldest version of Python that we want to support. These changes are being mocked in https://github.com/linux4life798/llvm-project/blob/add-python-workflow-checks/.github/workflows/libclang-python-tests.yml.

linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 6, 2024
This will be used for testing the libclang Python binding
against different versions of Python.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 6, 2024
This has the ability to check multiple python versions for compatibility.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 6, 2024
This will be used for testing the libclang Python binding
against different versions of Python.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 6, 2024
This has the ability to check multiple python versions for compatibility.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 6, 2024
This will be used for testing the libclang Python binding
against different versions of Python.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 7, 2024
This has the ability to check multiple python versions for compatibility.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 7, 2024
This will be used for testing the libclang Python binding
against different versions of Python.

Issue llvm#76664.
Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 7, 2024
This enables the libclang python binding test to check
the oldest version of Python supported in addition
to the normal python version.

It is important to check this for issue llvm#76664, since
many new mainstream python type annotation features
and best practices are not compatible with older
versions of python.

Additionally, frustration around ever increasing
platform dependencies and versions has been raised.
This will help ensure that python maintains reasonable
backwards compatibility.

Adding this additional build step will increase the
run time, but this should always be minimal, since
the additional libclang compilation should see 100%
cache hit rate.

Issue llvm#76664.
Fixes llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 17, 2024
This will be used for testing the libclang Python binding
against different versions of Python.

Issue llvm#76664.
Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Jan 17, 2024
This enables the libclang python binding test to check
the oldest version of Python supported in addition
to the normal python version.

It is important to check this for issue llvm#76664, since
many new mainstream python type annotation features
and best practices are not compatible with older
versions of python.

Additionally, frustration around ever increasing
platform dependencies and versions has been raised.
This will help ensure that python maintains reasonable
backwards compatibility.

Adding this additional build step will increase the
run time, but this should always be minimal, since
the additional libclang compilation should see 100%
cache hit rate.

Issue llvm#76664.
Fixes llvm#76601.
boomanaiden154 pushed a commit that referenced this issue Jan 17, 2024
This enables the libclang python binding test to check
the oldest version of Python supported in addition
to the normal python version.

It is important to check this for issue #76664, since
many new mainstream python type annotation features
and best practices are not compatible with older
versions of python.

Additionally, frustration around ever increasing
platform dependencies and versions has been raised.
This will help ensure that python maintains reasonable
backwards compatibility.

Adding this additional build step will increase the
run time, but this should always be minimal, since
the additional libclang compilation should see 100%
cache hit rate.

Issue #76664.
Fixes #76601.
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this issue Jan 28, 2024
)

This is important to aid development of Python type annotations in the
libclang binding.
See llvm#76664 for more details.

* Run on all pull requests and direct pushes.
* This makes use of the existing llvm-project-tests.yml recipe, which
will preload ccache from previous runs.
* Building libclang currently takes about 9mins when ccache is warm and
about an 1hr 20mins if it is cold using the standard GitHub ubuntu
runner.
* In the future, this could be broken into the following discrete steps
for clarity:
   1. Build libclang dependency.
       ninja -C build libclang
   2. Run Python unit tests.
       ninja -C build check-clang-python
* Followup changes will bring testing on older python versions and
static type checking.

Issue llvm#76601.
linux4life798 added a commit to linux4life798/llvm-project that referenced this issue Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants