2012-06-30 18:14:27 +08:00
|
|
|
# Test runner infrastructure for Clang. This configures the Clang test trees
|
|
|
|
# for use by Lit, and delegates to LLVM's lit test handlers.
|
|
|
|
#
|
|
|
|
# If this is a stand-alone Clang build, we fake up our own Lit support here
|
|
|
|
# rather than relying on LLVM's.
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2009-11-08 07:53:32 +08:00
|
|
|
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2009-11-08 07:53:32 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
2012-06-29 08:39:23 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
)
|
2009-11-08 07:53:32 +08:00
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2011-02-03 17:01:12 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2012-06-29 08:39:23 +08:00
|
|
|
)
|
2011-02-03 17:01:12 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
if( PATH_TO_LLVM_BUILD )
|
|
|
|
set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
|
|
|
|
endif()
|
2011-02-06 03:08:56 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
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 ()
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
set(CLANG_TEST_DEPS
|
|
|
|
clang clang-headers
|
|
|
|
c-index-test diagtool arcmt-test c-arcmt-test
|
2013-03-25 17:14:25 +08:00
|
|
|
clang-check clang-format
|
2013-02-08 15:28:25 +08:00
|
|
|
)
|
|
|
|
set(CLANG_TEST_PARAMS
|
|
|
|
clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
)
|
2009-11-23 05:55:22 +08:00
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
if(CLANG_INCLUDE_TESTS)
|
|
|
|
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
|
|
|
|
list(APPEND CLANG_TEST_PARAMS
|
|
|
|
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2012-06-30 18:14:27 +08:00
|
|
|
)
|
2013-02-08 15:28:25 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if( NOT CLANG_BUILT_STANDALONE )
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2013-03-13 17:36:02 +08:00
|
|
|
llc opt FileCheck count not llvm-symbolizer
|
2012-07-03 05:37:04 +08:00
|
|
|
)
|
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
add_lit_testsuite(check-clang "Running the Clang regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2012-07-03 05:37:04 +08:00
|
|
|
PARAMS ${CLANG_TEST_PARAMS}
|
2012-06-30 18:14:27 +08:00
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
|
|
|
ARGS ${CLANG_TEST_EXTRA_ARGS}
|
|
|
|
)
|
|
|
|
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
2010-11-11 12:09:51 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
else()
|
2011-02-15 15:54:28 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
include(FindPythonInterp)
|
|
|
|
if(PYTHONINTERP_FOUND)
|
|
|
|
if( LLVM_MAIN_SRC_DIR )
|
2012-07-03 04:14:59 +08:00
|
|
|
set(LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
|
2012-06-30 18:14:27 +08:00
|
|
|
else()
|
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
|
|
|
|
# Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths.
|
|
|
|
if( NOT EXISTS ${LIT} )
|
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
|
|
|
|
separate_arguments(LIT_ARGS)
|
2013-02-08 15:28:25 +08:00
|
|
|
|
|
|
|
list(APPEND CLANG_TEST_PARAMS build_mode=${CMAKE_CFG_INTDIR})
|
|
|
|
|
|
|
|
foreach(param ${CLANG_TEST_PARAMS})
|
|
|
|
list(APPEND LIT_ARGS --param ${param})
|
|
|
|
endforeach()
|
2009-09-22 18:07:55 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
add_custom_target(check-clang
|
2011-02-15 15:54:28 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
2012-06-30 18:14:27 +08:00
|
|
|
${LIT}
|
|
|
|
${LIT_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2013-02-08 15:28:25 +08:00
|
|
|
${CLANG_TEST_EXTRA_ARGS}
|
2012-06-30 18:14:27 +08:00
|
|
|
COMMENT "Running Clang regression tests"
|
2013-02-08 15:28:25 +08:00
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
2012-06-30 18:14:27 +08:00
|
|
|
)
|
|
|
|
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
2011-07-21 00:35:49 +08:00
|
|
|
endif()
|
2010-12-10 10:58:03 +08:00
|
|
|
|
2009-11-03 15:25:53 +08:00
|
|
|
endif()
|
2012-06-30 18:14:27 +08:00
|
|
|
|
|
|
|
# Add a legacy target spelling: clang-test
|
2012-07-03 05:46:03 +08:00
|
|
|
add_custom_target(clang-test)
|
|
|
|
add_dependencies(clang-test check-clang)
|
2012-06-30 18:14:27 +08:00
|
|
|
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|