summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-06-08 22:36:37 +0000
committerJustin Bogner <mail@justinbogner.com>2016-06-08 22:36:37 +0000
commit3adaa8cf4a6df45430b47a62c649c7cb54bb1626 (patch)
tree67136789d2765a04c93354b6afaed79e5145c664 /llvm
parent79e7c2c9b4430d008d7a06e670d9078a3bfcd8d3 (diff)
downloadbcm5719-llvm-3adaa8cf4a6df45430b47a62c649c7cb54bb1626.tar.gz
bcm5719-llvm-3adaa8cf4a6df45430b47a62c649c7cb54bb1626.zip
cmake: Simplify add_lit_testsuites
cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be used to simplify this code greatly. llvm-svn: 272217
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake34
1 files changed, 13 insertions, 21 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 4668ddc78a8..146dde516ab 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1122,32 +1122,24 @@ function(add_lit_testsuites project directory)
# Search recursively for test directories by assuming anything not
# in a directory called Inputs contains tests.
- set(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(IS_DIRECTORY ${lit_suite})
- 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()
- endif()
- endforeach()
- endwhile()
+ file(GLOB_RECURSE to_process LIST_DIRECTORIES true ${directory}/*)
+ foreach(lit_suite ${to_process})
+ if(NOT IS_DIRECTORY ${lit_suite})
+ continue()
+ endif()
+ string(FIND ${lit_suite} Inputs is_inputs)
+ if (NOT is_inputs EQUAL -1)
+ continue()
+ endif()
- # Now create a check- target for each test directory.
- foreach(dir ${lit_suites})
- string(REPLACE ${directory} "" name_slash ${dir})
+ # Create a check- target for the directory.
+ string(REPLACE ${directory} "" name_slash ${lit_suite})
if (name_slash)
string(REPLACE "/" "-" name_slash ${name_slash})
string(REPLACE "\\" "-" name_dashes ${name_slash})
string(TOLOWER "${project}${name_dashes}" name_var)
- add_lit_target("check-${name_var}" "Running lit suite ${dir}"
- ${dir}
+ add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
+ ${lit_suite}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
OpenPOWER on IntegriCloud