Fixes observed warning running `ninja check-all`:
llvm-project/clang/bindings/python/tests/cindex/test_diagnostics.py💯
DeprecationWarning: Please use assertRegex instead.
self.assertRegexpMatches(children[0].spelling
Looks like unittest.assertRegexpMatches has been deprecated in favor of
unittest.assertRegex since Python 3.2, according to:
https://docs.python.org/3/library/unittest.html#deprecated-aliases
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85692
This is primarily motivated by the desire to move from Python2 to
Python3. `PYTHON_EXECUTABLE` is ambiguous. This explicitly identifies
the python interpreter in use. Since the LLVM build seems to be able to
completed successfully with python3, use that across the build. The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.
This is primarily motivated by the desire to move from Python2 to
Python3. `PYTHON_EXECUTABLE` is ambiguous. This explicitly identifies
the python interpreter in use. Since the LLVM build seems to be able to
completed successfully with python3, use that across the build. The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.
Summary:
The Python ctypes FFI interface is broken on AIX, it cannot properly pass
structures containing arrays ( https://bugs.python.org/issue38628). So
disable the clang python binding tests on AIX till this is resolved.
Reviewers: stevewan, jasonliu, hubert.reinterpretcast, mgorny
Reviewed By: jasonliu, hubert.reinterpretcast
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70675
Summary:
Wraps JSON compilation database with a target and mode adding database
wrapper. So that driver can correctly figure out which toolchain to use.
Note that clients that wants to make use of this target discovery mechanism
needs to link in TargetsInfos and initialize them at startup.
Reviewers: ilya-biryukov
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63755
llvm-svn: 364386
Running `make check-all` fails on Solaris 11/SPARC since the clang python
tests FAIL:
............................
======================================================================
FAIL: test_extent (tests.cindex.test_location.TestLocation)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/cindex/test_location.py", line 87, in test_extent
self.assert_location(one.extent.start,line=1,column=1,offset=0)
File "tests/cindex/test_location.py", line 22, in assert_location
self.assertEqual(loc.column, column)
AssertionError: 5 != 1
======================================================================
FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/cindex/test_cursor.py", line 70, in test_get_children
self.assertEqual(tu_nodes[0].is_definition(), True)
AssertionError: False != True
----------------------------------------------------------------------
Ran 126 tests in 2.123s
FAILED (failures=2, skipped=6)
Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so
this patch disables the test as is already done on a couple of other
targets.
This allowed the `sparc-sun-solaris2.11` test to finish.
Differential Revision: https://reviews.llvm.org/D60046
llvm-svn: 357917
check-all invokes check-clang-python which prints the annoying message:
LIBCLANG TOOLING ERROR: fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Let's fix it now with os.dup os.dup2 trick.
llvm-svn: 357562
Summary:
This is useful because otherwise there's no easy way to distinguish #pragma
packed(N) from attribute(packed, aligned(N)) that isn't looking at field
offsets (since pragma packed() also creates a packed attribute).
Reviewers: Anastasia, arphaman, serge-sans-paille
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59299
llvm-svn: 356062
The value for CXCursor_ConvergentAttr is not 420. I'm not really sure how easy
it is to test this, and I'm not familiar with the python bindings, just noticed
the error while looking at D57946 to write D58570.
Differential Revision: https://reviews.llvm.org/D58571
llvm-svn: 354823
The file contents could be of str type. Should use byte length instead
of str length, otherwise utf-8 encoded files may not get properly parsed
for completion.
Source issue: https://github.com/ncm2/ncm2-pyclang#2
Commited on behalf of `roxma'
Differential Revision: https://reviews.llvm.org/D56429
llvm-svn: 352039
to reflect the new license.
We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.
llvm-svn: 351636
Disable Python binding tests when LLVM_ENABLE_PIC is disabled,
as libclang.so is not being built in that case. Reported by Nico Weber.
Differential Revision: https://reviews.llvm.org/D56732
llvm-svn: 351304
On Python 3.7 the old code raises a warning:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
class ArgumentsIterator(collections.Sequence):
On Python 3.8 it wouldn't work anymore.
Commited on behalf of Jakub Stasiak.
Differential Revision: https://reviews.llvm.org/D56341
llvm-svn: 350467
StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use.
Differential Revision: https://reviews.llvm.org/D55196
llvm-svn: 350318
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.
The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
`map` are replaced by list comprehension and `filter` by filtered list comprehension.
Differential Revision: https://reviews.llvm.org/D55197
llvm-svn: 349501
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.
Differential Revision: https://reviews.llvm.org/D55213
llvm-svn: 349454
Replace `xrange(...)` by either `range(...)` or `list(range(...))` depending on the context.
Differential Revision: https://reviews.llvm.org/D55193
llvm-svn: 349448
This reverts commit r349064.
This wasn't updating the right test. Causing (not the different line number
from the previous revert):
======================================================================
FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py", line 18, in test_diagnostic_warning
self.assertEqual(len(tu.diagnostics), 2)
AssertionError: 1 != 2
llvm-svn: 349118
Have all classes derive from object: that's implicitly the default in Python3,
it needs to be done explicilty in Python2.
Differential Revision: https://reviews.llvm.org/D55121
llvm-svn: 348127
Python 3.6 introduced a file system path protocol (PEP 519[1]).
The standard library APIs accepting file system paths now accept path
objects too. It could be useful to add this here as well
for convenience.
[1] https://www.python.org/dev/peps/pep-0519
Authored by: jstasiak (Jakub Stasiak)
Differential Revision: https://reviews.llvm.org/D54120
llvm-svn: 346586
Disable the Python binding tests on AArch64, Hexagon and SystemZ
following reports on test failures. The first two yield different
results, possibly indicating test case problems. The last one seems
to have broken FFI in Python.
While at it, refactor the code to make adding future test restrictions
easier.
Differential Revision: https://reviews.llvm.org/D53326
llvm-svn: 344666
Windows buildbots are still not happy
Now that both issues found out during the last iteration have been
fixed, reenable the Python binding tests on buildbots.
........
llvm-svn: 344408
Remove the test checking for compilation db lookup failure.
Since r342228, JSONCompilationDatabasePlugin infers compile commands for
missing files, therefore making the lookup always succeed.
Differential Revision: https://reviews.llvm.org/D53202
llvm-svn: 344364
Fix passing arguments to the Python test command to use 'env' builtin
CMake command, in order to fix compatibility with Windows.
Differential Revision: https://reviews.llvm.org/D53151
llvm-svn: 344288
Remove the Python tests from default target in order to fix two
kinds of breakage uncovered by enabling them: one failing test on Linux,
and problem with the test command on Windows. Both to be addressed
in followup revisions.
llvm-svn: 344260
Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.
Differential Revision: https://reviews.llvm.org/D52840
llvm-svn: 344258
Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.
Differential Revision: https://reviews.llvm.org/D52840
llvm-svn: 344241
Support a new CLANG_LIBRARY_PATH environment variable for the Python
binding tests. This variable can be used to force the bindings to load
libclang.* from a specific directory.
I plan to use this when integrating Python binding tests with the CMake
build system. Currently, those tests load libclang.so from default
search paths, so I would have to rely on platform-specific mechanics
such as LD_LIBRARY_PATH. Instead of copying the whole logic necessary
to handle platform differences into yet another place, it's easier to
just add a dedicated variable for this purpose.
Differential Revision: https://reviews.llvm.org/D52806
llvm-svn: 344240