mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-30 06:40:53 +00:00
Hoist LLVM's lit testsuite infrastructure into module so that it can be
re-used. Also, build in direct support for accumulating a set of lit parameters, arguments, and testsuites to run as part of a 'check-all' rule. This sinks 'check-all' from a Clang-specific construct to a generic construct of the project. llvm-svn: 159482
This commit is contained in:
parent
19c2badc83
commit
7f56993d8e
@ -426,6 +426,20 @@ if( LLVM_INCLUDE_TESTS )
|
||||
# Windows.
|
||||
add_subdirectory(utils/KillTheDoctor)
|
||||
endif()
|
||||
|
||||
# Add a global check rule now that all subdirectories have been traversed
|
||||
# and we know the total set of lit testsuites.
|
||||
get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
|
||||
get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
|
||||
get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
|
||||
get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
|
||||
add_lit_target(check-all
|
||||
"Running all regression tests"
|
||||
${LLVM_LIT_TESTSUITES}
|
||||
PARAMS ${LLVM_LIT_PARAMS}
|
||||
DEPENDS ${LLVM_LIT_DEPENDS}
|
||||
ARGS ${LLVM_LIT_EXTRA_ARGS}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(cmake/modules)
|
||||
|
@ -1,3 +1,4 @@
|
||||
include(LLVMParseArguments)
|
||||
include(LLVMProcessSources)
|
||||
include(LLVM-Config)
|
||||
|
||||
@ -249,3 +250,45 @@ function(configure_lit_site_cfg input output)
|
||||
|
||||
configure_file(${input} ${output} @ONLY)
|
||||
endfunction()
|
||||
|
||||
# A raw function to create a lit target. This is used to implement the testuite
|
||||
# management functions.
|
||||
function(add_lit_target target comment)
|
||||
parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
|
||||
set(LIT_ARGS "${ARG_ARGS} ${LLVM_LIT_ARGS}")
|
||||
separate_arguments(LIT_ARGS)
|
||||
set(LIT_COMMAND
|
||||
${PYTHON_EXECUTABLE}
|
||||
${LLVM_SOURCE_DIR}/utils/lit/lit.py
|
||||
--param build_config=${CMAKE_CFG_INTDIR}
|
||||
--param build_mode=${RUNTIME_BUILD_MODE}
|
||||
${LIT_ARGS}
|
||||
)
|
||||
foreach(param ${ARG_PARAMS})
|
||||
list(APPEND LIT_COMMAND --param ${param})
|
||||
endforeach()
|
||||
add_custom_target(${target}
|
||||
COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS}
|
||||
COMMENT "${comment}"
|
||||
DEPENDS ${ARG_DEPENDS}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# A function to add a set of lit test suites to be driven through 'check-*' targets.
|
||||
function(add_lit_testsuite target comment)
|
||||
parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
|
||||
|
||||
# Register the testsuites, params and depends for the global check rule.
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_DEFAULT_ARGS})
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${ARG_ARGS})
|
||||
|
||||
# Produce a specific suffixed check rule.
|
||||
add_lit_target(${target} ${comment}
|
||||
${ARG_DEFAULT_ARGS}
|
||||
PARAMS ${ARG_PARAMS}
|
||||
DEPENDS ${ARG_DEPENDS}
|
||||
ARGS ${ARG_ARGS}
|
||||
)
|
||||
endfunction()
|
||||
|
@ -1,6 +1,3 @@
|
||||
set(LIT_ARGS "${LLVM_LIT_ARGS}")
|
||||
separate_arguments(LIT_ARGS)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
@ -10,9 +7,10 @@ configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
)
|
||||
|
||||
# Setup the basic dependencies for running LLVM's regression and unit test
|
||||
# suites.
|
||||
add_custom_target(check-llvm.deps
|
||||
add_lit_testsuite(check-llvm "Running the LLVM regression tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PARAMS llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
DEPENDS UnitTests
|
||||
BugpointPasses LLVMHello
|
||||
llc lli llvm-ar llvm-as llvm-dis llvm-extract llvm-dwarfdump
|
||||
@ -20,23 +18,9 @@ add_custom_target(check-llvm.deps
|
||||
macho-dump opt
|
||||
FileCheck count not
|
||||
)
|
||||
set_target_properties(check-llvm.deps PROPERTIES FOLDER "Tests")
|
||||
|
||||
# This is the primary action target to check the LLVM regression and unit test
|
||||
# suite.
|
||||
add_custom_target(check-llvm
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LLVM_SOURCE_DIR}/utils/lit/lit.py
|
||||
--param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
--param llvm_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 LLVM regression tests"
|
||||
DEPENDS check-llvm.deps
|
||||
)
|
||||
set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
|
||||
|
||||
# Setup a legacy alias for 'check-llvm'. This will likely change to be an
|
||||
# alias for 'check-all' at some point in the future.
|
||||
add_custom_target(check DEPENDS check-llvm)
|
||||
set_target_properties(check PROPERTIES FOLDER "Tests")
|
||||
|
Loading…
Reference in New Issue
Block a user