]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a minimalistic 1 minute testsuite
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 15 Sep 2013 15:15:46 +0000 (15:15 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 15 Sep 2013 15:15:46 +0000 (15:15 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30714 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/cmake/macros/macro_deal_ii_add_test.cmake
deal.II/cmake/setup_cached_variables.cmake
deal.II/quick_tests/CMakeLists.txt [deleted file]
deal.II/tests/CMakeLists.txt [new file with mode: 0644]
deal.II/tests/affinity.cc [moved from deal.II/quick_tests/threads/affinity.cc with 100% similarity]
tests/all-headers/CMakeLists.txt

index 9d92608c0b554ab42b75ca41e075346de0367427..01b9da29d878f2c165d9c1cbe7f806b879f24ae0 100644 (file)
@@ -147,9 +147,9 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source
 ADD_SUBDIRECTORY(contrib) # has to be included after source
 ADD_SUBDIRECTORY(examples)
 
-ADD_SUBDIRECTORY(quick_tests)
+ADD_SUBDIRECTORY(tests ${CMAKE_BINARY_DIR}/quick_tests)
 
-IF(BUILD_TESTING AND DEAL_II_HAVE_TESTS_DIRECTORY)
+IF(DEAL_II_COMPONENT_TESTSUITE AND DEAL_II_HAVE_TESTS_DIRECTORY)
   ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests)
 ENDIF()
 
index ffc8cc13d3f72d6642c78f8cc1809b9945e6fbc2..340ee7b2428015d2aab5c45f6305afea2db1dcbf 100644 (file)
@@ -62,47 +62,23 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu)
       #
       # Setup a bunch of variables describing the test:
       #
-
       STRING(TOLOWER ${_build} _build_lowercase)
-
-      # Short test name:
-      SET(_test_short ${_test_name}.${_build_lowercase})
-
-      # The target name for the executable:
-      SET(_target ${_category}-${_test_short})
+      SET(_test_short ${_test_name}.${_build_lowercase}) # short test name
+      SET(_target ${_category}-${_test_short}) # the target name for the executable
 
       # If _n_cpu is equal to "0", a normal, sequental test will be run,
       # otherwise run the test with mpirun:
       IF("${_n_cpu}" STREQUAL "0")
-        # Diff target name:
-        SET(_diff_target ${_target}.diff)
-
-        # Full test name:
-        SET(_test_full ${_category}/${_test_name}.${_build_lowercase})
-
-        # Directory to run the test in:
-        SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short})
-
-        # The command to issue:
-        SET(_run_command ${_target})
-
-        # Finally set it to one, we'll still occupy one processor to run a
-        # test ;-)
-        SET(_n_cpu 1)
-
+        SET(_diff_target ${_target}.diff) # diff target name
+        SET(_test_full ${_category}/${_test_name}.${_build_lowercase}) # full test name
+        SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}) # directory to run the test in
+        SET(_run_command ${_target}) # the command to issue
+        SET(_n_cpu 1) # set it to one, we'll still occupy one processor to run a test ;-)
       ELSE()
-
-        # Diff target name:
-        SET(_diff_target ${_category}-${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}.diff)
-
-        # Full test name:
-        SET(_test_full ${_category}/${_test_name}.mpirun=${_n_cpu}.${_build_lowercase})
-
-        # Directory to run the test in:
-        SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/mpirun=${_n_cpu})
-
-        # The command to issue:
-        SET(_run_command mpirun -np ${_n_cpu} ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/${_target})
+        SET(_diff_target ${_category}-${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}.diff) # diff target name
+        SET(_test_full ${_category}/${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}) # full test name
+        SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/mpirun=${_n_cpu}) # directory to run the test in
+        SET(_run_command mpirun -np ${_n_cpu} ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/${_target}) # the command to issue
       ENDIF()
 
       FILE(MAKE_DIRECTORY ${_test_directory})
@@ -111,32 +87,15 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu)
       # Add an executable for the current test and set up compile
       # definitions and the full link interface:
       #
-
       IF(NOT TARGET ${_target})
         # only add the target once
 
         ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${_test_name}.cc)
-
-        SET_TARGET_PROPERTIES(${_target} PROPERTIES
-          LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}"
-          COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}"
-          COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}"
-          LINKER_LANGUAGE "CXX"
-          RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_test_short}"
-          )
-        SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
-          INCLUDE_DIRECTORIES
-            "${CMAKE_BINARY_DIR}/include"
-            "${CMAKE_SOURCE_DIR}/include"
-            "${CMAKE_SOURCE_DIR}/include/deal.II/"
-          )
+        DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build})
         SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
           COMPILE_DEFINITIONS
             SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
           )
-        TARGET_LINK_LIBRARIES(${_target}
-          ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}
-          )
       ENDIF()
 
       #
index abf4013f1f715233f171d7a0fa6646d9c24e6b7c..9d9f29bb0988205cb18e71524cc80999ddeaee84 100644 (file)
@@ -94,6 +94,13 @@ OPTION(DEAL_II_COMPONENT_PARAMETER_GUI
   OFF
   )
 
+If(DEAL_II_HAVE_TESTS_DIRECTORY)
+  OPTION(DEAL_II_COMPONENT_TESTSUITE
+    "Enable the full regression testsuite."
+    OFF
+    )
+ENDIF()
+
 OPTION(DEAL_II_ALLOW_AUTODETECTION
   "Allow to automatically setup features by setting all undefined DEAL_II_WITH_* variables to ON or OFF"
   ON
@@ -113,12 +120,6 @@ IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
 ENDIF()
 
 
-OPTION(BUILD_TESTING
-  "This option will enable the configuration of the build tests"
-  OFF
-  )
-
-
 ########################################################################
 #                                                                      #
 #                       Compilation and linking:                       #
@@ -321,7 +322,7 @@ FOREACH(_var ${_res})
   #
   # Same for components:
   #
-  IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI)")
+  IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI|TESTSUITE)")
     SET(DEAL_II_COMPONENT_${_var} ${${_var}} CACHE BOOL "" FORCE)
     UNSET(${_var} CACHE)
   ENDIF()
diff --git a/deal.II/quick_tests/CMakeLists.txt b/deal.II/quick_tests/CMakeLists.txt
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6c0bf42
--- /dev/null
@@ -0,0 +1,84 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# A minimalistic set of tests:
+#
+
+
+FOREACH(_build ${DEAL_II_BUILD_TYPES})
+  STRING(TOLOWER ${_build} _build_lowercase)
+
+  #
+  # Test whether it is possible to configure, build and run a simplistic
+  # project, we use step 1:
+  #
+
+  SET(_target project.${_build_lowercase})
+  SET(_project_src ${CMAKE_SOURCE_DIR}/examples/step-1)
+  SET(_project ${CMAKE_CURRENT_BINARY_DIR}/${_target})
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${_project}/CMakeLists.txt
+    COMMAND ${CMAKE_COMMAND} -E copy ${_project_src}/step-1.cc ${_project}/step-1.cc
+    COMMAND ${CMAKE_COMMAND} -E copy ${_project_src}/CMakeLists.txt ${_project}/CMakeLists.txt
+    DEPENDS ${_project_src}/step-1.cc ${_project_src}/CMakeLists.txt
+    )
+  ADD_CUSTOM_COMMAND(OUTPUT ${_project}-OK
+    COMMAND ${CMAKE_COMMAND} -DDEAL_II_DIR=${CMAKE_BINARY_DIR} -DCMAKE_BUILD_TYPE=${_build} .
+      || (rm ${_project}-OK && exit 1)
+    COMMAND ${CMAKE_COMMAND} --build ${_project} --target run > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+      || (rm ${_project}-OK && exit 1)
+    COMMAND touch ${_project}-OK
+    WORKING_DIRECTORY ${_project}
+    DEPENDS ${_project}/CMakeLists.txt
+    )
+  ADD_CUSTOM_TARGET(${_target} DEPENDS ${_project}-OK)
+
+  ADD_TEST(NAME ${_target}
+    COMMAND ${CMAKE_COMMAND} -DTRGT=${_target} -DTEST=${_target}
+      -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
+      -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+  SET_TESTS_PROPERTIES(${_test} PROPERTIES LABEL "${_category}")
+
+  #
+  # Test whether thread affinity is well behaved:
+  #
+  SET(_target affinity.${_build_lowercase})
+
+  ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL affinity.cc)
+  DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build})
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+    COMMAND ${_target} > ${_target}-OK 2>&1
+      || (mv ${_target}-OK ${_target}-FAILED
+          && echo "${_target}: FAILED":
+          && cat ${_target}-FAILED
+          && exit 1)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+  ADD_CUSTOM_TARGET(${_target}.run DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK)
+
+  ADD_TEST(NAME ${_target}
+    COMMAND ${CMAKE_COMMAND} -DTRGT=${_target} -DTEST=${_target}
+      -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
+      -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+  SET_TESTS_PROPERTIES(${_target} PROPERTIES LABEL "sanity checks")
+
+ENDFOREACH()
index c9e9c8204f1c9e885baeea331cc52477b0f31b6c..a3cb5dca3d5c3bc20e668eeff4e2439ef7038995 100644 (file)
@@ -47,16 +47,7 @@ FOREACH(_full_file ${_header})
 
       # Add an object library for each header file and build configuration:
       ADD_LIBRARY(${_target} OBJECT EXCLUDE_FROM_ALL test_header.cc)
-      SET_TARGET_PROPERTIES(${_target} PROPERTIES
-        COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}"
-        COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}"
-        )
-      SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
-        INCLUDE_DIRECTORIES
-          "${CMAKE_BINARY_DIR}/include"
-          "${CMAKE_SOURCE_DIR}/include"
-          "${CMAKE_SOURCE_DIR}/include/deal.II/"
-        )
+      DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build})
       SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
         COMPILE_DEFINITIONS HEADER=<deal.II/${_path}/${_file}>
         )

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.