[PATCH] D21360: test-suite cmake: Detect test subdirectories when running cmake.

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 16:09:33 PDT 2016


MatzeB created this revision.
MatzeB added reviewers: jmolloy, tra, mehdi_amini, cmatthews.
MatzeB added a subscriber: llvm-commits.
MatzeB set the repository for this revision to rL LLVM.
Herald added a subscriber: mcrosier.

The intention here is that we can have test-suites in independent
repositories using the same infrastructure. Those test-suites can be
checked out into subdirectories of the test-suite and will be picked up
automatically when cmake runs.

I'd like to get some feedback about:
- Is this a good idea?
- Is it fine to search for */CMakeLists.txt on the toplevel test-suite directory? Should we also check the builddir for it? Do we need an extra configuration flag?
- We currently detect subdirectories only when there is no list of subdirs in the CMakeCache yet. This makes the behaviour deterministic across cmake runs but cmake will also miss newly checked test-suites when run a 2nd time in a configured build directory.

Repository:
  rL LLVM

http://reviews.llvm.org/D21360

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -162,9 +162,27 @@
 set(TEST_SUITE_BENCHMARKING_ONLY "OFF" CACHE BOOL
   "Only run the benchmarking only subset")
 
-add_subdirectory(SingleSource)
-add_subdirectory(MultiSource)
-add_subdirectory(External)
+
+# Detect and include subdirectories
+if(NOT TEST_SUITE_SUBDIRS)
+  file(GLOB sub_cmakelists */CMakeLists.txt)
+  set(TEST_SUITE_SUBDIRS "")
+  foreach(entry ${sub_cmakelists})
+    get_filename_component(subdir ${entry} DIRECTORY)
+    if(NOT ${subdir} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/tools)
+      list(APPEND TEST_SUITE_SUBDIRS ${subdir})
+    endif()
+  endforeach()
+  set(TEST_SUITE_SUBDIRS "${TEST_SUITE_SUBDIRS}" CACHE STRING
+      "Semicolon separated list of directories with CMakeLists.txt to include")
+endif()
+mark_as_advanced(TEST_SUITE_SUBDIRS)
+
+foreach(subdir ${TEST_SUITE_SUBDIRS})
+  message(STATUS "Adding directory ${subdir}")
+  add_subdirectory(${subdir})
+endforeach()
+
 
 set(LIT_MODULES "")
 list(APPEND LIT_MODULES run)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21360.60778.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160614/f4b2f302/attachment.bin>


More information about the llvm-commits mailing list