Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0f97dd

Browse files
cmake: enable error stop validation for tests
1 parent f5f4a4d commit c0f97dd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎CMakeLists.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ endif()
4545
# --- compiler feature checks
4646
include(CheckFortranSourceCompiles)
4747
include(CheckFortranSourceRuns)
48-
check_fortran_source_runs("i=0; error stop i; end" f18errorstop)
48+
check_fortran_source_runs("program test_error_stop
49+
integer, parameter :: i=0
50+
error stop i
51+
end program"
52+
f18errorstop)
4953
check_fortran_source_compiles("real, allocatable :: array(:, :, :, :, :, :, :, :, :, :); end" f03rank SRC_EXT f90)
5054
# check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
5155

‎src/tests/CMakeLists.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ add_subdirectory(system)
1919
add_subdirectory(quadrature)
2020
add_subdirectory(math)
2121

22+
# some compilers have broken error stop return code handling
23+
if(f18errorstop)
24+
set(DISABLE_ESTOP_TESTS false)
25+
else()
26+
set(DISABLE_ESTOP_TESTS true)
27+
endif()
28+
2229
add_executable(test_error_handling test_error_driver.f90)
2330

2431
add_executable(test_always_77 test_always_77.f90)
@@ -30,3 +37,8 @@ add_executable(test_always_1 test_always_fail.f90)
3037
target_link_libraries(test_always_1 PRIVATE ${PROJECT_NAME})
3138
add_test(NAME test_error_1
3239
COMMAND $<TARGET_FILE:test_error_handling> $<TARGET_FILE:test_always_1> 1)
40+
41+
set_tests_properties(test_error_77 test_error_1 PROPERTIES
42+
TIMEOUT 5
43+
DISABLED ${DISABLE_ESTOP_TESTS}
44+
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /