This patch is the result of a discussion on lldb-dev, see http://lists.llvm.org/pipermail/lldb-dev/2018-January/013111.html for background.
This is a first sketch of how to move building of the testcases in the LLDB testsuite out of the source tree. The patch is buggy and incomplete, but I would like to develop this as much in the open as possible to solicit early feedback in case I'm unwittingly cutting any corners that will break somebody's platform.
For each test (should be eventually: each test configuration) a separate build directory is created and we execute make VPATH=$srcdir/path/to/test -C $builddir/path/to/test -f $srcdir/path/to/test/Makefile -I $srcdir/path/to/test.
In order to make this work all LLDB tests need to be updated to find the executable in the test build directory, since CWD still points at the test's source directory, which is a requirement for unittest2. That patch is very boring and therefore outsourced to https://reviews.llvm.org/D42280 to make this review easier to read.