767 Commits

Author SHA1 Message Date
Julian Lettner
eab745a12b [lit] Move increase_process_limit to ParallelRun
Increasing the process limit only makes sense when we use multiple
processes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375474 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-22 01:13:30 +00:00
Julian Lettner
6556cd04b7 [lit] Simplify test scheduling via multiprocessing.Pool
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375458 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-21 21:57:18 +00:00
Julian Lettner
4d5ceef545 [lit] Remove redundancy from names and comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375456 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-21 21:41:59 +00:00
Martin Storsjo
9cc8630a80 [LLDB] [Windows] Initial support for ARM register contexts
Differential Revision: https://reviews.llvm.org/D69226

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375392 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-21 08:02:34 +00:00
Julian Lettner
ba0c352c6a [lit] Reduce value of synthesized timeouts
Large timeout values (one year, positive infinity) trip up Python on
Windows with "OverflowError: timeout value is too large".  One week
seems to work and is still large enough in practice.

Thanks to Simon Pilgrim for helping me test this.
https://reviews.llvm.org/rL375171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375264 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-18 17:59:46 +00:00
Julian Lettner
e645d060ae [lit] Remove unnecessary tracking of test_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375263 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-18 17:31:48 +00:00
Julian Lettner
59c08c3477 [lit] Only send back test result from worker process
Avoid sending back the whole run.Test object (which needs to be pickled)
from the worker process when we are only interested in the test result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375262 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-18 17:31:45 +00:00
Julian Lettner
6960eb5d78 [lit] Move resolving of XFAIL result codes out of Test.setResult
This will allow us to serialize just the result object instead of the
whole lit.Test object back from the worker to the main lit process.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375195 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-18 00:50:37 +00:00
Julian Lettner
55b2e86a09 [lit] worker.py: Improve code for executing a single test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375194 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-18 00:50:34 +00:00
Julian Lettner
8e3f7b624f [lit] Move computation of deadline up into base class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375171 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 21:12:45 +00:00
Julian Lettner
ec36eeaa5c Reland "[lit] Synthesize artificial deadline"
We always want to use a deadline when calling `result.await`.  Let's
synthesize an artificial deadline (now plus one year) to simplify code
and do less busy waiting.

Thanks to Reid Kleckner for diagnosing that a deadline for of "positive
infinity" does not work with Python 3 anymore.  See commit:
4ff1e34b606d9a9fcfd8b8b5449a558315af94e5

I tested this patch with Python 2 and Python 3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375165 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 20:22:32 +00:00
Reid Kleckner
88d01bc2df Revert [lit] Synthesize artificial deadline
Python on Windows raises this OverflowError:
      gotit = waiter.acquire(True, timeout)
  OverflowError: timestamp too large to convert to C _PyTime_t

So it seems this API behave the same way on every OS.

Also reverts the dependent commit a660dc590a5e8dafa1ba6ed56447ede151d17bd9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375143 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 17:44:35 +00:00
Julian Lettner
7ad952b0ff [lit] Move computation of deadline up into base class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375130 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 16:01:21 +00:00
Julian Lettner
572aefc147 [lit] Synthesize artificial deadline
We always want to use a deadline when calling `result.await`.  Let's
synthesize an artificial deadline (positive infinity) to simplify code
and do less busy waiting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375129 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 16:01:18 +00:00
Julian Lettner
57248b68a1 [lit] Create derived classes for serial/parallel test runs
The hope is that with a little OO we can nicely factor out the
differences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375128 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 16:01:15 +00:00
Joel E. Denny
21e7ff5277 Revert r375114: "[lit] Make internal diff work in pipelines"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375121 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 14:43:42 +00:00
Joel E. Denny
99bc241cb4 Revert r375116: "[lit] Extend internal diff to support - argument"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375120 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 14:43:26 +00:00
Joel E. Denny
2200a32785 [lit] Extend internal diff to support - argument
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

Differential Revision: https://reviews.llvm.org/D67643

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375116 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 14:03:06 +00:00
Joel E. Denny
80b7aace9f [lit] Make internal diff work in pipelines
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
 # RUN: not diff file1 file2 | FileCheck %s
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Reviewed By: probinson, stella.stamenova

Differential Revision: https://reviews.llvm.org/D66574

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375114 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 14:02:42 +00:00
Julian Lettner
8e00d5acbc [lit] Improve lit.Run class
* Push timing of overall test time into run module
* Make lit.Run a proper class
* Add a few TODO comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375065 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-17 00:29:59 +00:00
Julian Lettner
a6de5ed4b6 [lit] Remove unnecessary usage of lit.Run
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375056 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 23:31:32 +00:00
Julian Lettner
d01bcfd870 [lit] Do not create semaphores when we do not need them
Parallelism groups and semaphores are only required for parallel
execution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375055 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 23:25:46 +00:00
Julian Lettner
d929a071f2 [lit] Factor out separate methods for parallel and serial execution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375054 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 23:25:41 +00:00
Julian Lettner
19cf7f7558 [lit] Print warning if we fail to delete temp directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375049 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 22:20:28 +00:00
Julian Lettner
c298784718 [lit] Skip creation of tmp dir if we don't actually run any tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375048 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 22:20:25 +00:00
Julian Lettner
ecf878f5f9 [lit] Remove return value from print_summary function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375047 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 21:58:21 +00:00
Julian Lettner
00357bdb47 [lit] Small refactoring and cleanups in main.py
* Remove outdated precautions for Python versions < 2.7
* Remove dead code related to `maxIndividualTestTime` option
* Move printing of test and result summary out of main into its own
  function

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68847

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375046 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 21:53:20 +00:00
Joel E. Denny
e65499709f [lit] Fix internal diff's --strip-trailing-cr and use it
Using GNU diff, `--strip-trailing-cr` removes a `\r` appearing before
a `\n` at the end of a line.  Without this patch, lit's internal diff
only removes `\r` if it appears as the last character.  That seems
useless.  This patch fixes that.

This patch also adds `--strip-trailing-cr` to some tests that fail on
Windows bots when D68664 is applied.  Based on what I see in the bot
logs, I think the following is happening.  In each test there, lit
diff is comparing a file with `\r\n` line endings to a file with `\n`
line endings.  Without D68664, lit diff reads those files in text
mode, which in Windows causes `\r\n` to be replaced with `\n`.
However, with D68664, lit diff reads the files in binary mode instead
and thus reports that every line is different, just as GNU diff does
(at least under Ubuntu).  Adding `--strip-trailing-cr` to those tests
restores the previous behavior while permitting the behavior of lit
diff to be more like GNU diff.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68839

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375020 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 17:21:57 +00:00
Joel E. Denny
53ed4a35c6 [lit] Clean up internal diff's encoding handling
As suggested by rnk at D67643#1673043, instead of reading files
multiple times until an appropriate encoding is found, read them once
as binary, and then try to decode what was read.

For Python >= 3.5, don't fail when attempting to decode the
`diff_bytes` output in order to print it.

Avoid failures for Python 2.7 used on some Windows bots by
transforming diff output with `lit.util.to_string` before writing it
to stdout.

Finally, add some tests for encoding handling.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68664

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375018 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-16 17:21:24 +00:00
Julian Lettner
24b3237135 [lit] Add back LitTestCase
This essentially reverts a commit [1] that removed the adaptor for
Python unittests.  The code has been slightly refactored to make it more
additive: all code is contained in LitTestCase.py.

Usage sites will require a small adaption:
```
[old]
  import lit.discovery
  ...
  test_suite = lit.discovery.load_test_suite(...)

[new]
  import lit.LitTestCase
  ...
  test_suite = lit.LitTestCase.load_test_suite(...)
```

This was put back on request by Daniel Dunbar, since I wrongly assumed
that the functionality is unused.  At least llbuild still uses this [2].

[1] 70ca752ccf6a8f362aea25ccd3ee2bbceca93b20
[2] https://github.com/apple/swift-llbuild/blob/master/utils/Xcode/LitXCTestAdaptor/LitTests.py#L16

Reviewed By: ddunbar

Differential Revision: https://reviews.llvm.org/D69002

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374947 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-15 20:57:20 +00:00
Martin Storsjo
2413824526 [LLDB] [Windows] Initial support for ARM64 register contexts
Differential Revision: https://reviews.llvm.org/D67954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374866 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-15 08:31:52 +00:00
Julian Lettner
dc141ad7cd [lit] Add argument check: --timeout must be non-negative integer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374847 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 23:43:18 +00:00
Julian Lettner
112183e642 [lit] Create Run object later and only when it is needed
Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68843

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374823 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 21:23:40 +00:00
Jan Korous
cd6a99c88b [clang-scan-deps] Support for clang --analyze in clang-scan-deps
The goal is to have 100% fidelity in clang-scan-deps behavior when
--analyze is present in compilation command.

At the same time I don't want to break clang-tidy which expects
__static_analyzer__ macro defined as built-in.

I introduce new cc1 options (-setup-static-analyzer) that controls
the macro definition and is conditionally set in driver.

Differential Revision: https://reviews.llvm.org/D68093

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374815 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 20:15:01 +00:00
Joel E. Denny
9ef9df39b3 [lit] Extend internal diff to support -U
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff -U1 file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-U` as a command-line option.  This patch adds `-U`
support.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68668

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374814 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 19:59:30 +00:00
Joel E. Denny
8bd3244955 Revert r374648: "Reland r374388: [lit] Make internal diff work in pipelines"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374683 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:52:46 +00:00
Joel E. Denny
b1773ab764 Revert r374649: "Reland r374389: [lit] Clean up internal diff's encoding handling"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374682 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:52:31 +00:00
Joel E. Denny
bedf608538 Revert r374650: "Reland r374390: [lit] Extend internal diff to support - argument"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374681 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:52:18 +00:00
Joel E. Denny
736ef88b55 Revert 374651: "Reland r374392: [lit] Extend internal diff to support -U"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374680 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:52:05 +00:00
Joel E. Denny
24feaedf06 Revert r374652: "[lit] Fix internal diff's --strip-trailing-cr and use it"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374679 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:51:51 +00:00
Joel E. Denny
672549cb42 Revert r374653: "[lit] Fix a few oversights in r374651 that broke some bots"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374678 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:51:34 +00:00
Joel E. Denny
b8076b72b3 Revert r374665: "[lit] Try yet again to fix new tests that fail on Windows bots"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374677 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:51:18 +00:00
Joel E. Denny
7144abf41b Revert r374666: "[lit] Adjust error handling for decode introduced by r374665"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374676 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:51:08 +00:00
Joel E. Denny
e2997b8a72 Revert r374671: "[lit] Try errors="ignore" for decode introduced by r374665"
This series of patches still breaks a Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374675 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 18:50:57 +00:00
Joel E. Denny
dadea982aa [lit] Try errors="ignore" for decode introduced by r374665
Still trying to fix the same error as in r374666.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374671 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 17:23:25 +00:00
Joel E. Denny
1626dfb57c [lit] Adjust error handling for decode introduced by r374665
On that decode, Windows bots fail with:

```
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
```

That's the same error as before r374665 except it's now at the decode
before the write to stdout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374666 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 16:25:46 +00:00
Joel E. Denny
d9ef744d5b [lit] Try yet again to fix new tests that fail on Windows bots
I seem to have misread the bot logs on my last attempt.  When lit's
internal diff runs on Windows under Python 2.7, it's text diffs not
binary diffs that need decoding to avoid this error when writing the
diff to stdout:

```
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
```

There is no `decode` attribute in this case under Python 3.6.8 under
Ubuntu, so this patch checks for the `decode` attribute before using
it here.  Hopefully nothing else is needed when `decode` isn't
available.

It might take a couple more attempts to figure out what error
handling, if any, is needed for this decoding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374665 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 16:00:35 +00:00
Joel E. Denny
4822201348 Revert r374657: "[lit] Try again to fix new tests that fail on Windows bots"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374664 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 16:00:25 +00:00
Joel E. Denny
383b3a14b6 [lit] Try again to fix new tests that fail on Windows bots
Based on the bot logs, when lit's internal diff runs on Windows, it
looks like binary diffs must be decoded also for Python 2.7.
Otherwise, writing the diff to stdout fails with:

```
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
```

I did not need to decode using Python 2.7.15 under Ubuntu.  When I do
it anyway in that case, `errors="backslashreplace"` fails for me:

```
TypeError: don't know how to handle UnicodeDecodeError in error callback
```

However, `errors="ignore"` works, so this patch uses that, hoping
it'll work on Windows as well.

This patch leaves `errors="backslashreplace"` for Python >= 3.5 as
there's no evidence yet that doesn't work and it produces more
informative binary diffs.  This patch also adjusts some lit tests to
succeed for either error handler.

This patch adjusts changes introduced by D68664.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374657 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 14:58:43 +00:00
Joel E. Denny
b47ea95d9b Revert r374654: "[lit] Try to fix new tests that fail on Windows bots"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374656 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 14:58:30 +00:00