1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
Commit Graph

826 Commits

Author SHA1 Message Date
Julian Lettner
ce57305010 [lit] Fix test that relied on "single process" mode
The shtest-inject test relied on being executed in "single process" mode
and started to fail with a `PicklingError` after it was removed:
```
  Can't pickle <class 'lit.TestingConfig.CustomFormat'>: attribute
  lookup lit.TestingConfig.CustomFormat failed
```

This happened because the test config has to be serialized to the worker
process, but apparently the `CustomFormat` class defined inline is not
serializable.

This change allows passing the tested functionality (preamble_commands)
directly to `lit.formats.ShTest` so we can use it directly in the test.
2020-03-30 21:58:48 -07:00
Julian Lettner
ba171cfc9a [lit] Remove single process mode
Remove the "serial run" abstraction which bypasses Python's
`multiprocessing.Pool` and instead directly runs tests without spawning
worker processes.  This abstraction has not offered the benefits I hoped
it would and therefore does not carry its weight.
2020-03-30 21:58:48 -07:00
Julian Lettner
1853af1a9e [lit] Send back whole lit.Test object from worker process
In previous commits [1,2] I changed worker.py to only send back the test
result from the worker process instead of the whole test object.  This
was a mistake.  lit.Test contains fields (e.g., xfials, requires,
unsupported) that are only populated when we actually execute the test,
but are queried when we report the results in the parent process.  This
commit essentially reverts the following changes:

[1] a3d2f9b53ac006cb972b61b0dbfcb5babe4356bf
[2] 17bb660fb83e869652ac87b145b0e26b708aab60
2020-03-30 21:58:48 -07:00
Julian Lettner
245d123cd8 [lit] Use Python's support for None in array slice indexing 2020-03-30 12:44:03 -07:00
Julian Lettner
2723dcfb82 [lit] Avoid global imports in module declaration
A previous attempt to cleanup module imports broke installing via
pip/setup.py [1].  This should be fixed now.

[1] cf252240e8819d0c90a5e10f773078bdeba33e44

Reviewed By: paquette

Differential Revision: https://reviews.llvm.org/D76940
2020-03-27 12:07:19 -07:00
Louis Dionne
c0a8592f8a [lit] NFC: Move the flaky test logic to _runShTest
This minor refactoring allows reducing the amount of processing that
is duplicated when we re-run a flaky test. It also has the nice
side effect that libc++'s current test format supports flaky .sh.cpp
tests, because those are built on top of _runShTest, not executeShTest.
2020-03-27 09:32:58 -04:00
Louis Dionne
eef1e9e29f [lit] Recursively expand substitutions
This allows defining substitutions in terms of other substitutions. For
example, a %build substitution could be defined in terms of a %cxx
substitution as '%cxx %s -o %t.exe' and the script would be properly
expanded.

Differential Revision: https://reviews.llvm.org/D76178
2020-03-27 09:25:26 -04:00
Louis Dionne
8126913310 [lit] NFC: Remove trailing whitespace
I keep having to remove them from my diffs!
2020-03-26 11:05:18 -04:00
Louis Dionne
e8ebe9cd4f [lit] Allow passing extra commands to executeShTest
This allows creating custom test formats on top of `executeShTest` that
inject commands at the beginning of the file being parsed, without
requiring these commands to physically appear in the test file itself.

For example, one could define a test format that prints out additional
debug information at the beginning of each test. More realistically,
this has been used to define custom test formats like one that supports
compilation failure tests (e.g. with the extension `compile.fail.cpp`)
by injecting a command that calls the compiler on the file itself and
expects it to fail.

Without this change, the only alternative is to create a temporary file
with the same content as the original test, then prepend the desired
`// RUN:` lines to that file, and call `executeShTest` on that file
instead. This is both slow and cumbersome to do.

Differential Revision: https://reviews.llvm.org/D76290
2020-03-24 15:02:37 -04:00
Louis Dionne
c0d7629008 [lit] Add builtin support for flaky tests in lit
This commit adds a new keyword in lit called ALLOW_RETRIES. This keyword
takes a single integer as an argument, and it allows the test to fail that
number of times before it first succeeds.

This work attempts to make the existing test_retry_attempts more flexible
by allowing by-test customization, as well as eliminate libc++'s FLAKY_TEST
custom logic.

Differential Revision: https://reviews.llvm.org/D76288
2020-03-18 18:04:01 -04:00
Louis Dionne
3a511e1f32 [lit] NFC: Fix typo in log statement 2020-03-17 16:49:56 -04:00
Peter Collingbourne
160569ecbc Revert "Rework go bindings so that validation works fine"
And add llvm-go back to the test dependencies.

No longer necessary now that llvm-go has been brought back.

This reverts commit e8f8873da5eaad187f82dad78ebdb3ab3df22b36.
2020-02-24 09:20:08 -08:00
serge-sans-paille
dc28731793 Fix lit version test
Looks like on some system, version is printed on stderr, on some it's on stdout...
2020-02-13 21:49:48 +01:00
serge-sans-paille
2f80dd8494 Fix handling of --version in lit
There's no reason why we should require a directory when asking for the version.

Differential Revision: https://reviews.llvm.org/D74553
2020-02-13 21:36:12 +01:00
serge-sans-paille
eff8b15a75 Rework go bindings so that validation works fine
Basically change the layout to please `go build` and remove references to
`llvm-go`.

Update llvm/test/Bindings/Go/ to use the system go compiler

Differential Revision: https://reviews.llvm.org/D74540
2020-02-13 14:13:03 +01:00
Hans Wennborg
54ef354524 Bump the trunk major version to 11
and clear the release notes.
2020-01-15 13:38:01 +01:00
Nico Weber
8b63012d97 Make check-llvm run 50% faster on macOS, 18% faster on Windows.
While looking at cycle time graphs of some of my bots, I noticed
that 327894859cc made check-llvm noticeably slower on macOS and
Windows.

As it turns out, the 5 substitutions added in that change were
enough to cause lit to thrash the build-in cache in re.compile()
(re.sub() is implemented as re.compile().sub()), and apparently
applySubstitutions() is on the cricital path and slow when all
regexes need to compile all the time.

(See `_MAXCACHE = 512` in cpython/Lib/re.py)

Supporting full regexes for lit substitutions seems a bit like
overkill, but for now add a simple unbounded cache to recover
the lost performance.

No intended behavior change.
2020-01-06 12:57:42 -05:00
Jessica Paquette
d0d7cd1383 [lit] Add "from .main import main" back into lit/__init__.py
A refactoring commit (cf252240) removed this line. Removing it broke installing
lit with pip and setup.py.

This adds the line back in so that we can install lit again.

For an example of how this appeared, see:

http://green.lab.llvm.org/green/job/LNT_Tests/5853/

File "/Users/buildslave/jenkins/...s/__init__.py", line 2453, in resolve
    raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'main'
2019-12-19 16:09:27 -08:00
Nemanja Ivanovic
0632710cc6 Fix buildbot failures after removing REQUIRES-ANY
It would appear that the removal of this lit feature was incomplete
and there is a test case that still tests for this. This patch removes
the remaining tests to bring the bots back to green. I would encourage the
author to do a post-commit review on this in case there is a more desirable fix.
2019-12-17 15:27:45 -06:00
Joel E. Denny
f8d4bf3133 [lit] Fix internal diff newlines for -w/-b
For example, without this patch:

```
$ python $LIT_BUILTINS/diff.py -b foo.txt bar.txt
*** /tmp/foo.txt
--- /tmp/bar.txt
***************
*** 1,2 ****
  1! 2--- 1,2 ----
  1! 20
```

With this patch:

```
$ python $LIT_BUILTINS/diff.py -b foo.txt bar.txt
*** /tmp/foo.txt
--- /tmp/bar.txt
***************
*** 1,2 ****
  1
! 2
--- 1,2 ----
  1
! 20
```

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D71577
2019-12-17 10:49:34 -05:00
Thomas Preud'homme
3ee7afa35c [lit] Remove lit's REQUIRES-ANY directive
Summary:
Remove REQUIRES-ANY alias lit directive since it is hardly used and can
be easily implemented using an OR expression using REQUIRES. Fixup
remaining testcases still using REQUIRES-ANY.

Reviewers: probinson, jdenny, gparker42

Reviewed By: gparker42

Subscribers: eugenis, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, delcypher, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits, #sanitizers, llvm-commits

Tags: #llvm, #clang, #sanitizers

Differential Revision: https://reviews.llvm.org/D71408
2019-12-17 10:36:36 +00:00
Martin Storsjö
f741c409e0 [lit] [windows] Make sure to convert all path separators to backslashes in NT style \\?\... paths
E.g. the mingw python distributed in msys2 (the mingw one, which is a
normal win32 application and doesn't use the msys2 runtime itself),
despite being a normal win32 python, still uses forward slashes. This
works fine for other cases (many, but not all), but when constructing a
raw NT path, all path separators must be backslashes.

Differential Revision: https://reviews.llvm.org/D71490
2019-12-17 10:08:53 +02:00
Julian Lettner
0104e43c85 [lit] max_failures does not need to be stored in LitConfig 2019-12-16 10:08:57 -08:00
Julian Lettner
1be986ee4e [lit] Small cleanups. NFCI
Remove unnecessary (argument same as default), cleanup imports, use
"pythonic" names for variables, and general formatting.
2019-12-13 17:00:04 -08:00
Julian Lettner
88ba9a7d64 [lit] Improve formatting of error messages. NFC 2019-12-11 14:39:39 -08:00
Daniel Sanders
36fe0c5f62 Fix sed -e s@FOO@%/S@ and similar when there's @'s in the working directory
Jenkins sometimes starts a new working directory by appending @2 (or
incrementing the number if the @n suffix is already there). This causes
several clang tests to fail as:
  s@INPUT_DIR@%/S/Inputs@g
gets expanded to the invalid:
  s@INPUT_DIR@/path/to/workdir@2/Inputs@g
                               ~~~~~~~~~~
where the part marked with ~'s is interpreted as the flags. These are
invalid and the test fails.

Previous fixes simply exchanged the @ character for another like | but
that's just moving the problem. Address it by adding an expansion that
escapes the @ character we're using as a delimiter as well as other magic
characters in the replacement of sed's s@@@.

There's still room for expansions to cause trouble though. One I ran into
while testing this was that having a directory called foo@bar causes lots
of `CHECK-NOT: foo` directives to match. There's also things like
directories containing `\1`
2019-12-03 15:44:01 -08:00
Julian Lettner
48e119873e [lit] Be more explicit about the state of tests
Tests go through the following stages:
  *) discovered
  *) filtered
  *) executed

Only executed tests have a result (e.g., PASS, FAIL, XFAIL, etc.).  See
"result codes" in Test.py.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D70612
2019-12-02 10:16:54 -08:00
Julian Lettner
e9ff04cb02 [lit] Attempt to print test summary on CTRL+C 2019-11-22 10:57:33 -08:00
Paul Robinson
d53523508c Fix up lit's tests to run in a multi-config build environment.
Differential Revision: https://reviews.llvm.org/D70239
2019-11-14 11:24:41 -08:00
Sumanth Gundapaneni
a15681f3b2 Update lit infra to detect "MemoryWithOrigins' sanitizer build.
Differential Revision: https://reviews.llvm.org/D68399
2019-11-14 12:57:17 -06:00
Julian Lettner
95339f1d20 [lit] Better/earlier errors for empty runs
Fail early, when we discover no tests at all, or filter out all of them.

There is also `--allow-empty-runs` to disable test to allow workflows
like `LIT_FILTER=abc ninja check-all`.  Apparently `check-all` invokes
lit multiple times if certain projects are enabled, which would produce
unwanted "empty runs". Specify via `LIT_OPTS=--allow-empty-runs`.

There are 3 causes for empty runs:
1) No tests discovered.  This is always an error.  Fix test suite config
   or command line.
2) All tests filtered out.  This is an error by default, but can be
   suppressed via `--alow-empty-runs`.  Should prevent accidentally
   passing empty runs, but allow the workflow above.
3) The number of shards is greater than the number of tests.  Currently,
   this is never an error.  Personally, I think we should consider
   making this an error by default; if this happens, you are doing
   something wrong. I added a warning but did not change the behavior,
   since this warrants more discussion.

Reviewed By: atrick, jdenny

Differential Revision: https://reviews.llvm.org/D70105
2019-11-12 09:11:36 -08:00
Joel E. Denny
7fc52c9da6 [lit] Protect full test suite from FILECHECK_OPTS
lit's test suite calls lit multiple times for various sample test
suites.  `FILECHECK_OPTS` is safe for FileCheck calls in lit's test
suite.  It's not safe for FileCheck calls in the sample test suites,
whose output affects the results of lit's test suite.

Without this patch, only one such sample test suite is protected from
`FILECHECK_OPTS`, and currently `shtest-shell.py` breaks with
`FILECHECK_OPTS=-vv`.  Moreover, it's hard to predict the future,
especially false passes.  Thus, this patch protects all existing and
future sample test suites from `FILECHECK_OPTS` (and the deprecated
`FILECHECK_DUMP_INPUT_ON_FAILURE`).

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D65156
2019-11-06 16:25:25 -05:00
Volodymyr Sapsai
2d616bdac4 Revert "[analyzer] Add test directory for scan-build."
This reverts commit 0aba69eb1a01c44185009f50cc633e3c648e9950 with
subsequent changes to test files.

It caused test failures on GreenDragon, e.g.,
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/
2019-11-05 14:03:36 -08:00
Julian Lettner
0752aef3ee Revert "[lit] Better/earlier errors when no tests are executed"
This reverts commit d8f2bff75126c6dde694ad245f9807fa12ad5630.
2019-11-05 12:10:43 -08:00
Joel E. Denny
729f23e751 [lit] Fix not calling internal commands
Without this patch, when using lit's internal shell, if `not` on a lit
RUN line calls `env`, `diff`, or any of the other in-process shell
builtins that lit implements, lit accidentally searches for the latter
as an external executable.  What's worse is that works fine when a
developer is testing on a platform where those executables are
available and behave as expected, but it then breaks on other
platforms.

`not` seems useful for some builtins, such as `diff`, so this patch
supports such uses.  `not --crash` does not seem useful for builtins,
so this patch diagnoses such uses.  In all cases, this patch ensures
shell builtins are found behind any sequence of `env` and `not`
commands.

`not` calling `env` calling an external command appears useful when
the `env` and external command are part of a lit substitution, as in
D65156.  This patch supports that by looking through any sequence of
`env` and `not` commands, building the environment from the `env`s,
and storing the `not`s.  The `not`s are then added back to the command
line without the `env`s to execute externally.  This avoids the need
to replicate the `not` implementation, in particular the `--crash`
option, in lit.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D66531
2019-11-05 14:09:21 -05:00
Devin Coughlin
902d726973 [analyzer] Add test directory for scan-build.
The static analyzer's scan-build script is critical infrastructure but
is not well tested. To start to address this, add a new test directory under
tests/Analysis for scan-build lit tests and seed it with several tests. The
goal is that future scan-build changes will be accompanied by corresponding
tests.

Differential Revision: https://reviews.llvm.org/D69781
2019-11-04 20:26:35 -08:00
Julian Lettner
b26b6f0aa3 [lit] Move measurement of testing time out of Run.execute 2019-11-04 10:16:24 -08:00
Julian Lettner
726e2ac362 [lit] Better/earlier errors when no tests are executed
Fail early, when we discover no tests at all, or filter out all of them.
2019-11-04 10:16:24 -08:00
Joel E. Denny
723914170d [lit] Fix internal env calling env
Without this patch, when using lit's internal shell, if `env` on a lit
RUN line calls `env`, lit accidentally searches for the latter as an
external executable.  What's worse is that works fine when a developer
is testing on a platform where `env` is available and behaves as
expected, but it then breaks on other platforms.

`env` calling `env` can make sense if one such `env` is within a lit
substitution, as in D65156 and D65121.  This patch ensures that lit
executes both as internal commands.

Reviewed By: probinson, mgorny, rnk

Differential Revision: https://reviews.llvm.org/D65697
2019-11-01 14:08:52 -04:00
Julian Lettner
bf5dfd5af4 [lit] Extract Display.print_header function 2019-10-31 11:43:20 -07:00
Julian Lettner
a7dbaf3c9c [lit] Always print newline before test time/summary
Slightly decreases the time I need to parse the test summary.
2019-10-31 11:43:20 -07:00
Joel E. Denny
02f7cc6f6f [lit] Fix internal env calling other internal commands
Without this patch, when using lit's internal shell, if `env` on a lit
RUN line calls `cd`, `mkdir`, or any of the other in-process shell
builtins that lit implements, lit accidentally searches for the latter
as an external executable.

This patch puts such builtins in a map so that boilerplate for them
need be implemented only once.  This patch moves that handling after
processing of `env` so that `env` calling such a builtin can be
detected.  Finally, because such calls appear to be useless, this
patch takes the safe approach of diagnosing them rather than
supporting them.

Reviewed By: probinson, mgorny, rnk

Differential Revision: https://reviews.llvm.org/D66506
2019-10-31 14:37:51 -04:00
Julian Lettner
2b77dc62da [lit] Rename ProgressDisplay -> Display 2019-10-31 10:23:19 -07:00
Reid Kleckner
d6b52c4d18 [lit] Add missing import
Apparently llvm-lit.py does not execute this path
2019-10-30 16:32:28 -07:00
Reid Kleckner
fbcf20e723 [lit] Silence warning about importing the resource module on Windows
lit was printing this warning on every test run on Windows, and that is
not necessary.
2019-10-30 16:11:16 -07:00
Julian Lettner
176ef08004 [lit] Change progress bar color to red on first failure 2019-10-30 15:09:43 -07:00
Julian Lettner
1ad1c85e01 [lit] Add helper for test.result.code.isFailure 2019-10-30 15:09:43 -07:00
Julian Lettner
aa70a4bf1b [lit] Extract _install_win32_signal_handler function 2019-10-30 15:09:43 -07:00
Julian Lettner
7eb9e9c81c [lit] Refactor ordering of tests 2019-10-29 17:49:23 -07:00
Julian Lettner
eb34e6096d [lit] Small improvements in cl_arguments.py
*) `--max-tests` should be positive integer
*) `--max-time` should be positive integer
*) Remove unnecessary defaults for command line option parsing
2019-10-29 16:46:35 -07:00