llvm.org GIT mirror llvm / 578e573
cmake: Simplify add_lit_testsuites cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be used to simplify this code greatly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272217 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 4 years ago
1 changed file(s) with 14 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
11211121
11221122 # Search recursively for test directories by assuming anything not
11231123 # in a directory called Inputs contains tests.
1124 set(lit_suites)
1125 file(GLOB to_process ${directory}/*)
1126 while(to_process)
1127 set(cur_to_process ${to_process})
1128 set(to_process)
1129 foreach(lit_suite ${cur_to_process})
1130 if(IS_DIRECTORY ${lit_suite})
1131 string(FIND ${lit_suite} Inputs is_inputs)
1132 if (is_inputs EQUAL -1)
1133 list(APPEND lit_suites "${lit_suite}")
1134 file(GLOB subdirs ${lit_suite}/*)
1135 list(APPEND to_process ${subdirs})
1136 endif()
1137 endif()
1138 endforeach()
1139 endwhile()
1140
1141 # Now create a check- target for each test directory.
1142 foreach(dir ${lit_suites})
1143 string(REPLACE ${directory} "" name_slash ${dir})
1124 file(GLOB_RECURSE to_process LIST_DIRECTORIES true ${directory}/*)
1125 foreach(lit_suite ${to_process})
1126 if(NOT IS_DIRECTORY ${lit_suite})
1127 continue()
1128 endif()
1129 string(FIND ${lit_suite} Inputs is_inputs)
1130 if (NOT is_inputs EQUAL -1)
1131 continue()
1132 endif()
1133
1134 # Create a check- target for the directory.
1135 string(REPLACE ${directory} "" name_slash ${lit_suite})
11441136 if (name_slash)
11451137 string(REPLACE "/" "-" name_slash ${name_slash})
11461138 string(REPLACE "\\" "-" name_dashes ${name_slash})
11471139 string(TOLOWER "${project}${name_dashes}" name_var)
1148 add_lit_target("check-${name_var}" "Running lit suite ${dir}"
1149 ${dir}
1140 add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
1141 ${lit_suite}
11501142 PARAMS ${ARG_PARAMS}
11511143 DEPENDS ${ARG_DEPENDS}
11521144 ARGS ${ARG_ARGS}