@@ -8,11 +8,11 @@ set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYP
88
99# Add option and check environment to determine if developer tests should be run
1010if ($ENV{OPENCOARRAYS_DEVELOPER} )
11- option (RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON )
11+ option (CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON )
1212else ()
13- option (RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF )
13+ option (CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF )
1414endif ()
15- mark_as_advanced (RUN_DEVELOPER_TESTS )
15+ mark_as_advanced (CAF_RUN_DEVELOPER_TESTS )
1616
1717if ( NOT DEFINED ENV{OPENCOARRAYS_DEVELOPER})
1818 set ( ENV{OPENCOARRAYS_DEVELOPER} FALSE )
@@ -387,7 +387,7 @@ include(GNUInstallDirs)
387387#-------------------------------
388388# Recurse into the src directory
389389#-------------------------------
390- include_directories (${CMAKE_CURRENT_SOURCE_DIR} /src)
390+ include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR} /src)
391391
392392add_subdirectory (src)
393393
@@ -465,6 +465,24 @@ function(add_mpi_test name num_mpi_proc path)
465465 set_property (TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed." )
466466endfunction (add_mpi_test)
467467
468+ function (add_fault_tolerant_mpi_test name num_mpi_proc path )
469+ if ( ((N LESS num_mpi_proc) OR (N EQUAL 0)) )
470+ message (STATUS "Test ${name} is oversubscribed: ${num_mpi_proc} ranks requested with ${N} system processor available." )
471+ if ( openmpi )
472+ if ( N LESS 2 )
473+ set ( num_mpi_proc 2 )
474+ set (test_parameters --oversubscribe)
475+ else ()
476+ set ( num_mpi_proc ${N} )
477+ endif ()
478+ message ( STATUS "Open-MPI detected, over-riding oversubscribed test, ${name} , with ${num_mpi_proc} ranks." )
479+ endif ()
480+ endif ()
481+ set (test_parameters ${test_parameters} ${MPIEXEC_NUMPROC_FLAG} ${num_mpi_proc} -disable-auto-cleanup )
482+ add_test (NAME ${name} COMMAND ${MPIEXEC} ${test_parameters} "${path} " )
483+ set_property (TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed." )
484+ endfunction (add_fault_tolerant_mpi_test)
485+
468486set (tests_root ${CMAKE_CURRENT_BINARY_DIR} /src/tests)
469487
470488
@@ -480,7 +498,7 @@ if(opencoarrays_aware_compiler)
480498 add_mpi_test(register_alloc_comp_1 2 ${tests_root} /unit/init_register/register_alloc_comp_1)
481499 add_mpi_test(register_alloc_comp_2 2 ${tests_root} /unit/init_register/register_alloc_comp_2)
482500 add_mpi_test(register_alloc_comp_3 2 ${tests_root} /unit/init_register/register_alloc_comp_3)
483- if (RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} )
501+ if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} )
484502 message ( STATUS "Running Developer tests is enabled." )
485503 add_mpi_test(async_comp_alloc 6 ${tests_root} /unit/init_register/async_comp_alloc)
486504 # Timeout async_comp_alloc test after 3 seconds to progess past the known failure
@@ -523,16 +541,34 @@ if(opencoarrays_aware_compiler)
523541 # GFortran PR 78505 only fixed on trunk/gcc 7
524542 add_mpi_test(source -alloc-no -sync 8 ${tests_root} /regression/reported/source -alloc-sync)
525543 endif ()
526- if (RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} )
544+ if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} )
527545 add_mpi_test(convert-before-put 3 ${tests_root} /regression/reported/convert-before-put)
528546 endif ()
529547 add_mpi_test(event-post 3 ${tests_root} /regression/reported/event-post)
530548 add_mpi_test(co_reduce-factorial 4 ${tests_root} /regression/reported/co_reduce-factorial)
531549 add_mpi_test(co_reduce-factorial-int8 4 ${tests_root} /regression/reported/co_reduce-factorial-int8)
532550 add_mpi_test(co_reduce-factorial-int64 4 ${tests_root} /regression/reported/co_reduce-factorial-int64)
533551 add_mpi_test(co_reduce_string 4 ${tests_root} /unit/collectives/co_reduce_string)
534- # remove this before merging into master
535- # set_property(TEST co_reduce-factorial PROPERTY WILL_FAIL TRUE)
552+
553+ # IMAGE FAIL tests
554+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7)
555+ add_mpi_test(image_status_test_1 4 ${tests_root} /unit/fail_images/image_status_test_1)
556+ if (CAF_ENABLE_FAILED_IMAGES)
557+ # No other way to check that image_fail_test_1 passes.
558+ add_fault_tolerant_mpi_test(image_fail_test_1 4 ${tests_root} /unit/fail_images/image_fail_test_1)
559+ set_property (TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed" )
560+ set_property (TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed" )
561+ add_fault_tolerant_mpi_test(image_fail_and_sync_test_1 4 ${tests_root} /unit/fail_images/image_fail_and_sync_test_1)
562+ if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} )
563+ add_fault_tolerant_mpi_test(image_fail_and_sync_test_2 4 ${tests_root} /unit/fail_images/image_fail_and_sync_test_2)
564+ endif ()
565+ add_fault_tolerant_mpi_test(image_fail_and_sync_test_3 4 ${tests_root} /unit/fail_images/image_fail_and_sync_test_3)
566+ add_fault_tolerant_mpi_test(image_fail_and_status_test_1 4 ${tests_root} /unit/fail_images/image_fail_and_status_test_1)
567+ add_fault_tolerant_mpi_test(image_fail_and_failed_images_test_1 4 ${tests_root} /unit/fail_images/image_fail_and_failed_images_test_1)
568+ add_fault_tolerant_mpi_test(image_fail_and_stopped_images_test_1 4 ${tests_root} /unit/fail_images/image_fail_and_stopped_images_test_1)
569+ add_fault_tolerant_mpi_test(image_fail_and_get_test_1 4 ${tests_root} /unit/fail_images/image_fail_and_get_test_1)
570+ endif ()
571+ endif ()
536572else ()
537573 add_test (co_sum_extension ${tests_root} /unit/extensions/test -co_sum-extension.sh)
538574 set_property (TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed." )
0 commit comments