[lldb/Test] Fix ASan/TSan workaround for Xcode Python 3
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 12 Jun 2020 02:29:26 +0000 (19:29 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 12 Jun 2020 02:36:42 +0000 (19:36 -0700)
commit526e0c8d15216e6c49b1769c63f5433df6841c64
tree9de870414f5310096a425adc54594447300c3fed
parent4db1878158a3f481ff673fef2396c12b7a53d280
[lldb/Test] Fix ASan/TSan workaround for Xcode Python 3

The Python 3 interpreter in Xcode has a relative RPATH and dyld fails to
load it when we copy it into the build directory.

This patch adds an additional check that the copied binary can be
executed. If it doesn't, we assume we're dealing with the Xcode python
interpreter and return the path to the real executable. That is
sufficient for the sanitizers because only system binaries need to be
copied to work around SIP.

This patch also moves all that logic out of LLDBTest and into the lit
configuration so that it's executed only once per test run, instead of
once for every test. Although I didn't benchmark the difference this
should result in a mild speedup.

Differential revision: https://reviews.llvm.org/D81696
lldb/test/API/lit.cfg.py
lldb/test/API/lit.site.cfg.py.in
lldb/test/API/lldbtest.py