diff options
author | Sam James <sam@gentoo.org> | 2023-01-09 04:32:10 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-01-23 21:15:10 +0000 |
commit | 136f77805fd89cd30e69b3d1204fbf7efedd9a12 (patch) | |
tree | 9693259dbbd1c883b0ae9c0b1fd6d3bd6fd5d234 /clang/bindings | |
parent | 52bcdac3b8425e20023151bb726b56fd6f62ec17 (diff) | |
download | llvm-136f77805fd89cd30e69b3d1204fbf7efedd9a12.tar.gz |
[Clang] [Python] Fix tests when default config file contains -include
In Gentoo, we make use of Clang's recently-enhanced config file support
and add a default include to `clang` invocations using '-include ...'.
This breaks clang-python tests like so:
```
======================================================================
ERROR: test_includes (tests.cindex.test_translation_unit.TestTranslationUnit)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 145, in test_includes
eq(i[0], i[1])
File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 132, in eq
self.assert_normpaths_equal(expected[0], actual.source.name)
AttributeError: 'NoneType' object has no attribute 'name'
======================================================================
FAIL: test_inclusion_directive (tests.cindex.test_translation_unit.TestTranslationUnit)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 157, in test_inclusion_directive
self.assert_normpaths_equal(i[0], i[1])
File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 126, in assert_normpaths_equal
self.assertEqual(os.path.normpath(path1),
AssertionError: '/var/tmp/portage/dev-python/clang-python-1[58 chars]r1.h' != '/usr/include/gentoo/fortify.h'
- /var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/INPUTS/header1.h
+ /usr/include/gentoo/fortify.h
```
Disable using the default Clang configuration files on the system, like
we did for other tests.
Bug: https://bugs.gentoo.org/890204
Differential Revision: https://reviews.llvm.org/D141248
Diffstat (limited to 'clang/bindings')
-rw-r--r-- | clang/bindings/python/tests/CMakeLists.txt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index 5127512fe312..c4cd2539e9d6 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -1,7 +1,10 @@ # Test target to run Python test suite from main build. +# Avoid configurations including '-include' from interfering with +# our tests by setting CLANG_NO_DEFAULT_CONFIG. add_custom_target(check-clang-python COMMAND ${CMAKE_COMMAND} -E env + CLANG_NO_DEFAULT_CONFIG=1 CLANG_LIBRARY_PATH=$<TARGET_FILE_DIR:libclang> "${Python3_EXECUTABLE}" -m unittest discover DEPENDS libclang |