From 9559f844f5b9ec092f344c3d13b87ba4b3deebfb Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 19 Feb 2014 10:04:29 +0000 Subject: [CMake] Add the way to run tests in standalone build. 1) Depend on llvm-config (configured in LLVM_CONFIG_PATH) to get necessary LLVM source/binary directories. 2) Add basic support for running lit tests (check-xsan commands). For now this "support" is far from what we want: * unit tests are not built currently. * lit tests use Clang/compiler-rt from LLVM build directory, not the host compiler or just-built compiler-rt libraries. We should make a choice on the way we intend ti run compiler-rt lit testsuite: a) use either Clang from LLVM build tree, or the host compiler. b) use either just-built runtimes, or the runtimes shipped with the host compiler. Using just-built runtimes is tricky - we have to know where to put them, so that Clang/GCC driver would pick them up (and not overwrite the existing runtimes). Using a host compiler instead of Clang from LLVM build tree will give us a chance to run lit tests under GCC (which already has support for several sanitizers). That is, I tend to make the following choice: if we're in a standalone compiler-rt build, use host compiler with its set of runtime libraries to run lit tests. This will effectively decouple "make compiler-rt" and "make check-compiler-rt" in a standalone build - the latter wouldn't invoke the former. Note that if we decide to fix LLVM/Clang/compiler-rt build system so that it would configure/build compiler-rt with just-built Clang (as we do in Makefile-based build), this will not be a problem - we can add a dependency to ensure that clang/compiler-rt are rebuilt before running compiler-rt tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201656 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/CMakeLists.txt') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a614e0fb..30735d70f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,12 +6,16 @@ configure_lit_site_cfg( # add_subdirectory(BlocksRuntime) # add_subdirectory(builtins) +set(SANITIZER_COMMON_LIT_TEST_DEPS) # When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER), # and run tests with tools from the host toolchain. -if (NOT ANDROID) - set(SANITIZER_COMMON_LIT_TEST_DEPS - clang clang-headers FileCheck count not llvm-nm llvm-symbolizer - compiler-rt-headers) +if(NOT ANDROID) + if(NOT COMPILER_RT_STANDALONE_BUILD) + # Use LLVM utils and Clang from the same build tree. + list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS + clang clang-headers FileCheck count not llvm-nm llvm-symbolizer + compiler-rt-headers) + endif() if(UNIX) list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck) endif() -- cgit v1.2.3