[llvm] r272217 - cmake: Simplify add_lit_testsuites
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 15:36:37 PDT 2016
Author: bogner
Date: Wed Jun 8 17:36:37 2016
New Revision: 272217
URL: http://llvm.org/viewvc/llvm-project?rev=272217&view=rev
Log:
cmake: Simplify add_lit_testsuites
cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be
used to simplify this code greatly.
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=272217&r1=272216&r2=272217&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Wed Jun 8 17:36:37 2016
@@ -1122,32 +1122,24 @@ function(add_lit_testsuites project dire
# 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}
More information about the llvm-commits
mailing list