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
Signed-off-by: Sam James <sam@gentoo.org>
This is essentially an import-time side effect, IMO it could be better to instead put the envvar provision in clang/bindings/python/tests/CMakeLists.txt: the add_custom_target there already is making use of env so should be relatively easy to stuff this there too.