The `python` command may not exist on a system with Python 3 installed.
See https://peps.python.org/pep-0394/ for a discussion of the commands
expected to be installed.
Since Python2 was officially sunsetted almost three years ago
(https://www.python.org/doc/sunset-python-2/), IWYU should prefer
compatibility with newer systems over older ones.
Python code in scripts is still Python3/Python2-compatible, but we will no
longer make an effort to preserve Python2 support over time.
Fixes#1096.
It is now possible to append a parenthesized exit code to the summary start
marker: '/**** IWYU_SUMMARY(1)' to indicate that IWYU should return exit
code 1 for this test.
The exit-code syntax is only parsed out of the main file under test (not
e.g. check-also or associated files).
The exit code marker is entirely optional, and most tests shouldn't care
about exit codes.
Some of source files require extra Clang or IWYU arguments like
`-std=c++17` or `--mapping_file=...`.
Before this change all these args were stored in `run_iwyu_tests.py`.
This change adds the concept of "ARGS lines" so the launch arguments
could be specified directly in a source file that represents a test case.
Inspired by RUN lines of `lit` in LLVM:
https://llvm.org/docs/TestingGuide.html, "Writing new regression tests".
The test running framework would always add `-I .` as an argument
to Clang. This makes it very hard to test examples without explicit
include paths, and has driven IWYU's behavior to assume the presence
of `-I .`.
In order to fix bugs related to this, we now make `-I .` explicit
for the tests that actually need it.
Patch by Flamefire, thanks!
Add an optional command-line argument to run_iwyu_tests.py, to specify
which IWYU binary to test with. Usage example:
$ ./run_iwyu_tests.py -- ./include-what-you-use
The '--' delimiter is used to separate args going to Python's unittest
from the new arg used by the test runner.
Update docs to mention new run_iwyu_tests.py features.
Instead of trying to call iterator.next() and catching exception, check if
iterator has method next. Thus thread doesn't stay in exception state.
Patch by Kim Gräsman.
When follow Clang 'Getting Started' instructions you end up with directories
llvm-root/build, llvm-root/llvm/tools/clang/tools/include-what-you-use. And to
access build directory you have to use path ../../../../../build.
Patch by Kim Gräsman.
an #include of a .cc. We now check more directly for the bad
case: suggesting to add a .cc #include (we allow you to keep
an existing one, though). This requires us doing the check
later in the process, which is good -- sanity-checks *should*
be done right before emitting output. It also allows me to
relax the check to include #including .cc files from other .cc
files (which is what caused the bug that prompted this CL).
I had to modify the test framework to consider .c files --
since .cc files are special to run_iwyu_tests.cc, when I have
to #include a .cc file in my tests, I actually #include a .c
file, which is the same as far as iwyu is concerned.
R=wan,dsturtevant
DELTA=133 (80 added, 41 deleted, 12 changed)
Revision created by MOE tool push_codebase.
MOE_MIGRATION=1278
changes, were accidentally undone in a recent commit. I'll re-do all
these changes over the next few commits.
Revision created by MOE tool push_codebase.
MOE_MIGRATION=897
HasMapping before mappings were finalized. And indeed, the
glob mappings were being left out. I solve this by doing the
reexport-protection check after mappins are finalized, in the
preprocessor.
While in the area, I added a few include-picker mappings that
had been inadvertently omitted before, or discovered in
testing. In particular, glob defines its own size_t, which is
weird; we don't want to depend on glob for size_t.
R=dsturtevant
DELTA=141 (129 added, 2 deleted, 10 changed)
Revision created by MOE tool push_codebase.
MOE_MIGRATION=889
run_iwyu_tests framework. This is the first use of the
_iwyu_flags_map framework, which had to be fixed up a bit to
work.
To help debugging problems, I added in some more logging
information, which I've kept.
I also noticed that tests weren't running on my stock ubuntu
python. This seems to be because the stock unittest module
doesn't run the global setUp in main. So I renamed the global
setUp and now call it manually.
R=dsturtevant
DELTA=250 (117 added, 121 deleted, 12 changed)
Revision created by MOE tool push_codebase.
MOE_MIGRATION=729