Reland "[lldb] Use just-built libcxx for tests when available"
authorFelipe de Azevedo Piovezan <fpiovezan@apple.com>
Tue, 30 Aug 2022 13:28:14 +0000 (09:28 -0400)
committerFelipe de Azevedo Piovezan <fpiovezan@apple.com>
Mon, 12 Sep 2022 19:32:25 +0000 (15:32 -0400)
commit67c73d88de0e6b095a5eca46016277e4ac66d52d
treeb6053135d32d3a6d0056cd1cc636accaabcdd942
parent53eede597e8423410ec48b7c335c76f3b6c4c714
Reland "[lldb] Use just-built libcxx for tests when available"

This commit improves upon cc0b5ebf7fc8, which added support for
specifying which libcxx to use when testing LLDB. That patch honored
requests by tests that had `USE_LIBCPP=1` defined in their makefiles.
Now, we also use a non-default libcxx if all conditions below are true:

1. The test is not explicitly requesting the use of libstdcpp
(USE_LIBSTDCPP=1).
2. The test is not explicitly requesting the use of the system's
library (USE_SYSTEM_STDLIB=1).
3. A path to libcxx was either provided by the user through CMake flags
or libcxx was built together with LLDB.

Condition (2) is new and introduced in this patch in order to support
tests that are either:

* Cross-platform (such as API/macosx/macCatalyst and
API/tools/lldb-server). The just-built libcxx is usually not built for
platforms other than the host's.
* Cross-language (such as API/lang/objc/exceptions). In this case, the
Objective C runtime throws an exceptions that always goes through the
system's libcxx, instead of the just built libcxx. Fixing this would
require either changing the install-name of the just built libcxx in Mac
systems, or tuning the DYLD_LIBRARY_PATH variable at runtime.

Some other tests exposes limitations of LLDB when running with a debug
standard library. TestDbgInfoContentForwardLists had an assertion
removed, as it was checking for buggy LLDB behavior (which now
crashes). TestFixIts had a variable renamed, as the old name clashes
with a standard library name when debug info is present. This is a known
issue: https://github.com/llvm/llvm-project/issues/34391.

For `TestSBModule`, the way the "main" module is found was changed to
look for the "a.out" module, instead of relying on the index being 0. In
some systems, the index 0 is dyld when a custom standard library is
used.

Differential Revision: https://reviews.llvm.org/D132940
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/test/API/commands/expression/fixits/TestFixIts.py
lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
lldb/test/API/lang/objc/exceptions/Makefile
lldb/test/API/macosx/macCatalyst/Makefile
lldb/test/API/python_api/sbmodule/TestSBModule.py
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py