1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
Commit Graph

955 Commits

Author SHA1 Message Date
Arthur Eubanks
6acb684b54 [lit] Bump up the Windows process cap from 32 to 60
At 61 or over, I see messages like

  File "...\Python\Python39\lib\multiprocessing\connection.py", line 816, in _exhaustive_wait
    res = _winapi.WaitForMultipleObjects(L, False, timeout)

  ValueError: need at most 63 handles, got a sequence of length 64

60 seems to work for me.

If this causes issues for anybody else, feel free to revert.
2021-05-07 18:13:38 -07:00
Arthur Eubanks
9df931e590 Revert "lit: revert 134b103fc0f3a995d76398bf4b029d72bebe8162"
This reverts commit d319005a3746a7661c8c9a3302266b6ff7cf61be.

Causing messages like:

  File "...\Python\Python39\lib\multiprocessing\connection.py", line 816, in _exhaustive_wait
    res = _winapi.WaitForMultipleObjects(L, False, timeout)
ValueError: need at most 63 handles, got a sequence of length 74
2021-05-07 18:00:11 -07:00
Saleem Abdulrasool
363580b4e0 lit: revert 134b103fc0f3a995d76398bf4b029d72bebe8162
Revert the 32-process cap on Windows.  When testing with Swift, we found
that there was a time reduction for testing with the higher load.  This
should hopefully not matter much in practice.  In the case that the
original problem with python remains with a high subprocess count, we
can easily revert this change.
2021-05-07 10:22:43 -07:00
James Henderson
03789d321b [lit][test] Attempt fix when paths include symlink
Example of failure:
https://lab.llvm.org/staging/#/builders/126/builds/345/steps/5/logs/FAIL__lit___use-tool-search-env_py
2021-05-07 09:21:58 +01:00
James Henderson
593bccf28a [lit] Report tool path from use_llvm_tool if found via env variable
Previously, if the search_env argument was specified, and the tool was
found at that location, the path was not reported, unlike other
situations when this function was called. Adding the reporting makes the
function consistent.

Reviewed by: thopre

Differential Revision: https://reviews.llvm.org/D101896
2021-05-06 09:21:54 +01:00
Vitaly Buka
56f698ad6a [sanitizer] Use COMPILER_RT_EMULATOR with gtests
Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D100998
2021-04-25 15:41:13 -07:00
Vitaly Buka
639348c2c2 Revert "[sanitizer] Use COMPILER_RT_EMULATOR with gtests"
Missed review comments.

This reverts commit e25082961cb5aaafc817cb55593cf0ea8d3c4c22.
2021-04-22 11:15:55 -07:00
Vitaly Buka
cd55b6be92 [sanitizer] Use COMPILER_RT_EMULATOR with gtests
Differential Revision: https://reviews.llvm.org/D100998
2021-04-22 10:33:50 -07:00
Thomas Preud'homme
23f47cc464 [lit, test] Fix test cancellation feature detection
A lit feature guards tests for the lit timeout functionality because on
most system it depends on the availability of the psutil Python module.
However, that feature is defined based on the ability of the testing lit
to cancel test, which does not necessarily apply to the ability of the
tested lit.

In particular, RUN commands have a cleared PYTHONPATH and user site
packages are disabled. In the case where psutil is found by the testing
lit from one of those two source of python path, the tested lit would
not be able to find it, causing timeout tests to fail.

This commit fixes the issue by testing the ability to cancel tests in
the RUN command environment.

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D99728
2021-04-20 12:09:30 +01:00
Martin Storsjö
86db67416f [lit] Fix the return code for "not not" after evaluating "not" internally
This fixes cases where "not not <command>" is supposed to return
only the error codes 0 or 1, but after efee57925c3f46c74c6697,
it passed the original error code through.

This was visible on AIX in the shtest-output-printing.py testcase,
where 'wc' returns 2, while it returns 1 on other platforms, and the
test required "not not" to normalize it to 1.
2021-04-19 00:37:13 +03:00
Martin Storsjö
a74fefb10d Reland "[lit] Handle plain negations directly in the internal shell"
Keep running "not --crash" via the external "not" executable, but
for plain negations, and for cases that use the shell "!" operator,
just skip that argument and invert the return code.

The libcxx tests only use the shell operator "!" for negations,
never the "not" executable, because libcxx tests can be run without
having a fully built llvm tree available providing the "not"
executable.

This allows using the internal shell for libcxx tests.

It should be possible to reland this now that D99938 fixed the
one test failure in clang-tidy that broke when "not" was handled
internally, letting lit/python execute grep.exe directly instead
of via not.exe. (See D99330 and D99406 for more commentery on the
exact issue that broke and other potential ways of fixing it.)

Differential Revision: https://reviews.llvm.org/D98859
2021-04-15 11:02:14 +03:00
Martin Storsjö
1e4209ecab [lit] Always quote arguments containing '[' on windows
This avoids breaking clang-tidy/infrastructure/validate-check-names.cpp
if 'not' is evaluated as a lit internal tool (making TestRunner
invoke 'grep' directly in that test, instead of invoking 'not', which
then invokes 'grep').

The quoting of arguments is still brittle if the executable is an
MSYS based tool though, as MSYS based tools incorrectly unescape
backslashes in quoted arguments (contrary to regular win32 argument
parsing rules), see D99406 and
https://github.com/msys2/msys2-runtime/issues/36 for more examples
of the issues.

Differential Revision: https://reviews.llvm.org/D99938
2021-04-14 12:32:48 +03:00
Luís Marques
c7d86ed0c7 [lit testing] Fix xfail-cl.py test worker count
This would fail in test environments with < 3 hardware threads.

Differential Revision: https://reviews.llvm.org/D99858
2021-04-06 20:48:18 +01:00
Martin Storsjö
a60ff1f5b7 [lit] Fix check-lit hanging on Windows due to a division by zero exception 2021-03-24 19:28:33 +02:00
Roman Lebedev
3f2ee9f1ab [lit] Reliable progress indicator and ETA
Quality of progress bar and ETA in lit has always bothered me.

For example, given `./bin/llvm-lit /repositories/llvm-project/clang/test/CodeGen* -sv`
at 1%, it says it will take 10 more minutes,
at 25%, it says it will take 1.25 more minutes,
at 50%, it says it will take 30 more seconds,
and in the end finishes with `Testing Time: 39.49s`. That's rather wildly unprecise.

Currently, it assumes that every single test will take the same amount of time to run on average.
This is is a somewhat reasonable approximation overall, but it is quite clearly imprecise,
especially in the beginning.

But, we can do better now, after D98179! We now know how long the tests took to run last time.
So we can build a better ETA predictor, by accumulating the time spent already,
the time that will be spent on the tests for which we know the previous time,
and for the test for which we don't have previous time, again use the average time
over the tests for which we know current or previous run time.
It would be better to use median, but i'm wary of the cost that may incur.

Now, on **first** run of `./bin/llvm-lit /repositories/llvm-project/clang/test/CodeGen* -sv`
at 10%, it says it will take 30 seconds,
at 25%, it says it will take 50 more seconds,
at 50%, it says it will take 27 more seconds,
and in the end finishes with `Testing Time: 41.64s`. That's pretty reasonable.

And on second run of `./bin/llvm-lit /repositories/llvm-project/clang/test/CodeGen* -sv`
at 1%, it says it will take 1 minutes,
at 25%, it says it will take 30 more seconds,
at 50%, it says it will take 19 more seconds,
and in the end finishes with `Testing Time: 39.49s`. That's amazing i think!

I think people will love this :)

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D99073
2021-03-23 12:16:19 +03:00
Roman Lebedev
61f46d53b3 [lit] Do not forget test times for tests that weren't executed
Even though we have read the times before,
we intentionally forget about it for performance reasons.
But that means we also forget all the times for the tests
that weren't executed this time. This is mildly inconvenient.

So, when recording the new times, first re-read the old times,
and update times for the tests that were executed,
thus preserving all original times, too.
2021-03-22 15:26:00 +03:00
Roman Lebedev
c607b2fbf8 [NFC][lit] Extract 'test time' reading/writing into standalone functions
Simply refactor code into reusable functions,
to allow read_test_times() to be reused later.
2021-03-22 15:25:32 +03:00
Roman Lebedev
f090e49be4 [NFC][lit] Add a test showing that timing data for tests not executed is lost
I.e. when you first run lit on a directory, and then on a single test,
the timing knowledge about anything else other than that single test
is lost. This isn't right.
2021-03-22 15:25:32 +03:00
Roman Lebedev
43b198106a [NFCI][lit] Unbreak more lit self-tests after D98179
All of these depend on the order of tests, so if one runs them twice,
the tests within them will naturally be reordered
using the previous run times, which breaks them.
2021-03-22 15:25:32 +03:00
Roman Lebedev
866f214e22 [NFC][lit] discovery: find_tests_for_inputs: avoid py warning when no suites found
If lit was run on a directory that contained no suites,
then naturally suite[0] will not be there,
and that line would cause python warnings.

So just predicate it with a check that it is there in the first place.
2021-03-22 15:25:32 +03:00
David Zarzycki
980d119a88 [lit] Sort testing summary output
As fallout from from the record-and-reorder work, people asked that the
summary output be sorted to aid diffing.
2021-03-20 07:52:08 -04:00
Martin Storsjö
f78f47ca31 Revert "[lit] Handle plain negations directly in the internal shell"
This reverts commit d09adfd3993cbc1043b4d20232bce8bd774232cc.

That commit caused failures in
clang-tidy/infrastructure/validate-check-names.cpp on windows
buildbots.

That change exposed a surprising issue, not directly related to
this change in itself, but in how TestRunner quotes command line
arguments that later are going to be interpreted by a msys based
tool (like grep.exe, when provided by Git for Windows). This
worked accidentally before, when grep was invoked via not.exe
which took a more conservative approach to windows argument quoting.
2021-03-19 12:33:12 +02:00
Martin Storsjö
a51f6cd556 [lit] Pass the USERPROFILE variable through on Windows
When running in a Windows Container, the Git for Windows Unix tools
(C:\Program Files\Git\usr\bin) just hang if this variable isn't
passed through.

Currently, running the LLVM/clang tests in a Windows Container fails
if that directory is added to the path, but succeeds after this change.
(After this change, the previously used GnuWin tools can be left out
entirely, too, as lit automatically picks up the Git for Windows tools
if necessary.)

Differential Revision: https://reviews.llvm.org/D98858
2021-03-19 09:38:19 +02:00
Martin Storsjö
307c740afc [lit] Handle plain negations directly in the internal shell
Keep running "not --crash" via the external "not" executable, but
for plain negations, and for cases that use the shell "!" operator,
just skip that argument and invert the return code.

The libcxx tests only use the shell operator "!" for negations,
never the "not" executable, because libcxx tests can be run without
having a fully built llvm tree available providing the "not"
executable.

This allows using the internal shell for libcxx tests.

Differential Revision: https://reviews.llvm.org/D98859
2021-03-19 09:33:26 +02:00
David Zarzycki
b6009ddce9 [lit] Harmonize test timing data between Unix and Windows
The "path" recorded for timing purposes is only used as a key into a dictionary. It is never used as an actual path to a filesystem API, therefore we should use '/' as the canonical separator so that Unix and Windows machines can share timing data. This also ensures that the lit testing works across platforms.

Reviewed By: jhenderson, jmorse

Differential Revision: https://reviews.llvm.org/D98767
2021-03-17 07:42:40 -04:00
Jeremy Morse
66e0244e31 Tweak spelling of system-windows UNSUPPORTED line 2021-03-16 16:52:00 +00:00
David Zarzycki
f2b6f6c181 [lit testing] Mark reorder.py as unavailable on Windows
The test file has embedded slashes. This is fine for normal users that
are just recording and reordering paths, but not great when the trace
data is committed back to a repository that should work on both Unix and
Windows.
2021-03-16 10:54:06 -04:00
David Zarzycki
0a3d22f26f [lit testing] Fix Windows reliability? 2021-03-16 09:11:41 -04:00
David Zarzycki
643090aa23 [lit] Sort test start times based on prior test timing data
Lit as it exists today has three hacks that allow users to run tests earlier:

1) An entire test suite can set the `is_early` boolean.
2) A very recently introduced "early_tests" feature.
3) The `--incremental` flag forces failing tests to run first.

All of these approaches have problems.

1) The `is_early` feature was until very recently undocumented. Nevertheless it still lacks testing and is a imprecise way of optimizing test starting times.
2) The `early_tests` feature requires manual updates and doesn't scale.
3) `--incremental` is undocumented, untested, and it requires modifying the *source* file system by "touching" the file. This "touch" based approach is arguably a hack because it confuses editors (because it looks like the test was modified behind the back of the editor) and "touching" the test source file doesn't work if the test suite is read only from the perspective of `lit` (via advanced filesystem/build tricks).

This patch attempts to simplify and address all of the above problems.

This patch formalizes, documents, tests, and defaults lit to recording the execution time of tests and then reordering all tests during the next execution. By reordering the tests, high core count machines run faster, sometimes significantly so.

This patch also always runs failing tests first, which is a positive user experience win for those that didn't know about the hidden `--incremental` flag.

Finally, if users want, they can _optionally_ commit the test timing data (or a subset thereof) back to the repository to accelerate bots and first-time runs of the test suite.

Reviewed By: jhenderson, yln

Differential Revision: https://reviews.llvm.org/D98179
2021-03-16 05:23:04 -04:00
Markus Böck
9badf35f5b Revert line accidentally included in af2796c76d2ff4b73165ed47959afd35a769beee 2021-03-15 21:03:46 +01:00
Markus Böck
1be4884f17 [test] Add ability to get error messages from CMake for errc substitution
Visual Studios implementation of the C++ Standard Library does not use strerror to produce a message for std::error_code unlike other standard libraries such as libstdc++ or libc++ that might be used.

This patch adds a cmake script that through running a C++ program gets the error messages for the POSIX error codes and passes them onto lit through an optional config parameter.

If the config parameter is not set, or getting the messages failed, due to say a cross compiling configuration without an emulator, it will fall back to using pythons strerror functions.

Differential Revision: https://reviews.llvm.org/D98278
2021-03-15 20:56:08 +01:00
Nico Weber
a8d425f07a [lit] rewrap a few lines to 80 columns
No behavior change.
2021-03-12 11:55:00 -05:00
Abhina Sreeskantharajan
4a1dabde23 [test] Use host platform specific error message substitution in lit tests
This patch uses the errno python library to print out the correct error messages instead of hardcoding the error message per platform.

Reviewed By: jhenderson, ASDenysPetrov

Differential Revision: https://reviews.llvm.org/D97472
2021-03-05 07:21:53 -05:00
Joel E. Denny
eaa132dc46 [lit] Add --ignore-fail
For some build configurations, `check-all` calls lit multiple times to
run multiple lit test suites.  Most recently, I've found this to be
true when configuring openmp as part of `LLVM_ENABLE_RUNTIMES`, but
this is not the first time.

If one test suite fails, none of the remaining test suites run, so you
cannot determine if your patch has broken them.  It can then be
frustrating to try to determine which `check-` targets will run the
remaining tests without getting stuck on the failing tests.

When such cases arise, it is probably best to adjust the cmake
configuration for `check-all` to run all test suites as part of one
lit invocation.  Because that fix will likely not be implemented and
land immediately, this patch introduces `--ignore-fail` to serve as a
workaround for developers trying to see test results until it does
land:

```
$ LIT_OPTS=--ignore-fail ninja check-all
```

One problem with `--ignore-fail` is that it makes it challenging to
detect test failures in a script, perhaps in CI.  This problem should
serve as motivation to actually fix the cmake configuration instead of
continuing to use `--ignore-fail` indefinitely.

Reviewed By: jhenderson, thopre

Differential Revision: https://reviews.llvm.org/D96371
2021-02-24 13:10:27 -05:00
David Zarzycki
c56e7eeef4 [lit testing] "END." not "END:" 2021-02-20 09:43:36 -05:00
David Zarzycki
81606a10c8 [lit] Add --xfail and --filter-out (inverse of --filter)
In semi-automated environments,  XFAILing or filtering out known regressions without actually committing changes or temporarily modifying the test suite can be quite useful.

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D96662
2021-02-20 05:43:29 -05:00
David Zarzycki
4d99d51ea2 [lit] Add "early_tests" config option
With enough cores, the slowest tests can significantly change the total testing time if they happen to run late. With this change, a test suite can improve performance (for high-end systems) by listing just a few of the slowest tests up front.

Reviewed By: jdenny, jhenderson

Differential Revision: https://reviews.llvm.org/D96594
2021-02-17 06:32:04 -05:00
Thomas Preud'homme
b894f8c766 Add lit config for dir with standalone tests
Some test systems do not use lit for test discovery but only for its
substitution and test selection because they use another way of managing
test collections, e.g. CTest. This forces those tests to be invoked with
lit --no-indirectly-run-check. When a mix of lit version is in use, it
requires to detect the availability of that option.

This commit provides a new config option standalone_tests to signal a
directory made of tests meant to run as standalone. When this option is
set, lit skips test discovery and the indirectly run check. It also adds
the missing documentation for --no-indirectly-run-check.

Reviewed By: jdenny

Differential Revision: https://reviews.llvm.org/D94766
2021-02-17 10:38:58 +00:00
Abhina Sreeskantharajan
e6f220185d [test] Use host platform specific error message substitution in lit tests - continued
On z/OS, other error messages are not matched correctly in lit tests.

```
EDC5121I Invalid argument.
EDC5111I Permission denied.
```

This patch adds a lit substitution to fix it.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D95808
2021-02-03 09:53:22 -05:00
xgupta
ddd3adad6f [Branch-Rename] Fix some links
According to the [[ https://foundation.llvm.org/docs/branch-rename/ | status of branch rename ]], the master branch of the LLVM repository is removed on 28 Jan 2021.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D95766
2021-02-01 16:43:21 +05:30
Abhina Sreeskantharajan
8fb00b74f1 [test] Use host platform specific error message substitution in lit tests
On z/OS, the following error message is not matched correctly in lit tests.

```
EDC5129I No such file or directory.
```

This patch uses a lit config substitution to check for platform specific error messages.

Reviewed By: muiez, jhenderson

Differential Revision: https://reviews.llvm.org/D95246
2021-01-29 07:16:30 -05:00
Julian Lettner
8ef46f8e36 [lit][NFC] Use enum to represent test order
Use an enum to more explicitly represent the test execution order.
2021-01-27 11:10:17 -08:00
Tom Stellard
1a410d196a Bump the trunk major version to 13
and clear the release notes.
2021-01-26 19:37:55 -08:00
Julian Lettner
f11e7efb47 [NFC][lit] Cleanup code using string interpolation
LLVM now requires Python 3.6, so we can use string interpolation to make
code more readable.
2021-01-26 13:04:31 -08:00
Julian Lettner
0aac51e35d Reland "[lit] Use os.cpu_count() to cleanup TODO"
The initial problem with the remaining bot config was resolved.

We can now use Python3.  Let's use `os.cpu_count()` to cleanup this
helper.

Differential Revision: https://reviews.llvm.org/D94734
2021-01-26 10:19:26 -08:00
Julian Lettner
ecf1c231ae [lit] Update lit.py shebang for Python3
Update shebang to always use Python3 when executing `lit.py` directly.

A previous change of mine [1] revealed that we still use Python2 on some
bot configurations that invoke `llvm/utils/lit/lit.py` as a script
directly (instead of `python3 path/to/lit.py`).

[1] https://reviews.llvm.org/D94734

Differential Revision: https://reviews.llvm.org/D95393
2021-01-25 17:29:57 -08:00
Julian Lettner
b139438d21 Revert "[lit] Use os.cpu_count() to cleanup TODO"
A bot owner contacted me.  I will re-land after confirming that this
doesn't break anyone (since it's low priority).

This reverts commit 9946b169c379daee603436a4753acfef8be373dd.
2021-01-25 13:32:30 -08:00
Julian Lettner
08fcf6f580 [lit] Use os.cpu_count() to cleanup TODO
We can now use Python3.  Let's use `os.cpu_count()` to cleanup this
helper.

Differential Revision: https://reviews.llvm.org/D94734
2021-01-25 11:44:18 -08:00
Julian Lettner
5970515ef3 Remove obsolete TODOs
Remove a few of my own TODOs that I will not have time to fix from lit
code.
2021-01-22 12:03:03 -08:00
serge-sans-paille
1734c4008a [lit] Harmonize lit and llvm versionning
In addition to consistency, we'll hit a wall when 11.1.0 gets released, because
we cannot represent it with lit versioning scheme.

Differential Revision: https://reviews.llvm.org/D94157
2021-01-19 10:27:14 +01:00