summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-05-06 21:57:30 +0000
committerJustin Bogner <mail@justinbogner.com>2016-05-06 21:57:30 +0000
commit47b984c7920819b6ccb31ec69b992e5bb1521539 (patch)
tree6fb68a38f000a64fb4da0b4b2078b2b654e28c92 /cmake
parent3783c2965835da70b569250879a9dde925f08252 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake27
1 files changed, 21 insertions, 6 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index f04081befc8..6bdb76259a0 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -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})
- endforeach()
- list(REMOVE_DUPLICATES lit_suites)
+ 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()
+ endwhile()
+
+ # Now create a check- target for each test directory.
foreach(dir ${lit_suites})
string(REPLACE ${directory} "" name_slash ${dir})
if (name_slash)