]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Avoid a race condition between concurrent invocations of the
authorMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 28 Sep 2013 14:49:06 +0000 (14:49 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 28 Sep 2013 14:49:06 +0000 (14:49 +0000)
same test with different mpirun processes

git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31000 0785d39b-7218-0410-832d-ea1e28bc413d

tests/cmake/macros/macro_add_test.cmake

index 3bd9ab3f4bbba6c0e5bcee9fcaf3bdb90663b2a2..1a5ebd515c0c870c2a86f7142acad6133274b745 100644 (file)
@@ -74,52 +74,52 @@ 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)
-      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")
-        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(_target ${_test_name}.${_build_lowercase}) # the target name for the executable
+        SET(_run_command) # the first part of the command to issue
         SET(_n_cpu 1) # set it to one, we'll still occupy one processor to run a test ;-)
       ELSE()
-        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
+        SET(_target ${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}) # the target name for the executable
+        SET(_run_command mpirun -np ${_n_cpu}) # the first part of the command to issue
       ENDIF()
 
+      SET(_test_full ${_category}/${_target}) # full test name
+      SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_target}) # directory to run the test in
+
+      # avoid "=" in target names:
+      STRING(REGEX REPLACE "=" "" _target "${_target}")
+      LIST(APPEND _run_command ${_target}) # the second part of the command to issue
+      SET(_diff_target ${_target}.diff) # diff target name
+
       FILE(MAKE_DIRECTORY ${_test_directory})
 
       #
       # 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_USER_DEFINITIONS};${DEAL_II_USER_DEFINITIONS_${_build}}"
-          COMPILE_FLAGS "${DEAL_II_CXX_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 "${DEAL_II_INCLUDE_DIRS}"
-          )
-        SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
-          COMPILE_DEFINITIONS
-            SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
-          )
-        TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET_${_build}})
-      ENDIF()
+
+      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_USER_DEFINITIONS};${DEAL_II_USER_DEFINITIONS_${_build}}"
+        COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}"
+        LINKER_LANGUAGE "CXX"
+        RUNTIME_OUTPUT_DIRECTORY "${_test_directory}"
+        )
+      SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
+        INCLUDE_DIRECTORIES "${DEAL_II_INCLUDE_DIRS}"
+        )
+      SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
+        COMPILE_DEFINITIONS
+          SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
+        )
+      TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET_${_build}})
 
       #
       # Add a top level target to run and compare the test:

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.