From 66be5a5776eb37897001fea2a21184c3e83b5d3f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 25 Oct 2017 10:43:43 -0500 Subject: [PATCH] Avoid numdiff check race condition in test Use randomly generated file names for collision free (concurrent) checks for numdiff support. Otherwise, if a test subproject is configured concurrently (which might happen if ctest accidentally triggers a reconfigure due to changed files in the main project), the following error might occur: "The detected numdiff executable was not able to pass a simple relative tolerance test." --- cmake/macros/macro_deal_ii_pickup_tests.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/macros/macro_deal_ii_pickup_tests.cmake b/cmake/macros/macro_deal_ii_pickup_tests.cmake index 1ce3748519..93ad5bc0b1 100644 --- a/cmake/macros/macro_deal_ii_pickup_tests.cmake +++ b/cmake/macros/macro_deal_ii_pickup_tests.cmake @@ -149,10 +149,11 @@ MACRO(DEAL_II_PICKUP_TESTS) # STRING(FIND "${NUMDIFF_EXECUTABLE}" "numdiff" _found_numdiff_binary) IF(NOT "${_found_numdiff_binary}" STREQUAL "-1") + STRING(RANDOM _suffix) SET(_first_test_file_name - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/numdiff-test-1.txt") + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/numdiff-test-${_suffix}-1.txt") SET(_second_test_file_name - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/numdiff-test-2.txt") + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/numdiff-test-${_suffix}-2.txt") FILE(WRITE "${_first_test_file_name}" "0.99999999998\n2.0\n1.0\n") FILE(WRITE "${_second_test_file_name}" "1.00000000001\n2.0\n1.0\n") -- 2.39.5