675 Commits

Author SHA1 Message Date
Alexey Bader
dc76bdf5ab [LIT] Emit timeout error message only if timeout was reached
Summary:
This improves readability of LIT output: previously
error messages gets emitted that say that there was no error:

error: command reached timeout: False

Patch by Alexey Sachkov.

Reviewers: ddunbar, mgorny, modocache

Reviewed By: mgorny

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365895 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 12:48:43 +00:00
Alex Lorenz
4621d012c8 NFC: lit: python3 compatibility for functions
usePlatformSdkOnDarwin/findPlatformSdkVersionOnMacOS

These functions should decode subprocess output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365852 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 00:48:53 +00:00
Joel E. Denny
31d19a7f8b [lit] Parse command-line options from LIT_OPTS
Similar to `FILECHECK_OPTS` for FileCheck, `LIT_OPTS` makes it easy to
adjust lit behavior when running the test suite via ninja.  For
example:

```
$ LIT_OPTS='--time-tests -vv --filter=threadprivate' \
  ninja check-clang-openmp
```

Reviewed By: probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365313 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-08 12:18:40 +00:00
Adrian McCarthy
2e02d2b3a3 Fix some lit test ResourceWarnings on Windows
When running LLDB lit tests on Windows, the system selects a debug version
of Python, which was issuing lots of ResourceWarnings about files that
weren't closed.  There are two kinds of them, and each test triggered one
of each.

This patch fixes one kind by ensuring TestRunner explicitly close the
temporary files created for routing stderr.  This is important on Windows
but has no net effect on Posix systems.

The remaining ResourceWarnings are more elusive; the bug may lie in
the Python library subprocess.py, and it may be Windows-specific.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363700 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 16:36:57 +00:00
Michal Gorny
a2091d4165 [lit] Fix UnicodeEncodeError when test commands contain non-ASCII chars
Ensure that the bash script written by lit TestRunner is open with UTF-8
encoding when using Python 3.  Otherwise, attempt to write non-ASCII
characters causes UnicodeEncodeError.  This happened e.g. with
the following LLD test:

UNRESOLVED: lld :: ELF/format-binary-non-ascii.s (657 of 2119)
******************** TEST 'lld :: ELF/format-binary-non-ascii.s' FAILED ********************
Exception during script execution:
Traceback (most recent call last):
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/worker.py", line 63, in _execute_test
    result = test.config.test_format.execute(test, lit_config)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/formats/shtest.py", line 25, in execute
    self.execute_external)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1644, in executeShTest
    res = _runShTest(test, litConfig, useExternalSh, script, tmpBase)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1590, in _runShTest
    res = executeScript(test, litConfig, tmpBase, script, execdir)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1157, in executeScript
    f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')
UnicodeEncodeError: 'ascii' codec can't encode character '\xa3' in position 274: ordinal not in range(128)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363388 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-14 13:31:48 +00:00
Nico Weber
f4057b6f1c Revert r363298 "[lit] Disable test on darwin when building shared libs."
It broke running check-lld on mac, see https://reviews.llvm.org/D61697

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363379 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-14 12:58:17 +00:00
Don Hinton
8de7c8d60d [lit] Disable test on darwin when building shared libs.
Summary:
This test fails to link shared libraries because tries to run
a copied version of clang-check to see if the mock version of libcxx
in the same directory can be loaded dynamically.  Since the test is
specifically designed not to look in the default just-built lib
directory, it must be disabled when building with
BUILD_SHARED_LIBS=ON.

Currently only disabling it on Darwin and basing it on the
enable_shared flag.

Reviewed By: ilya-biryukov

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363298 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-13 19:08:49 +00:00
Adrian McCarthy
33bde05820 Fix string literals to avoid deprecation warnings in regexp patterns
In LLDB, where tests run with the debug version of Python, we get a
series of deprecation warnings because escape sequences like `\(` are
being treated as part of the string literal rather than an escape for
the regexp pattern.

NFC intended.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362846 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-07 21:14:33 +00:00
Stella Stamenova
07f4b9d2aa lit: modernize the lit configuration for the lit tests
Summary: This also normalizes the config feature that represents the windows platform to "system-windows" as opposed to having both "windows" and "system-windows"

Reviewers: asmith, probinson

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361998 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-29 18:07:39 +00:00
Paul Robinson
b5d252509b Stop defining negative versions of some lit feature keywords:
zlib/nozlib, asan/not_asan, msan/not_msan, ubsan/not_ubsan.

We still have two other ways to express the absence of a feature.
First, we have the '!' operator to invert the sense of a keyword.  For
example, given a feature that depends on zlib being unavailable, its
test can say:
    REQUIRES: !zlib

Second, if a test doesn't play well with some features, such as
sanitizers, that test can say:
    UNSUPPORTED: asan, msan

The different ways of writing these exclusions both have the same
technical effect, but have different implications to the reader.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360603 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 17:18:58 +00:00
Stella Stamenova
80aab18585 Use UNSUPPORTED: windows in shtest-timeout.py. Apparently system-windows does not cover all cases either and the case it doesn't cover affects one of the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360373 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 20:22:02 +00:00
Stella Stamenova
e9c0fded7c Use UNSUPPORTED: system-windows instead of REQUIRES: nowindows or UNSUPPORTED: windows. nowindows is not currently defined and windows does not cover all cases. system-windows is also consistent with how other platforms are used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360368 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 19:40:21 +00:00
Paul Robinson
9371c75a2b Re-enable lit test shtest-timeout.py on non-Windows.
It was disabled incorrectly, which meant it wasn't running anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360356 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 17:01:03 +00:00
Alex Lorenz
71abe189dd lit config: disable LSan for Apple clang compiler in addition to Apple LLVM
Apple clang is the canonical way to refer to the compiler shipped with Xcode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360307 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 02:46:20 +00:00
Hubert Tong
92bb3811f2 [lit][tests][AIX] Update expected form of diagnostic messages; use not to normalize non-zero exit values
Summary:
Various tests in the `lit` testing suite expect specific return codes
and forms of diagnostic message from utility programs. As per
POSIX.1-2017 XCU Section 1.4, Utility Description Defaults, "[the]
format of diagnostic messages for most utilities is unspecified".
The STDERR subsections of the `cat` and `wc` utilities merely indicate
that "[the] standard error shall be used only for diagnostic messages".
The corresponding EXIT STATUS subsections merely indicate, with regard
to errors, an exit value of >0.

The affected tests are updated to accept the applicable diagnostic
message as produced by the utilities on AIX. The exit value is
normalized using `not` as necessary.

Reviewers: xingxue, sfertile, jasonliu

Reviewed By: xingxue

Subscribers: delcypher, jsji, llvm-commits

Tags: #llvm

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359690 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 15:47:16 +00:00
Michal Gorny
f2af3ceff5 [llvm] [lit] Add target-x86* features
Add a 'target-x86' and 'target-x86_64' feature sthat indicates that
the default target is 32-bit or 64-bit x86, appropriately.  Combined
with 'native' feature, we're going to use this to control x86-specific
LLDB native process tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-11 14:58:39 +00:00
Saleem Abdulrasool
5e9b0f4622 lit: make rm python 3 friendly (NFC)
Add some alterations for python 3 compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357789 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 18:00:49 +00:00
Saleem Abdulrasool
11ab360eb5 lit: support long paths on Windows
Use ctypes to call into SHFileOperationW with the extended NT path to allow us
to remove paths which exceed 261 characters on Windows. This functionality is
exercised by swift's test suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357778 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 16:48:00 +00:00
Rumeet Dhindsa
06a5e33b71 Update lit config for ld.lld command to match "ld\.lld" instead of trying to match respective regex. (It was able to work with ld-lld and ld1lld as well)
Differential Revision: https://reviews.llvm.org/D59962



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357218 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 22:26:51 +00:00
Serge Guelton
d6bec11b3b Add Support for Creating and Deleting Unicode Files and Directories in Lit
This enables lit to work with unicode file names via mkdir, rm, and redirection.
Lit still uses utf-8 internally, but converts to utf-16 on Windows, or just utf-8
bytes on everything else.

Committed on behalf of Jason Mittertreiner
Differential Revision: https://reviews.llvm.org/D56754



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355122 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 19:16:17 +00:00
Dmitri Gribenko
ce3f788c40 Fixed typos in a test: s/CEHCK/CHECK/
Reviewers: ilya-biryukov, serge-sans-paille

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355080 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 10:58:13 +00:00
Julian Lettner
0ffe848c65 [lit] Allow setting parallelism groups to None
Check that we do not crash if a parallelism group is explicitly set to
None. Permits usage of the following pattern.

[lit.common.cfg]
  lit_config.parallelism_groups['my_group'] = None
  if <condition>:
    lit_config.parallelism_groups['my_group'] = 3

[project/lit.cfg]
  config.parallelism_group = 'my_group'

Reviewers: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354912 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 19:03:26 +00:00
Julian Lettner
2cb3057fcb [lit] Remove LitTestCase
From the docs: `class LitTestCase(unittest.TestCase)`
LitTestCase is an adaptor for providing a 'unittest' compatible
interface to 'lit' tests so that we can run lit tests with standard
python test runners.

It does not seem to be used anywhere.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354188 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-16 00:44:00 +00:00
Julian Lettner
0631be28f6 [lit][NFC] Cleanup lit worker process handling
Move code that is executed on worker process to separate file. This
makes the use of the pickled arguments stored in global variables in the
worker a bit clearer. (Still not pretty though.)

Extract handling of parallelism groups to it's own function.

Use BoundedSemaphore instead of Semaphore. BoundedSemaphore raises for
unmatched release() calls.

Cleanup imports.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354187 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-16 00:40:40 +00:00
Julian Lettner
747940fe8d [lit][NFC] Cleanup copy&paste naming mistake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354095 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-15 02:44:52 +00:00
Julian Lettner
d8ffa5fe1b [lit] Remove --single-process option (use -j1 instead)
Remove `--single-process` command line option. Use `-j1` instead.

Also see commit: 96adb78b120b6aa9739eb714534dc8e819f7bc52

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354073 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 22:46:56 +00:00
Julian Lettner
75b1901bac [lit] Set --single-process for single tests and --threads=1
Summary:
Automatically upgrade debugging experience (single process, no thread
pool) when:
  1) we only run a single test
  2) user specifies `-j1`

Details:
Fix `--max-failures` in single process mode. Option did not have an
effect in single process mode.

Add display feedback for single process mode. Adapted test.

Improve argument checking (require positive integers).

`--single-process` is now essentially an alias for `-j1`. Should we
remove it?

Reviewers: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354068 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 22:30:07 +00:00
Nico Weber
a53d6c2052 lit: Let lit.util.which() return a normcase()ed path
LLVMConfig.with_environment() uses os.path.normcase(os.path.normpath(x)) to
normalize temporary env vars. LLVMConfig.use_clang() uses with_environment() to
temporarily set PATH and then look for clang there. This means that on Windows,
clang will be run with a path like c:\foo\bin\clang.EXE (with a lower-case
"C:").

lit.util.which() used to not do this, which means the executables added in
clang/test/lit.cfg.py (e.g. c-index-test) were run with a path like
C:\foo\bin\c-index-test.EXE (because both CMake and GN happen to write
clang_tools_dir with an upper-case C to lit.site.cfg.py).

clang/test/Index/pch-from-libclang.c requires that both c-index-test and clang
use _exactly_ the same resource dir path (same case and everything), because a
hash of the resource directory is used as module cache path.

This patch is necessary but not sufficient to make pch-from-libclang.c pass on
Windows.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352704 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 00:40:43 +00:00
James Y Knight
b21d80e08f Adjust documentation for git migration.
This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352514 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 16:37:27 +00:00
Eric Fiselier
bda64db50e make XFAIL, REQUIRES, and UNSUPPORTED support multi-line expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351668 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-20 00:51:02 +00:00
Chandler Carruth
4cfe1aca69 Update structured references to the license to the new license.
Since these are intended to be short and succinct, I've used the SPDX
full name. It's human readable, but formally agreed upon and will be
part of the SPDX spec for licenses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351649 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 11:30:51 +00:00
Dan Liew
ba41586e36 [lit] Make it possible for the lit test suite to pass with
`FILECHECK_OPTS=-v` set in the environment.

Follow up to r350850 as requested by Joel E. Denny in
https://reviews.llvm.org/D56541 .

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350854 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-10 17:47:44 +00:00
David Greene
e410b0a76b [lit] Respect PYTHONPATH
If a user has PYTHONPATH set in the environment, append new entries to
it rather than blindly setting PYTHONPATH to a fixed string. This
allows tests to, for example, find psutil if it is in
PYTHONPATH. Without this change, lit will detect psutil but then
various tests will fail because PYTHONPATH has been overwritten and
psutil cannot be found.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350536 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 16:24:37 +00:00
Serge Guelton
60ccceba74 Python compat - print statement
Make sure all print statements are compatible with Python 2 and Python3 using
the `from __future__ import print_function` statement.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350307 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 14:11:33 +00:00
Nico Weber
576e6bc9fb Revert 349677, it contained a whole bunch of stuff I did not mean to commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349678 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 20:19:58 +00:00
Nico Weber
fc16245746 [gn build] Add build file for clang/lib/Basic and dependencies
Adds a build file for clang-tblgen and an action for running it, and uses that
to process all the .td files in include/clang/Basic.

Also adds an action to write include/clang/Config/config.h and
include/clang/Basic/Version.inc.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349677 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 20:18:59 +00:00
Michal Gorny
8dc1a1ab0b [test] Split strip-preserve-time.test, and skip atime test on NetBSD
Split timestamp preservation tests into atime and mtime test, and skip
the former on NetBSD.  When the filesystem is mounted noatime, NetBSD
not only inhibits implicit atime updates but also prevents setting atime
via utime(), causing the test to fail.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348354 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-05 11:15:46 +00:00
Zachary Turner
c3ceb23729 [lit] Add a generic build script with a lit substitution.
This adds a script called build.py as well as a lit substitution
called %build that we can use to invoke it.  The idea is that
this allows a lit test to build test inferiors without having
to worry about architecture / platform specific differences,
command line syntax, finding / configurationg a proper toolchain,
and other issues.  They can simply write something like:

%build --arch=32 -o %t.exe %p/Inputs/foo.cpp

and it will just work.  This paves the way for being able to
run lit tests with multiple configurations, platforms, and
compilers with a single test.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348058 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-01 00:22:21 +00:00
Zachary Turner
5b841f76e4 [lit] Pass more environment variables through to child processes.
This arose when I was trying to have a substitution which invoked a
python script P, and that python script tried to invoke clang-cl (or
even cl). Since we invoke P with a custom environment, it doesn't
inherit the environment of the parent, and then when we go to invoke
clang-cl, it's unable to find the MSVC installation directory. There
were many more I could have passed through which are set by vcvarsall,
but I tried to keep it simple and only pass through the important ones.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347691 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-27 19:29:12 +00:00
Reid Kleckner
a4eddf6b39 Fix clang test suite on Windows by reverting part of r347216
Otherwise, the clang analyzer tests fail on Windows when attempting to
unpickle AnalyzerTest objects in the worker processes. The pattern of,
add to path, import, remove from path, serialize, deserialize, doesn't
work. Once something gets added to the path, if we want to move it
across the wire for multiprocessing, we need to keep the module on
sys.path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347254 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 19:36:28 +00:00
Zachary Turner
824fe505a4 Fix some issues with LLDB's lit configuration files.
Recently I tried to port LLDB's lit configuration files over to use a
on the surface, but broke some cases that weren't broken before and also
exposed some additional problems with the old approach that we were just
getting lucky with.

When we set up a lit environment, the goal is to make it as hermetic as
possible. We should not be relying on PATH and enabling the use of
arbitrary shell commands. Instead, only whitelisted commands should be
allowed. These are, generally speaking, the lit builtins such as echo,
cd, etc, as well as anything for which substitutions have been
explicitly set up for. These substitutions should map to the build
output directory, but in some cases it's useful to be able to override
this (for example to point to an installed tools directory).

This is, of course, how it's supposed to work. What was actually
happening is that we were bringing in PATH and LD_LIBRARY_PATH and then
just running the given run line as a shell command. This led to problems
such as finding the wrong version of clang-cl on PATH since it wasn't
even a substitution, and flakiness / non-determinism since the
environment the tests were running in would change per-machine. On the
other hand, it also made other things possible. For example, we had some
tests that were explicitly running cl.exe and link.exe instead of
clang-cl and lld-link and the only reason it worked at all is because it
was finding them on PATH. Unfortunately we can't entirely get rid of
these tests, because they support a few things in debug info that
clang-cl and lld-link don't (notably, the LF_UDT_MOD_SRC_LINE record
which makes some of the tests fail.

The high level changes introduced in this patch are:

1. Removal of functionality - The lit test suite no longer respects
   LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. This means there is no
   more support for gcc, but nobody was using this anyway (note: The
   functionality is still there for the dotest suite, just not the lit test
   suite). There is no longer a single substitution %cxx and %cc which maps
   to <arbitrary-compiler>, you now explicitly specify the compiler with a
   substitution like %clang or %clangxx or %clang_cl. We can revisit this
   in the future when someone needs gcc.

2. Introduction of the LLDB_LIT_TOOLS_DIR directory. This does in spirit
   what LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER used to do, but now
   more friendly. If this is not specified, all tools are expected to be
   the just-built tools. If it is specified, the tools which are not
   themselves being tested but are being used to construct and run checks
   (e.g. clang, FileCheck, llvm-mc, etc) will be searched for in this
   directory first, then the build output directory.

3. Changes to core llvm lit files. The use_lld() and use_clang()
   functions were introduced long ago in anticipation of using them in
   lldb, but since they were never actually used anywhere but their
   respective problems, there were some issues to be resolved regarding
   generality and ability to use them outside their project.

4. Changes to .test files - These are all just replacing things like
   clang-cl with %clang_cl and %cxx with %clangxx, etc.

5. Changes to lit.cfg.py - Previously we would load up some system
   environment variables and then add some new things to them. Then do a
   bunch of work building out our own substitutions. First, we delete the
   system environment variable code, making the environment hermetic. Then,
   we refactor the substitution logic into two separate helper functions,
   one which sets up substitutions for the tools we want to test (which
   must come from the build output directory), and another which sets up
   substitutions for support tools (like compilers, etc).

6. New substitutions for MSVC -- Previously we relied on location of
   MSVC by bringing in the entire parent's PATH and letting
   subprocess.Popen just run the command line. Now we set up real
   substitutions that should have the same effect. We use PATH to find
   them, and then look for INCLUDE and LIB to construct a substitution
   command line with appropriate /I and /LIBPATH: arguments. The nice thing
   about this is that it opens the door to having separate %msvc-cl32 and
   %msvc-cl64 substitutions, rather than only requiring the user to run
   vcvars first. Because we can deduce the path to 32-bit libraries from
   64-bit library directories, and vice versa. Without these substitutions
   this would have been impossible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347216 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 15:12:34 +00:00
Joel E. Denny
e861874109 [FileCheck] Parse command-line options from FILECHECK_OPTS
This feature makes it easy to tune FileCheck diagnostic output when
running the test suite via ninja, a bot, or an IDE.  For example:

```
$ FILECHECK_OPTS='-color -v -dump-input-on-failure' \
  LIT_FILTER='OpenMP/for_codegen.cpp' ninja check-clang \
  | less -R
```

Reviewed By: probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346272 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-06 22:07:03 +00:00
Zachary Turner
4860c62539 Refactor the lit configuration files
A year or so ago, I re-wrote most of the lit infrastructure in LLVM so
that it wasn't so boilerplate-y. I added lots of common helper type
stuff, simplifed usage patterns, and made the code more elegant and
maintainable.

We migrated to this in LLVM, clang, and lld's lit files, but not in
LLDBs. This started to bite me recently, as the 4 most recent times I
tried to run the lit test suite in LLDB on a fresh checkout the first
thing that would happen is that python would just start crashing with
unhelpful backtraces and I would have to spend time investigating.

You can reproduce this today by doing a fresh cmake generation, doing
ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at
which point you'll get a segfault that tells you nothing about what your
problem is.

I started trying to fix the issues with bandaids, but it became clear
that the proper solution was to just bring in the work I did in the rest
of the projects. The side benefit of this is that the lit configuration
files become much cleaner and more understandable as a result.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346008 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-02 17:49:01 +00:00
Greg Bedwell
ee6a84b4fe [lit] Only return a found bash executable on Windows if it can understand Windows paths
Some versions of bash.exe, for example WSL's version expect paths in the form
/mnt/c/path/to/dir rather than c:\\path\\to\\dir so will cause failures
for any tests that require an external shell if used by lit.  If we're on
Windows and looking for an external shell, check that the found version
of bash is able to parse a native path before returning that version.

This patch also partially reverts the behaviour of r228221 by
restoring the warning if bash cannot be found.  This shouldn't pollute
the lit stderr anymore as we're now using internal shell by default on
Windows.  If someone is explicitly specifying to use an external shell, it's
probably worth alerting them to the fact that bash could not be found.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 11:34:04 +00:00
Chris Matthews
672a178125 make lit builtins a package
cat.py is not being installed when lit is installed from source. So
tests that use the internal shell fail when using cat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343347 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 17:55:18 +00:00
Tom Stellard
e9139276f3 lit: Make sure the builtin_commands directory is packaged by setup.py
Summary: This directory was missing from the lit package on pypi.org.

Reviewers: ddunbar

Subscribers: delcypher, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343115 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 14:56:11 +00:00
Alex Langford
7b77a6b5d2 Fix lit/example/many-tests pickling issue
Summary:
The multiprocess module uses pickling to transfer
information between processes and does not know how to pickle
the class created in the lit.cfg file and thus the example
fails.

Implement ManyTests in a separate file and import for the
example test passes

Patch by Nathan Lanza <nathan@lanza.io>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342269 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-14 19:44:09 +00:00
Stella Stamenova
ca3502c26e [lit] Disable shtest-timeout on Windows
Summary: This is the only test that is still failing on Windows - or rather, it is expected to fail on the bots, but passes on the new bot that we're preparing causing a failure, so I'm going to disable it. Since the test has rarely, if ever, passed on the bots, this should have the same effect and it will unblock the creation of the new bot.

Reviewers: asmith, delcypher, zturner

Subscribers: stella.stamenova, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341856 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 20:24:05 +00:00
Tom Stellard
c523f7a122 lit: Use sys.executable for executing builtin commands
Summary:
The python executable may not exist on all systems so use sys.executable
instead.

Reviewers: ddunbar, stella.stamenova

Subscribers: delcypher, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341244 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 20:15:31 +00:00
Stella Stamenova
5c077985f3 [lit, shtest-timeout] Always use an internal shell for the shtest-timeout to diagnose buildbot failures
Summary:
Right now this test is failing on the builtbots on Windows but we have a very similar setup where the test passes. The test is meant to test that specifying a timeout works correctly by running an infnite loop and having it timeout - on the buildbot, the infinite loop doesn't actually execute. This change runs all of the tests in the set using an internal shell rather than an external shell. I expect this will make the test pass which means that either the way the external shell is invoked or the external shell setup on the buildbots is not correct. Regardless of whether the test passes with this change, we'll need to undo this change and have a real fix.

@gkistanova was able to get logs from the buildbot to rule out a number of theories as to why this test is failing, but they didn't have enough information to confirm exactly what the issue is. The purpose of this change is to narrow it down, but if someone has a local repro and can aid in debugging, that would make it much speedier (and less prone to making the bots fail).

Reviewers: gkistanova, asmith, zturner, modocache, rnk, delcypher

Reviewed By: rnk

Subscribers: delcypher, llvm-commits, gkistanova

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340840 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-28 16:24:55 +00:00