diff --git a/ProcessLib/PhaseField/Tests.cmake b/ProcessLib/PhaseField/Tests.cmake index 8567d4eeb2958eee321b45280698ced210a5c709..cfde361af85ad348e70e44878a3a64cc36fad014 100644 --- a/ProcessLib/PhaseField/Tests.cmake +++ b/ProcessLib/PhaseField/Tests.cmake @@ -146,9 +146,9 @@ AddTest( if(OGS_USE_PETSC) NotebookTest(NOTEBOOKFILE PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb RUNTIME 25) - NotebookTest(NOTEBOOKFILE PhaseField/beam_jupyter_notebook/beam.ipynb RUNTIME 500 PROPERTIES PROCESSORS 3 RUN_SERIAL TRUE) - NotebookTest(NOTEBOOKFILE PhaseField/tpb_jupyter_notebook/TPB.ipynb RUNTIME 110 PROPERTIES PROCESSORS 4 RUN_SERIAL TRUE) + NotebookTest(NOTEBOOKFILE PhaseField/beam_jupyter_notebook/beam.ipynb RUNTIME 500 PROPERTIES PROCESSORS 3) + NotebookTest(NOTEBOOKFILE PhaseField/tpb_jupyter_notebook/TPB.ipynb RUNTIME 110 PROPERTIES PROCESSORS 4) NotebookTest(NOTEBOOKFILE PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb RUNTIME 40) - NotebookTest(NOTEBOOKFILE PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb RUNTIME 500 PROPERTIES PROCESSORS 4 RUN_SERIAL TRUE) + NotebookTest(NOTEBOOKFILE PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb RUNTIME 500 PROPERTIES PROCESSORS 4) NotebookTest(NOTEBOOKFILE PhaseField/Kregime_Propagating_jupyter_notebook/Kregime_Propagating_jupyter.ipynb RUNTIME 550) endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9cb270c635c6394cba92ee1a02d74e718e5e9ba7..57077da713fc32ac4e92777eef6f8b2fcb0c472c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -176,8 +176,9 @@ set(TESTRUNNER_ADDITIONAL_ARGUMENTS ${TESTRUNNER_ADDITIONAL_ARGUMENTS} add_custom_target(tests-cleanup ${CMAKE_COMMAND} -E remove -f testrunner.xml) if(OGS_USE_PETSC) + set(MPIRUN_ARGS --bind-to none) if("${HOSTNAME}" MATCHES "frontend.*") - set(MPIRUN_ARGS --mca btl_openib_allow_ib 1 --bind-to none) + list(APPEND MPIRUN_ARGS --mca btl_openib_allow_ib 1) endif() set(TEST_FILTER_MPI --gtest_filter=-MPITest*) add_custom_target(tests diff --git a/scripts/cmake/test/AddTest.cmake b/scripts/cmake/test/AddTest.cmake index 0ab5b41d5d85fd7c930a6f21325b7dfd0856f291..81e7d2e7c1b7427ecef1106582135df40b8a95d3 100644 --- a/scripts/cmake/test/AddTest.cmake +++ b/scripts/cmake/test/AddTest.cmake @@ -99,8 +99,9 @@ function(AddTest) if(NOT DEFINED AddTest_RUNTIME) set(AddTest_RUNTIME 1) elseif(AddTest_RUNTIME GREATER 750) - # Set a timeout on jobs larger than the default ctest timeout of 1500 (s). - # The allowed runtime is twice as long as the given RUNTIME parameter. + # Set a timeout on jobs larger than the default ctest timeout of 1500 + # (s). The allowed runtime is twice as long as the given RUNTIME + # parameter. math(EXPR timeout "${AddTest_RUNTIME} * 2") set(timeout TIMEOUT ${timeout}) endif() @@ -152,10 +153,9 @@ function(AddTest) elseif(AddTest_WRAPPER STREQUAL "mpirun") if(MPIRUN_TOOL_PATH) if("${HOSTNAME}" MATCHES "frontend.*") - set(AddTest_WRAPPER_ARGS ${AddTest_WRAPPER_ARGS} --mca - btl_openib_allow_ib 1 - ) + list(APPEND AddTest_WRAPPER_ARGS --mca btl_openib_allow_ib 1) endif() + list(APPEND AddTest_WRAPPER_ARGS --bind-to none) set(WRAPPER_COMMAND ${MPIRUN_TOOL_PATH}) if("${AddTest_WRAPPER_ARGS}" MATCHES "-np;([0-9]*)") set(MPI_PROCESSORS ${CMAKE_MATCH_1}) @@ -347,7 +347,10 @@ macro(_add_test TEST_NAME) endif() isTestCommandExpectedToSucceed(${TEST_NAME} ${AddTest_PROPERTIES}) - message(DEBUG "Is test '${TEST_NAME}' expected to succeed? → ${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}") + message( + DEBUG + "Is test '${TEST_NAME}' expected to succeed? → ${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}" + ) add_test( NAME ${TEST_NAME} @@ -614,17 +617,17 @@ Use six arguments version of AddTest with absolute and relative tolerances" endmacro() # Checks if a test is expected to succeed based on the properties WILL_FAIL, -# PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION. -# The function expects the test name (used only for debugging purposes) and the -# test properties as arguments. -# The test does not need to exist, yet. This function does not query any test -# case, but only uses the passed list of properties +# PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION. The function expects the +# test name (used only for debugging purposes) and the test properties as +# arguments. The test does not need to exist, yet. This function does not query +# any test case, but only uses the passed list of properties function(isTestCommandExpectedToSucceed TEST_NAME) set(options WILL_FAIL) set(oneValueArgs PASS_REGULAR_EXPRESSION FAIL_REGULAR_EXPRESSION) set(multiValueArgs) - cmake_parse_arguments(TEST_FAILURE "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments( + TEST_FAILURE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} + ) message(DEBUG "failure properties for test ${TEST_NAME}:") list(APPEND CMAKE_MESSAGE_INDENT " ") @@ -633,20 +636,30 @@ function(isTestCommandExpectedToSucceed TEST_NAME) message(DEBUG "FAIL_RE: ${TEST_FAILURE_FAIL_REGULAR_EXPRESSION}") list(POP_BACK CMAKE_MESSAGE_INDENT) - if (${TEST_FAILURE_WILL_FAIL}) - if (DEFINED TEST_FAILURE_PASS_REGULAR_EXPRESSION) + if(${TEST_FAILURE_WILL_FAIL}) + if(DEFINED TEST_FAILURE_PASS_REGULAR_EXPRESSION) # Note: if the test property PASS_REGULAR_EXPRESSION is set, the - # process return code will be ignored, see https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html - message(SEND_ERROR "Error in test '${TEST_NAME}': Please do not use both WILL_FAIL and PASS_REGULAR_EXPRESSION in the same test. The logic will be unclear, then.") + # process return code will be ignored, see + # https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html + message( + SEND_ERROR + "Error in test '${TEST_NAME}': Please do not use both WILL_FAIL and PASS_REGULAR_EXPRESSION in the same test. The logic will be unclear, then." + ) endif() - if (DEFINED TEST_FAILURE_FAIL_REGULAR_EXPRESSION) - message(SEND_ERROR "Error in test '${TEST_NAME}': Please do not use both WILL_FAIL and FAIL_REGULAR_EXPRESSION in the same test. The logic will be unclear, then.") + if(DEFINED TEST_FAILURE_FAIL_REGULAR_EXPRESSION) + message( + SEND_ERROR + "Error in test '${TEST_NAME}': Please do not use both WILL_FAIL and FAIL_REGULAR_EXPRESSION in the same test. The logic will be unclear, then." + ) endif() set(TEST_COMMAND_IS_EXPECTED_TO_SUCCEED false) elseif(DEFINED TEST_FAILURE_PASS_REGULAR_EXPRESSION) - if (DEFINED TEST_FAILURE_FAIL_REGULAR_EXPRESSION) - message(SEND_ERROR "Error in test '${TEST_NAME}': Please do not use both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION in the same test. The logic will be unclear, then.") + if(DEFINED TEST_FAILURE_FAIL_REGULAR_EXPRESSION) + message( + SEND_ERROR + "Error in test '${TEST_NAME}': Please do not use both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION in the same test. The logic will be unclear, then." + ) endif() set(TEST_COMMAND_IS_EXPECTED_TO_SUCCEED false) @@ -654,5 +667,7 @@ function(isTestCommandExpectedToSucceed TEST_NAME) set(TEST_COMMAND_IS_EXPECTED_TO_SUCCEED true) endif() - set(TEST_COMMAND_IS_EXPECTED_TO_SUCCEED "${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}" PARENT_SCOPE) + set(TEST_COMMAND_IS_EXPECTED_TO_SUCCEED + "${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}" PARENT_SCOPE + ) endfunction() diff --git a/scripts/cmake/test/OgsTest.cmake b/scripts/cmake/test/OgsTest.cmake index 8449f9d5b371dcb1fcca6711e9d1caaa6fb9fc5c..a947442af8a14cc1a9a108c4f8546b15b70646da 100644 --- a/scripts/cmake/test/OgsTest.cmake +++ b/scripts/cmake/test/OgsTest.cmake @@ -60,6 +60,7 @@ function(OgsTest) string(REGEX MATCH "^[^ ]+" WRAPPER ${OgsTest_WRAPPER}) if(WRAPPER STREQUAL "mpirun") set(TEST_NAME "${TEST_NAME}-mpi") + list(APPEND OgsTest_WRAPPER --bind-to none) endif() endif() @@ -102,7 +103,10 @@ macro(_ogs_add_test TEST_NAME) string(REPLACE "/" "_" TEST_NAME_UNDERSCORE ${TEST_NAME}) isTestCommandExpectedToSucceed(${TEST_NAME} ${OgsTest_PROPERTIES}) - message(DEBUG "Is test '${TEST_NAME}' expected to succeed? → ${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}") + message( + DEBUG + "Is test '${TEST_NAME}' expected to succeed? → ${TEST_COMMAND_IS_EXPECTED_TO_SUCCEED}" + ) add_test( NAME ${TEST_NAME}