mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Switch Clang to use the new common LLVM CMake infrastructure for adding
lit testsuites. This sinks all management of the aggregate lit runs into the LLVM CMake files, making Clang only responsible for declaring its own testsuite. In the process we fix numerous "bugs" where the proper method of invoking lit has changed over time, and the old system encoded several broken artifacts of this in ABIs and compatibility tests. It also switches to 'check-clang' for the canonical name of the test suite, although 'clang-test' remains as an alias. The situation when Clang is being built in standalone mode is little changed. It replicates just enough of the lit setup to cope with the oddities of being run outside of an LLVM build. llvm-svn: 159483
This commit is contained in:
parent
69ce6652b8
commit
8a6290721e
@ -1,3 +1,8 @@
|
||||
# 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.
|
||||
|
||||
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
||||
@ -12,69 +17,71 @@ configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
)
|
||||
|
||||
include(FindPythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
if( LLVM_MAIN_SRC_DIR )
|
||||
set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
|
||||
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")
|
||||
if( PATH_TO_LLVM_BUILD )
|
||||
set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
|
||||
endif()
|
||||
|
||||
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 ()
|
||||
|
||||
if( NOT CLANG_BUILT_STANDALONE )
|
||||
|
||||
set(CLANG_TEST_DEPS
|
||||
clang clang-headers
|
||||
c-index-test diagtool arcmt-test c-arcmt-test
|
||||
clang-check
|
||||
llvm-dis llc opt FileCheck count not
|
||||
)
|
||||
if(LLVM_INCLUDE_TESTS)
|
||||
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
|
||||
endif()
|
||||
add_lit_testsuite(check-clang "Running the Clang regression tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PARAMS clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
DEPENDS ${CLANG_TEST_DEPS}
|
||||
ARGS ${CLANG_TEST_EXTRA_ARGS}
|
||||
)
|
||||
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
||||
|
||||
else()
|
||||
|
||||
include(FindPythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
if( LLVM_MAIN_SRC_DIR )
|
||||
set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
|
||||
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()
|
||||
endif()
|
||||
|
||||
if( PATH_TO_LLVM_BUILD )
|
||||
set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
|
||||
endif()
|
||||
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
|
||||
separate_arguments(LIT_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)
|
||||
|
||||
add_custom_target(clang-test.deps)
|
||||
set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests")
|
||||
|
||||
add_custom_target(clang-test
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LIT}
|
||||
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
--param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
--param build_config=${CMAKE_CFG_INTDIR}
|
||||
--param build_mode=${RUNTIME_BUILD_MODE}
|
||||
${LIT_ARGS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Running Clang regression tests")
|
||||
|
||||
if( NOT CLANG_BUILT_STANDALONE )
|
||||
add_custom_target(check-all
|
||||
add_custom_target(check-clang
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LIT}
|
||||
--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")
|
||||
add_dependencies(check-all clang-test.deps)
|
||||
if ( LLVM_INCLUDE_TESTS )
|
||||
add_dependencies(clang-test.deps ClangUnitTests)
|
||||
add_dependencies(check-all check-llvm.deps)
|
||||
endif ( LLVM_INCLUDE_TESTS )
|
||||
add_dependencies(clang-test.deps
|
||||
llvm-dis llc opt
|
||||
FileCheck count not
|
||||
)
|
||||
${LIT}
|
||||
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
--param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
--param build_config=${CMAKE_CFG_INTDIR}
|
||||
--param build_mode=${RUNTIME_BUILD_MODE}
|
||||
${LIT_ARGS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Running Clang regression tests"
|
||||
DEPENDS clang clang-headers
|
||||
c-index-test diagtool arcmt-test c-arcmt-test
|
||||
clang-check
|
||||
)
|
||||
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
||||
endif()
|
||||
|
||||
add_dependencies(clang-test clang-test.deps)
|
||||
add_dependencies(clang-test.deps
|
||||
clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test
|
||||
clang-check
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# Add a legacy target spelling: clang-test
|
||||
add_custom_target(clang-test DEPENDS check-clang)
|
||||
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|
||||
|
Loading…
Reference in New Issue
Block a user