CMake: generate check targets for lit suites without their own lit.cfgs

Currently our cmake generates targets like check-llvm-unit and
check-llvm-transforms-loopunroll-x86, but not check-llvm-transforms or
check-llvm-transforms-adce. This is because the search for test suites
only lists the ones with a custom lit.cfg or lit.local.cfg.

Instead, we can do something a little smarter - any directory under
test that isn't called Inputs or inside a directory called Inputs is a
test suite.

llvm-svn: 268806
This commit is contained in:
Justin Bogner 2016-05-06 21:57:30 +00:00
parent 71474e8d22
commit e88946223c
1 changed files with 21 additions and 6 deletions

View File

@ -1050,13 +1050,28 @@ endfunction()
function(add_lit_testsuites project directory)
if (NOT CMAKE_CONFIGURATION_TYPES)
cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
file(GLOB_RECURSE litCfg ${directory}/lit*.cfg)
# Search recursively for test directories by assuming anything not
# in a directory called Inputs contains tests.
set(lit_suites)
foreach(f ${litCfg})
get_filename_component(dir ${f} DIRECTORY)
set(lit_suites ${lit_suites} ${dir})
file(GLOB to_process ${directory}/*)
while(to_process)
set(cur_to_process ${to_process})
set(to_process)
foreach(lit_suite ${cur_to_process})
if(NOT IS_DIRECTORY ${lit_suite})
continue()
endif()
string(FIND ${lit_suite} Inputs is_inputs)
if (is_inputs EQUAL -1)
list(APPEND lit_suites "${lit_suite}")
file(GLOB subdirs ${lit_suite}/*)
list(APPEND to_process ${subdirs})
endif()
endforeach()
list(REMOVE_DUPLICATES lit_suites)
endwhile()
# Now create a check- target for each test directory.
foreach(dir ${lit_suites})
string(REPLACE ${directory} "" name_slash ${dir})
if (name_slash)