diff options
author | Zachary Turner <zturner@google.com> | 2018-11-19 15:12:34 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-11-19 15:12:34 +0000 |
commit | 58db03a116a197719fbc6be3ea94f2910fd3666c (patch) | |
tree | 0b93121dae359ed0b9a89d03bc9256b4701a1cb9 | |
parent | 3a3d688cc872a1317f8c7780bf6243b1cfa85ddf (diff) | |
download | bcm5719-llvm-58db03a116a197719fbc6be3ea94f2910fd3666c.tar.gz bcm5719-llvm-58db03a116a197719fbc6be3ea94f2910fd3666c.zip |
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
llvm-svn: 347216
74 files changed, 314 insertions, 230 deletions
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py index 39b5586612c..d105f8d7e13 100644 --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -43,6 +43,10 @@ llvm_config.use_default_substitutions() llvm_config.use_clang() +config.substitutions.append( + ('%src_include_dir', config.clang_src_dir + '/include')) + + # Propagate path to symbolizer for ASan/MSan. llvm_config.with_system_environment( ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) diff --git a/lldb/lit/Breakpoint/case-insensitive.test b/lldb/lit/Breakpoint/case-insensitive.test index 3e7cfceaa50..f0184a937ce 100644 --- a/lldb/lit/Breakpoint/case-insensitive.test +++ b/lldb/lit/Breakpoint/case-insensitive.test @@ -2,7 +2,7 @@ # XFAIL: system-windows # -> llvm.org/pr24528 # -# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t +# RUN: %clang %p/Inputs/case-sensitive.c -g -o %t # RUN: lldb-test breakpoints %t %s | FileCheck %s breakpoint set -f case-sensitive.c -l 3 diff --git a/lldb/lit/Breakpoint/case-sensitive.test b/lldb/lit/Breakpoint/case-sensitive.test index dd5635b952d..107aa33fa25 100644 --- a/lldb/lit/Breakpoint/case-sensitive.test +++ b/lldb/lit/Breakpoint/case-sensitive.test @@ -1,6 +1,6 @@ # REQUIRES: nowindows # -# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t +# RUN: %clang %p/Inputs/case-sensitive.c -g -o %t # RUN: lldb-test breakpoints %t %s | FileCheck %s breakpoint set -f case-sensitive.c -l 3 diff --git a/lldb/lit/ExecControl/StopHook/stop-hook-threads.test b/lldb/lit/ExecControl/StopHook/stop-hook-threads.test index f2f1267d567..53ccde04bc5 100644 --- a/lldb/lit/ExecControl/StopHook/stop-hook-threads.test +++ b/lldb/lit/ExecControl/StopHook/stop-hook-threads.test @@ -1,4 +1,4 @@ -# RUN: %cxx %p/Inputs/stop-hook-threads.cpp -g -o %t +# RUN: %clangxx %p/Inputs/stop-hook-threads.cpp -g -o %t # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \ # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \ diff --git a/lldb/lit/ExecControl/StopHook/stop-hook.test b/lldb/lit/ExecControl/StopHook/stop-hook.test index e50b0c63685..7cb16814465 100644 --- a/lldb/lit/ExecControl/StopHook/stop-hook.test +++ b/lldb/lit/ExecControl/StopHook/stop-hook.test @@ -1,4 +1,4 @@ -# RUN: %cc %p/Inputs/stop-hook.c -g -o %t +# RUN: %clang %p/Inputs/stop-hook.c -g -o %t # Test setting stop-hook per-function # RUN: %lldb -b -s %p/Inputs/stop-hook-1.lldbinit -s %s -f %t \ # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FUNC %s diff --git a/lldb/lit/Expr/TestIRMemoryMap.test b/lldb/lit/Expr/TestIRMemoryMap.test index 9170a913c04..0741c31af38 100644 --- a/lldb/lit/Expr/TestIRMemoryMap.test +++ b/lldb/lit/Expr/TestIRMemoryMap.test @@ -1,6 +1,6 @@ # UNSUPPORTED: windows -# RUN: %cxx %p/Inputs/call-function.cpp -g -o %t +# RUN: %clangxx %p/Inputs/call-function.cpp -g -o %t # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic diff --git a/lldb/lit/Expr/TestIRMemoryMapWindows.test b/lldb/lit/Expr/TestIRMemoryMapWindows.test index 96483092c61..738ca6b2e26 100644 --- a/lldb/lit/Expr/TestIRMemoryMapWindows.test +++ b/lldb/lit/Expr/TestIRMemoryMapWindows.test @@ -1,6 +1,6 @@ # REQUIRES: system-windows -# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t +# RUN: %clang_cl /Zi %p/Inputs/call-function.cpp -o %t # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic diff --git a/lldb/lit/Quit/TestQuitExitCode-30.test b/lldb/lit/Quit/TestQuitExitCode-30.test index 0f6eff927f0..5e74c9db79c 100644 --- a/lldb/lit/Quit/TestQuitExitCode-30.test +++ b/lldb/lit/Quit/TestQuitExitCode-30.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 226 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 226 %lldb -b -s %s q -30 diff --git a/lldb/lit/Quit/TestQuitExitCode30.test b/lldb/lit/Quit/TestQuitExitCode30.test index b5249400ec2..687d048c480 100644 --- a/lldb/lit/Quit/TestQuitExitCode30.test +++ b/lldb/lit/Quit/TestQuitExitCode30.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 30 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 30 %lldb -b -s %s q 30 diff --git a/lldb/lit/Quit/TestQuitExitCodeHexA.test b/lldb/lit/Quit/TestQuitExitCodeHexA.test index e06c25b0619..43cfd591961 100644 --- a/lldb/lit/Quit/TestQuitExitCodeHexA.test +++ b/lldb/lit/Quit/TestQuitExitCodeHexA.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 10 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 10 %lldb -b -s %s q 0xA diff --git a/lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp b/lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp index 104d86756e4..00440531e99 100644 --- a/lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp +++ b/lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp @@ -1,5 +1,5 @@ // Test that we use the apple indexes. -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols %t | FileCheck %s // CHECK: .apple_names index present diff --git a/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp b/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp index 076cac19252..aeb0ff1d01b 100644 --- a/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp +++ b/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp @@ -3,7 +3,7 @@ // REQUIRES: lld, zlib -// RUN: clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s +// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp b/lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp index a9de057e6c9..f5122ebadae 100644 --- a/lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp +++ b/lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp @@ -2,7 +2,7 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols %t | FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp b/lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp index 3a2cf012295..84e3b62e17b 100644 --- a/lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp +++ b/lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp @@ -3,8 +3,8 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf -// RUN: clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/find-basic-function.cpp b/lldb/lit/SymbolFile/DWARF/find-basic-function.cpp index d04c94b3854..3d175f63e04 100644 --- a/lldb/lit/SymbolFile/DWARF/find-basic-function.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-basic-function.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s @@ -15,7 +15,7 @@ // RUN: lldb-test symbols --name=not_there --find=function %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ @@ -29,7 +29,7 @@ // RUN: lldb-test symbols --name=not_there --find=function %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s diff --git a/lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp b/lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp index 11a660bfba9..e7655a37053 100644 --- a/lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s @@ -9,7 +9,7 @@ // RUN: lldb-test symbols --name=not_there --find=namespace %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \ @@ -17,7 +17,7 @@ // RUN: lldb-test symbols --name=not_there --find=namespace %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s diff --git a/lldb/lit/SymbolFile/DWARF/find-basic-type.cpp b/lldb/lit/SymbolFile/DWARF/find-basic-type.cpp index a470ef762e6..060a5b41eeb 100644 --- a/lldb/lit/SymbolFile/DWARF/find-basic-type.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-basic-type.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s @@ -9,7 +9,7 @@ // RUN: lldb-test symbols --name=not_there --find=type %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s // RUN: lldb-test symbols --name=foo --context=context --find=type %t | \ @@ -17,7 +17,7 @@ // RUN: lldb-test symbols --name=not_there --find=type %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s diff --git a/lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp b/lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp index 222ad420d40..bca8f27e1d4 100644 --- a/lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s @@ -11,7 +11,7 @@ // RUN: lldb-test symbols --name=not_there --find=variable %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=foo --find=variable %t | \ @@ -21,7 +21,7 @@ // RUN: lldb-test symbols --name=not_there --find=variable %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s diff --git a/lldb/lit/SymbolFile/DWARF/find-function-regex.cpp b/lldb/lit/SymbolFile/DWARF/find-function-regex.cpp index 2e099eb4fd7..b1e9d10e82a 100644 --- a/lldb/lit/SymbolFile/DWARF/find-function-regex.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-function-regex.cpp @@ -1,13 +1,13 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp b/lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp index 19b41e77c17..3da4a4a23f8 100644 --- a/lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp @@ -1,4 +1,4 @@ -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/find-method.cpp b/lldb/lit/SymbolFile/DWARF/find-method.cpp index 013e13435b9..7e7710fd472 100644 --- a/lldb/lit/SymbolFile/DWARF/find-method.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-method.cpp @@ -1,11 +1,11 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s diff --git a/lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp b/lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp index ca1b3184fbe..1ad3e7fbadf 100644 --- a/lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp @@ -1,4 +1,4 @@ -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=A::foo --find=variable %t | FileCheck %s // CHECK: Found 1 variables: diff --git a/lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp b/lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp index a0894284fa2..5c1b4b44523 100644 --- a/lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp @@ -2,7 +2,7 @@ // XFAIL: * -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s diff --git a/lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp b/lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp index 142ddc82cda..b2fb1a375cf 100644 --- a/lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp @@ -1,9 +1,9 @@ // REQUIRES: lld -// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \ +// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \ // RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o // RUN: llvm-objcopy --split-dwo=%t-1.dwo %t-1.o -// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \ +// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \ // RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o // RUN: llvm-objcopy --split-dwo=%t-2.dwo %t-2.o // RUN: ld.lld %t-1.o %t-2.o -o %t diff --git a/lldb/lit/SymbolFile/DWARF/find-variable-file.cpp b/lldb/lit/SymbolFile/DWARF/find-variable-file.cpp index f71d4a2b09b..5a95c5338f8 100644 --- a/lldb/lit/SymbolFile/DWARF/find-variable-file.cpp +++ b/lldb/lit/SymbolFile/DWARF/find-variable-file.cpp @@ -1,15 +1,15 @@ // REQUIRES: lld -// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s -// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp +// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s +// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=ONE %s // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=TWO %s -// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s -// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp +// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s +// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=ONE %s diff --git a/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp b/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp index d339e0c562b..f27b15cb4b4 100644 --- a/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp +++ b/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test various interesting cases for AST reconstruction. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/ast-reconstruction.lldbinit 2>&1 | FileCheck %s // Test trivial versions of each tag type. diff --git a/lldb/lit/SymbolFile/NativePDB/bitfields.cpp b/lldb/lit/SymbolFile/NativePDB/bitfields.cpp index 7f896ba8fbf..0f477b19d6e 100644 --- a/lldb/lit/SymbolFile/NativePDB/bitfields.cpp +++ b/lldb/lit/SymbolFile/NativePDB/bitfields.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test various interesting cases for AST reconstruction. -// RUN: clang-cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s // Test trivial versions of each tag type. diff --git a/lldb/lit/SymbolFile/NativePDB/disassembly.cpp b/lldb/lit/SymbolFile/NativePDB/disassembly.cpp index ef5ae9d1499..e9d5eacb6ce 100644 --- a/lldb/lit/SymbolFile/NativePDB/disassembly.cpp +++ b/lldb/lit/SymbolFile/NativePDB/disassembly.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can show disassembly and source. -// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s // Some context lines before diff --git a/lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp b/lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp index 5cf5321569d..467e7d1d137 100644 --- a/lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp +++ b/lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp @@ -1,9 +1,9 @@ // clang-format off // REQUIRES: lld -// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/function-types-builtins.lldbinit | FileCheck %s // Test that we can display function signatures with simple builtin diff --git a/lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp b/lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp index 121fa017958..60ab86fd04d 100644 --- a/lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp +++ b/lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp @@ -1,9 +1,9 @@ // clang-format off // REQUIRES: lld -// RUN: clang-cl -m32 /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: %clang_cl -m32 /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s diff --git a/lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp b/lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp index 7ce2c43010e..e398a1d1abc 100644 --- a/lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp +++ b/lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can display function signatures with class types. -// RUN: clang-cl /Z7 /GS- /GR- /c -fstandalone-debug -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c -fstandalone-debug -Xclang -fkeep-static-consts /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/function-types-classes.lldbinit | FileCheck %s // This is just some unimportant helpers needed so that we can get reference and diff --git a/lldb/lit/SymbolFile/NativePDB/global-classes.cpp b/lldb/lit/SymbolFile/NativePDB/global-classes.cpp index f0fdb566e42..38cd8eb52ca 100644 --- a/lldb/lit/SymbolFile/NativePDB/global-classes.cpp +++ b/lldb/lit/SymbolFile/NativePDB/global-classes.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can display tag types. -// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/globals-classes.lldbinit | FileCheck %s enum class EnumType : unsigned { diff --git a/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp b/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp index 57149b96681..15d5b1279e1 100644 --- a/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp +++ b/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp @@ -2,10 +2,10 @@ // REQUIRES: lld // Make sure we can read variables from BSS -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj // RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s int GlobalVariable = 0; diff --git a/lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp b/lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp index f4700c4e1ff..31a191c87a7 100644 --- a/lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp +++ b/lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can display tag types. -// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/globals-fundamental.lldbinit | FileCheck %s diff --git a/lldb/lit/SymbolFile/NativePDB/nested-types.cpp b/lldb/lit/SymbolFile/NativePDB/nested-types.cpp index 7d08871c74e..0c20315cf22 100644 --- a/lldb/lit/SymbolFile/NativePDB/nested-types.cpp +++ b/lldb/lit/SymbolFile/NativePDB/nested-types.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test various interesting cases for AST reconstruction. -// RUN: clang-cl /Z7 /GS- /GR- -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/nested-types.lldbinit 2>&1 | FileCheck %s struct S { diff --git a/lldb/lit/SymbolFile/NativePDB/s_constant.cpp b/lldb/lit/SymbolFile/NativePDB/s_constant.cpp index cd8e3d169f4..28e0d8d1788 100644 --- a/lldb/lit/SymbolFile/NativePDB/s_constant.cpp +++ b/lldb/lit/SymbolFile/NativePDB/s_constant.cpp @@ -5,7 +5,7 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s // clang-cl cannot generate S_CONSTANT records, but we need to test that we can diff --git a/lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp b/lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp index 9a97def07b5..ceafd816e3c 100644 --- a/lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp +++ b/lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can set simple breakpoints using PDB on any platform. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/breakpoints.lldbinit | FileCheck %s // Use different indentation style for each overload so that the starting diff --git a/lldb/lit/SymbolFile/NativePDB/source-list.cpp b/lldb/lit/SymbolFile/NativePDB/source-list.cpp index c5f320a33f0..36cf5f75ebe 100644 --- a/lldb/lit/SymbolFile/NativePDB/source-list.cpp +++ b/lldb/lit/SymbolFile/NativePDB/source-list.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can set display source of functions. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/source-list.lldbinit | FileCheck %s diff --git a/lldb/lit/SymbolFile/NativePDB/tag-types.cpp b/lldb/lit/SymbolFile/NativePDB/tag-types.cpp index 5f332465b32..d0165c1506e 100644 --- a/lldb/lit/SymbolFile/NativePDB/tag-types.cpp +++ b/lldb/lit/SymbolFile/NativePDB/tag-types.cpp @@ -2,9 +2,9 @@ // REQUIRES: lld // Test that we can display tag types. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ // RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s // Test struct diff --git a/lldb/lit/SymbolFile/PDB/ast-restore.test b/lldb/lit/SymbolFile/PDB/ast-restore.test index 77cdd283f38..68e202ecb56 100644 --- a/lldb/lit/SymbolFile/PDB/ast-restore.test +++ b/lldb/lit/SymbolFile/PDB/ast-restore.test @@ -1,6 +1,6 @@ REQUIRES: system-windows -RUN: cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj -RUN: link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe +RUN: %msvc_cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj +RUN: %msvc_link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s diff --git a/lldb/lit/SymbolFile/PDB/calling-conventions.test b/lldb/lit/SymbolFile/PDB/calling-conventions.test index b22d652df9a..1653494967c 100644 --- a/lldb/lit/SymbolFile/PDB/calling-conventions.test +++ b/lldb/lit/SymbolFile/PDB/calling-conventions.test @@ -1,5 +1,5 @@ REQUIRES: system-windows, lld -RUN: clang-cl -m32 /Zi /GS- /c %S/Inputs/CallingConventionsTest.cpp /o %t.obj +RUN: %clang_cl -m32 /Zi /GS- /c %S/Inputs/CallingConventionsTest.cpp /o %t.obj RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s diff --git a/lldb/lit/SymbolFile/PDB/class-layout.test b/lldb/lit/SymbolFile/PDB/class-layout.test index 942433b7b55..63de5b2ec84 100644 --- a/lldb/lit/SymbolFile/PDB/class-layout.test +++ b/lldb/lit/SymbolFile/PDB/class-layout.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj -RUN: link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe +REQUIRES: msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj +RUN: %msvc_link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=ENUM %s RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNION %s diff --git a/lldb/lit/SymbolFile/PDB/compilands.test b/lldb/lit/SymbolFile/PDB/compilands.test index b0c9572f7be..020b7996c26 100644 --- a/lldb/lit/SymbolFile/PDB/compilands.test +++ b/lldb/lit/SymbolFile/PDB/compilands.test @@ -1,5 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl /Z7 %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl /Z7 /c %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.obj +RUN: %msvc_link /debug:full /nodefaultlib /entry:main %T/CompilandsTest.cpp.obj /out:%T/CompilandsTest.cpp.exe RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s ; Link default libraries diff --git a/lldb/lit/SymbolFile/PDB/enums-layout.test b/lldb/lit/SymbolFile/PDB/enums-layout.test index 3a3d9b2dbe1..c23f4e8b052 100644 --- a/lldb/lit/SymbolFile/PDB/enums-layout.test +++ b/lldb/lit/SymbolFile/PDB/enums-layout.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj -RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj +RUN: %msvc_link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s ; FIXME: PDB does not have information about scoped enumeration (Enum class) so the diff --git a/lldb/lit/SymbolFile/PDB/func-symbols.test b/lldb/lit/SymbolFile/PDB/func-symbols.test index 20eabd3dd24..205c0da7178 100644 --- a/lldb/lit/SymbolFile/PDB/func-symbols.test +++ b/lldb/lit/SymbolFile/PDB/func-symbols.test @@ -1,7 +1,7 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj -RUN: link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj +RUN: %msvc_link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-TWO %s diff --git a/lldb/lit/SymbolFile/PDB/function-level-linking.test b/lldb/lit/SymbolFile/PDB/function-level-linking.test index 06605d824e2..56f3ecbb690 100644 --- a/lldb/lit/SymbolFile/PDB/function-level-linking.test +++ b/lldb/lit/SymbolFile/PDB/function-level-linking.test @@ -1,4 +1,4 @@ REQUIRES: system-windows, lld -RUN: clang-cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj +RUN: %clang_cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe RUN: lldb-test symbols -verify %t.exe diff --git a/lldb/lit/SymbolFile/PDB/function-nested-block.test b/lldb/lit/SymbolFile/PDB/function-nested-block.test index ef714c461c9..c68283171c6 100644 --- a/lldb/lit/SymbolFile/PDB/function-nested-block.test +++ b/lldb/lit/SymbolFile/PDB/function-nested-block.test @@ -1,5 +1,5 @@ REQUIRES: system-windows, lld -RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj +RUN: %clang_cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s RUN: lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s diff --git a/lldb/lit/SymbolFile/PDB/pointers.test b/lldb/lit/SymbolFile/PDB/pointers.test index 9a5e72e3b85..bb254154f8b 100644 --- a/lldb/lit/SymbolFile/PDB/pointers.test +++ b/lldb/lit/SymbolFile/PDB/pointers.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj -RUN: link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj +RUN: %msvc_link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck %s RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-F %s RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST %s diff --git a/lldb/lit/SymbolFile/PDB/type-quals.test b/lldb/lit/SymbolFile/PDB/type-quals.test index b4b66b6a439..ffd21036e34 100644 --- a/lldb/lit/SymbolFile/PDB/type-quals.test +++ b/lldb/lit/SymbolFile/PDB/type-quals.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj -RUN: link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj +RUN: %msvc_link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s CHECK: Module [[MOD:.*]] diff --git a/lldb/lit/SymbolFile/PDB/typedefs.test b/lldb/lit/SymbolFile/PDB/typedefs.test index f69d3ecc2e9..329cbbcafdc 100644 --- a/lldb/lit/SymbolFile/PDB/typedefs.test +++ b/lldb/lit/SymbolFile/PDB/typedefs.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj -RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj +RUN: %msvc_link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s ; Generate 32-bit target diff --git a/lldb/lit/SymbolFile/PDB/udt-layout.test b/lldb/lit/SymbolFile/PDB/udt-layout.test index 95533aec2d2..95909c86ba2 100644 --- a/lldb/lit/SymbolFile/PDB/udt-layout.test +++ b/lldb/lit/SymbolFile/PDB/udt-layout.test @@ -1,5 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl /Zi %S/Inputs/UdtLayoutTest.cpp /o %t.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl /Zi %S/Inputs/UdtLayoutTest.cpp /c /o %t.obj +RUN: %msvc_link /DEBUG:FULL /out:%t.exe %t.obj RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s CHECK:(int) int C::abc = 123 diff --git a/lldb/lit/SymbolFile/PDB/variables-locations.test b/lldb/lit/SymbolFile/PDB/variables-locations.test index 19d3b4a778e..7047c1fdfa3 100644 --- a/lldb/lit/SymbolFile/PDB/variables-locations.test +++ b/lldb/lit/SymbolFile/PDB/variables-locations.test @@ -1,5 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl /Zi %S/Inputs/VariablesLocationsTest.cpp /c /o %t.obj +RUN: %msvc_link /debug:full %t.obj /out:%t.exe RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s CHECK: g_var = 2222 diff --git a/lldb/lit/SymbolFile/PDB/variables.test b/lldb/lit/SymbolFile/PDB/variables.test index 81b888b14f8..57f985d899e 100644 --- a/lldb/lit/SymbolFile/PDB/variables.test +++ b/lldb/lit/SymbolFile/PDB/variables.test @@ -1,6 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj -RUN: link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj +RUN: %msvc_link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s CHECK: Module [[MOD:.*]] diff --git a/lldb/lit/SymbolFile/PDB/vbases.test b/lldb/lit/SymbolFile/PDB/vbases.test index f7d8cc89217..5aa9f1e6666 100644 --- a/lldb/lit/SymbolFile/PDB/vbases.test +++ b/lldb/lit/SymbolFile/PDB/vbases.test @@ -1,5 +1,6 @@ -REQUIRES: system-windows -RUN: clang-cl /Zi %S/Inputs/VBases.cpp /o %t.exe +REQUIRES: system-windows, msvc +RUN: %clang_cl /Zi %S/Inputs/VBases.cpp /c /o %t.obj +RUN: %msvc_link /debug:full %t.obj /out:%t.exe RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s CHECK: { diff --git a/lldb/lit/helper/__init__.py b/lldb/lit/helper/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/lldb/lit/helper/__init__.py diff --git a/lldb/lit/helper/toolchain.py b/lldb/lit/helper/toolchain.py new file mode 100644 index 00000000000..183db606f52 --- /dev/null +++ b/lldb/lit/helper/toolchain.py @@ -0,0 +1,104 @@ +import os +import platform +import subprocess +import sys + +import lit.util +from lit.llvm import llvm_config +from lit.llvm.subst import FindTool +from lit.llvm.subst import ToolSubst + +def use_lldb_substitutions(config): + # Set up substitutions for primary tools. These tools must come from config.lldb_tools_dir + # which is basically the build output directory. We do not want to find these in path or + # anywhere else, since they are specifically the programs which are actually being tested. + + dsname = 'debugserver' if platform.system() in ['Darwin'] else 'lldb-server' + dsargs = [] if platform.system() in ['Darwin'] else ['gdbserver'] + lldbmi = ToolSubst('%lldbmi', + command=FindTool('lldb-mi'), + extra_args=['--synchronous'], + unresolved='ignore') + primary_tools = [ + ToolSubst('%lldb', + command=FindTool('lldb'), + extra_args=['-S', + os.path.join(config.test_source_root, + 'lit-lldb-init')]), + lldbmi, + ToolSubst('%debugserver', + command=FindTool(dsname), + extra_args=dsargs, + unresolved='ignore'), + 'lldb-test' + ] + + llvm_config.add_tool_substitutions(primary_tools, + [config.lldb_tools_dir]) + if lldbmi.was_resolved: + config.available_features.add('lldb-mi') + +def _use_msvc_substitutions(config): + # If running from a Visual Studio Command prompt (e.g. vcvars), this will + # detect the include and lib paths, and find cl.exe and link.exe and create + # substitutions for each of them that explicitly specify /I and /L paths + cl = '"' + lit.util.which('cl') + '"' + link = '"' + lit.util.which('link') + '"' + + if not cl or not link: + return + + includes = os.getenv('INCLUDE', '').split(';') + libs = os.getenv('LIB', '').split(';') + + config.available_features.add('msvc') + compiler_flags = ['"/I{}"'.format(x) for x in includes if os.path.exists(x)] + linker_flags = ['"/LIBPATH:{}"'.format(x) for x in libs if os.path.exists(x)] + + tools = [ + ToolSubst('%msvc_cl', command=cl, extra_args=compiler_flags), + ToolSubst('%msvc_link', command=link, extra_args=linker_flags)] + llvm_config.add_tool_substitutions(tools) + return + +def use_support_substitutions(config): + # Set up substitutions for support tools. These tools can be overridden at the CMake + # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use + # the just-built version. + flags = [] + if platform.system() in ['Darwin']: + try: + out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() + res = 0 + except OSError: + res = -1 + if res == 0 and out: + sdk_path = lit.util.to_string(out) + lit_config.note('using SDKROOT: %r' % sdk_path) + flags = ['-isysroot', sdk_path] + elif platform.system() in ['OpenBSD']: + flags = ['-pthread'] + + + additional_tool_dirs=[] + if config.lldb_lit_tools_dir: + additional_tool_dirs.append(config.lldb_lit_tools_dir) + + llvm_config.use_clang(additional_flags=flags, + additional_tool_dirs=additional_tool_dirs, + required=True) + + if sys.platform == 'win32': + _use_msvc_substitutions(config) + + have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, + required=False) + if have_lld: + config.available_features.add('lld') + + + support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil', + 'llvm-mc', 'llvm-readobj', 'llvm-objdump', + 'llvm-objcopy'] + additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] + llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) diff --git a/lldb/lit/lit.cfg.py b/lldb/lit/lit.cfg.py index 568e5a55853..536f2e0b464 100644 --- a/lldb/lit/lit.cfg.py +++ b/lldb/lit/lit.cfg.py @@ -1,18 +1,18 @@ # -*- Python -*- import os -import sys import re -import platform import shutil -import subprocess +import site +import sys -import lit.util import lit.formats from lit.llvm import llvm_config from lit.llvm.subst import FindTool from lit.llvm.subst import ToolSubst +from helper import toolchain + # name: The name of this test suite. config.name = 'LLDB' @@ -34,80 +34,17 @@ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit') -# Tweak the PATH to include the tools dir. -llvm_config.with_system_environment('PATH') -llvm_config.with_environment('PATH', config.lldb_tools_dir, append_path=True) -llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) -llvm_config.with_environment('LD_LIBRARY_PATH', config.lldb_libs_dir, append_path=True) -llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_libs_dir, append_path=True) -llvm_config.with_system_environment('LD_LIBRARY_PATH', append_path=True) +llvm_config.use_default_substitutions() +toolchain.use_lldb_substitutions(config) -llvm_config.use_default_substitutions() +toolchain.use_support_substitutions(config) -if platform.system() in ['Darwin']: - debugserver = lit.util.which('debugserver', config.lldb_tools_dir) -else: - debugserver = lit.util.which('lldb-server', config.lldb_tools_dir) -lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', config.lldb_tools_dir), - config.test_source_root) - -lldbmi = lit.util.which('lldb-mi', config.lldb_tools_dir) -if lldbmi: - config.available_features.add('lldb-mi') - -config.cc = llvm_config.use_llvm_tool(config.cc, required=True) -config.cxx = llvm_config.use_llvm_tool(config.cxx, required=True) - -if platform.system() in ['Darwin']: - try: - out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() - res = 0 - except OSError: - res = -1 - if res == 0 and out: - sdk_path = lit.util.to_string(out) - lit_config.note('using SDKROOT: %r' % sdk_path) - config.cc += " -isysroot %s" % sdk_path - config.cxx += " -isysroot %s" % sdk_path - -if platform.system() in ['OpenBSD']: - config.cc += " -pthread" - config.cxx += " -pthread" - -config.substitutions.append(('%cc', config.cc)) -config.substitutions.append(('%cxx', config.cxx)) - -if lldbmi: - config.substitutions.append(('%lldbmi', lldbmi + " --synchronous")) -config.substitutions.append(('%lldb', lldb)) - -if debugserver is not None: - if platform.system() in ['Darwin']: - config.substitutions.append(('%debugserver', debugserver)) - else: - config.substitutions.append(('%debugserver', debugserver + ' gdbserver')) - -tools = ['lldb-test', 'yaml2obj', 'obj2yaml', 'llvm-pdbutil'] -llvm_config.add_tool_substitutions(tools, [config.llvm_tools_dir, config.lldb_tools_dir]) if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple): config.available_features.add("armhf-linux") -print("config.cc = {}".format(config.cc)) -if re.match(r'icc', config.cc): - config.available_features.add("compiler-icc") -elif re.match(r'clang', config.cc): - config.available_features.add("compiler-clang") -elif re.match(r'gcc', config.cc): - config.available_features.add("compiler-gcc") -elif re.match(r'cl', config.cc): - config.available_features.add("compiler-msvc") - -if config.have_lld: - config.available_features.add("lld") - def calculate_arch_features(arch_string): # This will add a feature such as x86, arm, mips, etc for each built # target diff --git a/lldb/lit/lit.site.cfg.py.in b/lldb/lit/lit.site.cfg.py.in index fed04d11026..bcd43000532 100644 --- a/lldb/lit/lit.site.cfg.py.in +++ b/lldb/lit/lit.site.cfg.py.in @@ -4,26 +4,29 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" config.lldb_libs_dir = "@LLDB_LIBS_DIR@" config.lldb_tools_dir = "@LLDB_TOOLS_DIR@" +# Since it comes from the command line, it may have backslashes which +# should not need to be escaped. +config.lldb_lit_tools_dir = r"@LLDB_LIT_TOOLS_DIR@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" -config.cc = "@LLDB_TEST_C_COMPILER@" -config.cxx = "@LLDB_TEST_CXX_COMPILER@" config.have_zlib = @LLVM_ENABLE_ZLIB@ -config.have_lld = @LLDB_HAVE_LLD@ +config.host_triple = "@LLVM_HOST_TRIPLE@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. try: config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params + config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params config.lldb_tools_dir = config.lldb_tools_dir % lit_config.params - config.cc = config.cc % lit_config.params - config.cxx = config.cxx % lit_config.params + config.lldb_lit_tools_dir = config.lldb_lit_tools_dir % lit_config.params + except KeyError as e: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) diff --git a/lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test b/lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test index 2a650688fbc..48f86b4d678 100644 --- a/lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test +++ b/lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/break-insert-pending.c -g +# RUN: %clang -o %t %p/inputs/break-insert-pending.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test for enabling pending breakpoints globally diff --git a/lldb/lit/tools/lldb-mi/breakpoint/break-insert.test b/lldb/lit/tools/lldb-mi/breakpoint/break-insert.test index e6e230f8a03..74ce04e4a1b 100644 --- a/lldb/lit/tools/lldb-mi/breakpoint/break-insert.test +++ b/lldb/lit/tools/lldb-mi/breakpoint/break-insert.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o a.exe %p/inputs/break-insert.c -g +# RUN: %clang -o a.exe %p/inputs/break-insert.c -g # RUN: %lldbmi < %s | FileCheck %s # Test that a breakpoint can be inserted before creating a target. diff --git a/lldb/lit/tools/lldb-mi/data/data-info-line.test b/lldb/lit/tools/lldb-mi/data/data-info-line.test index a38ae6ea1f2..a42305d19a2 100644 --- a/lldb/lit/tools/lldb-mi/data/data-info-line.test +++ b/lldb/lit/tools/lldb-mi/data/data-info-line.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/data-info-line.c -g +# RUN: %clang -o %t %p/inputs/data-info-line.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -data-info-line command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-continue.test b/lldb/lit/tools/lldb-mi/exec/exec-continue.test index 162900e6103..e9aba78bd67 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-continue.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-continue.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-continue command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-finish.test b/lldb/lit/tools/lldb-mi/exec/exec-finish.test index 87ce75b92d1..07ca95102d1 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-finish.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-finish.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-finish command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test b/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test index 3e855e11644..43b5aa9be3f 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-interrupt command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test b/lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test index dae78e638e3..f012a5daceb 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-next-instruction command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-next.test b/lldb/lit/tools/lldb-mi/exec/exec-next.test index 4583d5375d8..5e06ac887f8 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-next.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-next.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-next command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test b/lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test index 37edc77a83e..ba95d687b17 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-step-instruction command. diff --git a/lldb/lit/tools/lldb-mi/exec/exec-step.test b/lldb/lit/tools/lldb-mi/exec/exec-step.test index 2187a00e924..2a69d449a30 100644 --- a/lldb/lit/tools/lldb-mi/exec/exec-step.test +++ b/lldb/lit/tools/lldb-mi/exec/exec-step.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-step command. diff --git a/lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test b/lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test index b9499392dcd..4b9202cd463 100644 --- a/lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ b/lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test @@ -1,7 +1,7 @@ # XFAIL: system-windows # -> llvm.org/pr24452 # -# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g +# RUN: %clang -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -symbol-list-lines command. diff --git a/lldb/lit/tools/lldb-mi/target/target-select-so-path.test b/lldb/lit/tools/lldb-mi/target/target-select-so-path.test index 80b51446e28..785030bf2fd 100644 --- a/lldb/lit/tools/lldb-mi/target/target-select-so-path.test +++ b/lldb/lit/tools/lldb-mi/target/target-select-so-path.test @@ -1,6 +1,6 @@ # UNSUPPORTED: windows, darwin # -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %clang -o %t %p/inputs/main.c -g # RUN: %python %p/inputs/target-select-so-path.py "%debugserver" "%lldbmi %t" %s # Test that -target-select command can hook up a path diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 5b84f771be1..bf7b21e5d87 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -87,6 +87,12 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin") --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY}) endif() +if (NOT "${LLDB_LIT_TOOLS_DIR}" STREQUAL "") + if (NOT EXISTS "${LLDB_LIT_TOOLS_DIR}") + message(WARNING "LLDB_LIT_TOOLS_DIR ${LLDB_LIT_TOOLS_DIR} does not exist.") + endif() +endif() + if(CMAKE_HOST_APPLE) list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH}) endif() diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py index d5adb535775..b70f18ef6ce 100644 --- a/llvm/utils/lit/lit/TestingConfig.py +++ b/llvm/utils/lit/lit/TestingConfig.py @@ -85,7 +85,9 @@ class TestingConfig: cfg_globals['config'] = self cfg_globals['lit_config'] = litConfig cfg_globals['__file__'] = path + original_sys_path = list(sys.path) try: + sys.path.insert(0, os.path.dirname(path)) exec(compile(data, path, 'exec'), cfg_globals, None) if litConfig.debug: litConfig.note('... loaded config %r' % path) @@ -100,7 +102,7 @@ class TestingConfig: litConfig.fatal( 'unable to parse config file %r, traceback: %s' % ( path, traceback.format_exc())) - + sys.path = original_sys_path self.finish(litConfig) def __init__(self, parent, name, suffixes, test_format, diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py index 6bb7135f659..fde3d5aa8cd 100644 --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -333,7 +333,7 @@ class LLVMConfig(object): self.lit_config.note('using {}: {}'.format(name, tool)) return tool - def use_clang(self, required=True): + def use_clang(self, additional_tool_dirs=[], additional_flags=[], required=True): """Configure the test suite to be able to invoke clang. Sets up some environment variables important to clang, locates a @@ -370,12 +370,16 @@ class LLVMConfig(object): # Tweak the PATH to include the tools dir and the scripts dir. # Put Clang first to avoid LLVM from overriding out-of-tree clang builds. - possible_paths = ['clang_tools_dir', 'llvm_tools_dir'] - paths = [getattr(self.config, pp) for pp in possible_paths + exe_dir_props = [self.config.name.lower() + '_tools_dir', 'clang_tools_dir', 'llvm_tools_dir'] + paths = [getattr(self.config, pp) for pp in exe_dir_props if getattr(self.config, pp, None)] + paths = additional_tool_dirs + paths self.with_environment('PATH', paths, append_path=True) - paths = [self.config.llvm_shlib_dir, self.config.llvm_libs_dir] + lib_dir_props = [self.config.name.lower() + '_libs_dir', 'clang_libs_dir', 'llvm_shlib_dir', 'llvm_libs_dir'] + paths = [getattr(self.config, pp) for pp in lib_dir_props + if getattr(self.config, pp, None)] + self.with_environment('LD_LIBRARY_PATH', paths, append_path=True) # Discover the 'clang' and 'clangcc' to use. @@ -383,19 +387,21 @@ class LLVMConfig(object): self.config.clang = self.use_llvm_tool( 'clang', search_env='CLANG', required=required) - self.config.substitutions.append( - ('%llvmshlibdir', self.config.llvm_shlib_dir)) - self.config.substitutions.append( - ('%pluginext', self.config.llvm_plugin_ext)) + shl = getattr(self.config, 'llvm_shlib_dir', None) + pext = getattr(self.config, 'llvm_plugin_ext', None) + if shl: + self.config.substitutions.append(('%llvmshlibdir', shl)) + if pext: + self.config.substitutions.append(('%pluginext', pext)) builtin_include_dir = self.get_clang_builtin_include_dir(self.config.clang) tool_substitutions = [ - ToolSubst('%clang', command=self.config.clang), - ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze']), - ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']), - ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']), - ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']), - ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']), + ToolSubst('%clang', command=self.config.clang, extra_args=additional_flags), + ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze']+additional_flags), + ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags), + ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']+additional_flags), + ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']+additional_flags), + ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']+additional_flags), ] self.add_tool_substitutions(tool_substitutions) @@ -415,34 +421,34 @@ class LLVMConfig(object): self.config.substitutions.append( ('%target_itanium_abi_host_triple', '')) - self.config.substitutions.append( - ('%src_include_dir', self.config.clang_src_dir + '/include')) - # FIXME: Find nicer way to prohibit this. self.config.substitutions.append( - (' clang ', """*** Do not use 'clang' in tests, use '%clang'. ***""")) + (' clang ', """\"*** Do not use 'clang' in tests, use '%clang'. ***\"""")) self.config.substitutions.append( - (' clang\+\+ ', """*** Do not use 'clang++' in tests, use '%clangxx'. ***""")) + (' clang\+\+ ', """\"*** Do not use 'clang++' in tests, use '%clangxx'. ***\"""")) self.config.substitutions.append( (' clang-cc ', - """*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***""")) + """\"*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***\"""")) + self.config.substitutions.append( + (' clang-cl ', + """\"*** Do not use 'clang-cl' in tests, use '%clang_cl'. ***\"""")) self.config.substitutions.append( (' clang -cc1 -analyze ', - """*** Do not use 'clang -cc1 -analyze' in tests, use '%clang_analyze_cc1'. ***""")) + """\"*** Do not use 'clang -cc1 -analyze' in tests, use '%clang_analyze_cc1'. ***\"""")) self.config.substitutions.append( (' clang -cc1 ', - """*** Do not use 'clang -cc1' in tests, use '%clang_cc1'. ***""")) + """\"*** Do not use 'clang -cc1' in tests, use '%clang_cc1'. ***\"""")) self.config.substitutions.append( (' %clang-cc1 ', - """*** invalid substitution, use '%clang_cc1'. ***""")) + """\"*** invalid substitution, use '%clang_cc1'. ***\"""")) self.config.substitutions.append( (' %clang-cpp ', - """*** invalid substitution, use '%clang_cpp'. ***""")) + """\"*** invalid substitution, use '%clang_cpp'. ***\"""")) self.config.substitutions.append( (' %clang-cl ', - """*** invalid substitution, use '%clang_cl'. ***""")) + """\"*** invalid substitution, use '%clang_cl'. ***\"""")) - def use_lld(self, required=True): + def use_lld(self, additional_tool_dirs=[], required=True): """Configure the test suite to be able to invoke lld. Sets up some environment variables important to lld, locates a @@ -450,20 +456,36 @@ class LLVMConfig(object): substitutions useful to any test suite that makes use of lld. """ - # Tweak the PATH to include the tools dir - tool_dirs = [self.config.llvm_tools_dir] - lib_dirs = [self.config.llvm_libs_dir] - lld_tools_dir = getattr(self.config, 'lld_tools_dir', None) - lld_libs_dir = getattr(self.config, 'lld_libs_dir', None) - if lld_tools_dir: - tool_dirs = tool_dirs + [lld_tools_dir] - if lld_libs_dir: - lib_dirs = lib_dirs + [lld_libs_dir] + # Tweak the PATH to include the tools dir and the scripts dir. + exe_dir_props = [self.config.name.lower() + '_tools_dir', 'lld_tools_dir', 'llvm_tools_dir'] + paths = [getattr(self.config, pp) for pp in exe_dir_props + if getattr(self.config, pp, None)] + paths = additional_tool_dirs + paths + self.with_environment('PATH', paths, append_path=True) - self.with_environment('PATH', tool_dirs, append_path=True) - self.with_environment('LD_LIBRARY_PATH', lib_dirs, append_path=True) + lib_dir_props = [self.config.name.lower() + '_libs_dir', 'lld_libs_dir', 'llvm_libs_dir'] + paths = [getattr(self.config, pp) for pp in lib_dir_props + if getattr(self.config, pp, None)] - tool_patterns = ['lld', 'ld.lld', 'lld-link', 'ld64.lld', 'wasm-ld'] + self.with_environment('LD_LIBRARY_PATH', paths, append_path=True) - self.add_tool_substitutions(tool_patterns, tool_dirs) + # Discover the 'clang' and 'clangcc' to use. + + ld_lld = self.use_llvm_tool('ld.lld', required=required) + lld_link = self.use_llvm_tool('lld-link', required=required) + ld64_lld = self.use_llvm_tool('ld64.lld', required=required) + wasm_ld = self.use_llvm_tool('wasm-ld', required=required) + + was_found = ld_lld and lld_link and ld64_lld and wasm_ld + tool_substitutions = [] + if ld_lld: + tool_substitutions.append(ToolSubst('ld.lld', command=ld_lld)) + if lld_link: + tool_substitutions.append(ToolSubst('lld-link', command=lld_link)) + if ld64_lld: + tool_substitutions.append(ToolSubst('ld64.lld', command=ld64_lld)) + if wasm_ld: + tool_substitutions.append(ToolSubst('wasm-ld', command=wasm_ld)) + self.add_tool_substitutions(tool_substitutions) + return was_found
\ No newline at end of file diff --git a/llvm/utils/lit/lit/llvm/subst.py b/llvm/utils/lit/lit/llvm/subst.py index 3c8db1d31ff..4275b8a56a3 100644 --- a/llvm/utils/lit/lit/llvm/subst.py +++ b/llvm/utils/lit/lit/llvm/subst.py @@ -80,6 +80,7 @@ class ToolSubst(object): self.extra_args = extra_args self.key = key self.command = command if command is not None else FindTool(key) + self.was_resolved = False if verbatim: self.regex = key return @@ -141,5 +142,6 @@ class ToolSubst(object): return None else: raise 'Unexpected value for ToolSubst.unresolved' - + if command_str: + self.was_resolved = True return (self.regex, tool_pipe, command_str) |