]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bufix: Well, it is a good idea to not destroy formerly working functionality
authorMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 20 Nov 2013 17:31:56 +0000 (17:31 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 20 Nov 2013 17:31:56 +0000 (17:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@31731 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/setup_testsuite.cmake
deal.II/tests/CMakeLists.txt

index 00e7b2dfb7aab1b749f752574b4a297e11e7ab32..23b0de2f461fb29a576086561ef9fee986221642 100644 (file)
 ## ---------------------------------------------------------------------
 
 #
-# Setup the testsuite. The top level targets defined here merely act as a
-# multiplexer for the ./tets/ project where all the actual work is
-# done...
+# This is a bloody hack to avoid a severe performance penalty when using
+# 12k top level targets with GNU Make that really does not like that...
+#
+# The only choice we have is to set up every test subdirectory as an
+# independent project. Unfortunately this adds quite a significant amount
+# of complexity :-(
+#
+
+#
+# Setup the testsuite.
 #
 
 SET_IF_EMPTY(MAKEOPTS $ENV{MAKEOPTS})
@@ -47,11 +54,7 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "")
 #
 
 # Setup tests:
-ADD_CUSTOM_TARGET(setup_tests
-  COMMAND ${CMAKE_COMMAND}
-    --build ${CMAKE_BINARY_DIR}/tests --target setup_tests
-    -- ${MAKEOPTS}
-  )
+ADD_CUSTOM_TARGET(setup_tests)
 
 # Regenerate tests (run "make rebuild_cache" in subprojects):
 ADD_CUSTOM_TARGET(regen_tests
@@ -74,19 +77,33 @@ ADD_CUSTOM_TARGET(prune_tests
     -- ${MAKEOPTS}
   )
 
+MESSAGE(STATUS "Setup testsuite")
+
 #
-# Setup the testsuite and pass all relevant "TEST_" and "_DIR" variables
+# Setup the testsuite project: It is merely a wrapper around the individual
+# regen_tests_*, clean_tests_* and prune_tests_* targets.
 # down to it:
 #
 
-MESSAGE(STATUS "Setup testsuite")
+EXECUTE_PROCESS(
+  COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR}
+    -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
+    -DTEST_DIR=${TEST_DIR}
+    ${CMAKE_SOURCE_DIR}/tests
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests
+  OUTPUT_QUIET
+  )
 
 SET(_options)
 LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
 LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
 FOREACH(_var
-    DIFF_DIR NUMDIFF_DIR TEST_DIR TEST_DIFF TEST_OVERRIDE_LOCATION
-    TEST_PICKUP_REGEX TEST_TIME_LIMIT
+    DIFF_DIR
+    NUMDIFF_DIR
+    TEST_DIFF
+    TEST_OVERRIDE_LOCATION
+    TEST_PICKUP_REGEX
+    TEST_TIME_LIMIT
     )
   # always undefine:
   LIST(APPEND _options "-U${_var}")
@@ -95,12 +112,44 @@ FOREACH(_var
   ENDIF()
 ENDFOREACH()
 
-EXECUTE_PROCESS(
-  COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options}
-    ${CMAKE_SOURCE_DIR}/tests
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests
-  OUTPUT_QUIET
-  )
+#
+# Glob together a list of all subfolders to set up:
+#
+
+FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*)
+SET(_categories all-headers build_tests mesh_converter ${_categories})
+LIST(REMOVE_DUPLICATES _categories)
+
+#
+# Define a subproject for every enabled category:
+#
+
+FOREACH(_category ${_categories})
+  IF(EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt)
+    SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category})
+  ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt)
+    SET(_category_dir ${TEST_DIR}/${_category})
+  ELSE()
+    SET(_category_dir)
+  ENDIF()
+
+  IF(NOT "${_category_dir}" STREQUAL "")
+    ADD_CUSTOM_TARGET(setup_tests_${_category}
+      COMMAND ${CMAKE_COMMAND} -E make_directory
+        ${CMAKE_BINARY_DIR}/tests/${_category}
+      COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} &&
+        ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir}
+        > /dev/null
+      DEPENDS ${_category_dir}
+      COMMENT "Processing tests/${_category}"
+      )
+    ADD_DEPENDENCIES(setup_tests setup_tests_${_category})
+
+    FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake
+      "SUBDIRS(${_category})\n"
+      )
+  ENDIF()
+ENDFOREACH()
 MESSAGE(STATUS "Setup testsuite - Done")
 
 MESSAGE(STATUS "Regenerating testsuite subprojects")
@@ -111,4 +160,5 @@ EXECUTE_PROCESS(
   OUTPUT_QUIET
   )
 MESSAGE(STATUS "Regenerating testsuite subprojects - Done")
+
 MESSAGE(STATUS "")
index 8b6a8036785d0c96b5f860947125ef304c9ff40b..14d41b5410209c8844a84e08b7ba7913a1dcf742 100644 (file)
@@ -14,7 +14,7 @@
 ##
 ## ---------------------------------------------------------------------
 
-IF(NOT DEFINED DEAL_II_SOURCE_DIR OR NOT DEFINED DEAL_II_BINARY_DIR)
+IF(NOT DEFINED DEAL_II_BINARY_DIR)
   MESSAGE(FATAL_ERROR "\n
   The testsuite cannot be set up as an independent project.
   Please configure \"deal.II\" directly instead.\n\n"
@@ -25,19 +25,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
 PROJECT(testsuite NONE)
 
 #
-# This is a bloody hack to avoid a severe performance penalty when using
-# 12k top level targets with GNU Make that really does not like that...
-#
-# The only choice we have is to set up every test subdirectory as an
-# independent project. Unfortunately this adds quite a significant amount
-# of complexity :-(
-
-#
-# Custom targets to set and clean up the testsuite:
+# This is a small project that provides some custom targets that need a
+# working, independent subproject because they are called back during
+# configure phase.
 #
 
 # Setup tests:
-ADD_CUSTOM_TARGET(setup_tests)
+ADD_CUSTOM_TARGET(setup_tests
+  COMMAND ${CMAKE_COMMAND}
+    --build ${DEAL_II_BINARY_DIR} --target setup_tests
+  )
 
 # Regenerate tests (run "make rebuild_cache" in subprojects):
 ADD_CUSTOM_TARGET(regen_tests)
@@ -48,32 +45,6 @@ ADD_CUSTOM_TARGET(clean_tests)
 # Remove all tests:
 ADD_CUSTOM_TARGET(prune_tests)
 
-#
-# Be as quiet as possible:
-#
-
-IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
-  SET(_shoo)
-ELSE()
-  SET(_shoo >/dev/null)
-ENDIF()
-
-#
-# Pass down all relevant configuration:
-#
-
-SET(_options)
-FOREACH(_var
-    DEAL_II_SOURCE_DIR DEAL_II_BINARY_DIR DIFF_DIR NUMDIFF_DIR
-    TEST_DIFF TEST_OVERRIDE_LOCATION TEST_PICKUP_REGEX TEST_TIME_LIMIT
-    )
-  # always undefine:
-  LIST(APPEND _options "-U${_var}")
-  IF(DEFINED ${_var})
-    LIST(APPEND _options "-D${_var}=${${_var}}")
-  ENDIF()
-ENDFOREACH()
-
 #
 # Glob together a list of all subfolders to set up:
 #
@@ -87,38 +58,18 @@ LIST(REMOVE_DUPLICATES _categories)
 #
 
 FOREACH(_category ${_categories})
-  IF(EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt)
-    SET(_category_dir ${CMAKE_SOURCE_DIR}/${_category})
-  ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt)
-    SET(_category_dir ${TEST_DIR}/${_category})
-  ELSE()
-    SET(_category_dir)
-  ENDIF()
-
-  IF(NOT "${_category_dir}" STREQUAL "")
-
-    ADD_CUSTOM_TARGET(setup_tests_${_category}
-      COMMAND ${CMAKE_COMMAND} -E make_directory
-        ${CMAKE_BINARY_DIR}/${_category}
-      COMMAND cd ${CMAKE_BINARY_DIR}/${_category} &&
-        ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir}
-        ${_shoo}
-      DEPENDS ${_category_dir}
-      COMMENT "Processing tests/${_category}"
-      )
-    ADD_DEPENDENCIES(setup_tests setup_tests_${_category})
+  IF( EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt OR
+      EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt )
 
     ADD_CUSTOM_TARGET(regen_tests_${_category}
       COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND}
         --build ${CMAKE_BINARY_DIR}/${_category} --target regenerate
-        ${_shoo}
       )
     ADD_DEPENDENCIES(regen_tests regen_tests_${_category})
 
     ADD_CUSTOM_TARGET(clean_tests_${_category}
       COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND}
         --build ${CMAKE_BINARY_DIR}/${_category} --target clean
-        ${_shoo}
       )
     ADD_DEPENDENCIES(clean_tests clean_tests_${_category})
 
@@ -128,10 +79,5 @@ FOREACH(_category ${_categories})
       )
     ADD_DEPENDENCIES(prune_tests prune_tests_${_category})
 
-    FILE(APPEND ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
-      "SUBDIRS(${_category})\n"
-      )
-
   ENDIF()
 ENDFOREACH()
-

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.