blob: 42c63fccf4f513ab905a203e94b4d074fb861056 [file] [log] [blame]
set(CLANG_TEST_DIRECTORIES
"Analysis"
"CodeCompletion"
"CodeGen"
"CodeGenCXX"
"CodeGenObjC"
"Coverage"
"CXX"
"Driver"
"FixIt"
"Frontend"
"Headers"
"Index"
"Lexer"
"Misc"
"PCH"
"Parser"
"Preprocessor"
"Rewriter"
"Sema"
"SemaCXX"
"SemaObjC"
"SemaObjCXX"
"SemaTemplate")
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
set(CLANG_TEST_EXTRA_ARGS)
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
if(CLANG_TEST_USE_VG)
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
endif ()
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
foreach(testdir ${CLANG_TEST_DIRECTORIES})
add_custom_target(clang-test-${testdir}
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}/${testdir}
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests in ${testdir}")
endforeach()
add_custom_target(clang-test
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests")
add_custom_target(clang-c++tests
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
${LIT_ARGS}
${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests")
add_custom_target(check-all
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${LLVM_BINARY_DIR}/test
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running Clang and LLVM regression tests")
endif()