Skip to content

Commit bd9fa9a

Browse files
authored
Merge pull request #150 from bonachea/co_char_1
Co-characterize failure propagation across images
2 parents 0f3d987 + 9feeb7b commit bd9fa9a

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/julienne/julienne_test_harness_s.F90

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "language-support.F90"
55

66
submodule(julienne_test_harness_m) julienne_test_harness_s
7-
use iso_fortran_env, only : int64, real64, output_unit
7+
use iso_fortran_env, only : int64, real64
88
use julienne_command_line_m, only : command_line_t
99
use julienne_string_m, only : string_t
1010
implicit none
@@ -47,12 +47,8 @@
4747
print *
4848
print '(*(a,:,i0))', "_____ ", passes, " of ", tests, " tests passed. ", skips, " tests were skipped _____"
4949
print *
50-
flush(output_unit)
5150
end if
52-
#if HAVE_MULTI_IMAGE_SUPPORT
53-
sync all
54-
#endif
55-
if (passes + skips /= tests) error stop "Some tests failed."
51+
if (passes + skips /= tests .and. me==1) error stop "Some tests failed."
5652
end associate
5753

5854
end procedure

src/julienne/julienne_test_result_m.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ elemental module function construct_from_character(description, diagnosis) resul
5252
module subroutine co_characterize(self)
5353
!! Print a description of the test, its outcome, and diagnostic information if the test fails
5454
implicit none
55-
class(test_result_t), intent(in) :: self
55+
class(test_result_t), intent(inout) :: self
5656
end subroutine
5757

5858
impure elemental module function passed(self) result(test_passed)

src/julienne/julienne_test_result_s.F90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747
if (i_skipped) then
4848
if (me==1) print '(a)', indent // "SKIPS on " // trim(self%description_%string()) // "."
4949
else
50-
if (me==1) print '(a)', indent // merge("passes on ", "FAILS on ", images_passed == images) // trim(self%description_%string()) // "."
50+
if (images_passed < images .and. i_passed) then
51+
! a failure on any image becomes a failure on all images
52+
self%diagnosis_ = test_diagnosis_t(test_passed=.false., diagnostics_string="peer image failure")
53+
end if
54+
if (me==1) print '(a)', indent // merge("passes on ", "FAILS on ", self%diagnosis_%test_passed()) // trim(self%description_%string()) // "."
5155
#if ! ASYNCHRONOUS_DIAGNOSTICS
5256
sync all ! ensure image 1 prints test outcome before any failure diagnostics print
5357
#endif

src/julienne/julienne_test_s.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
integer t
3333
logical, allocatable :: passing_tests(:), skipped_tests(:)
34+
type(test_result_t), allocatable :: test_results(:)
3435

3536
#if HAVE_MULTI_IMAGE_SUPPORT
3637
associate(me => this_image())
@@ -39,16 +40,16 @@
3940
#endif
4041
if (me==1) print '(a)', new_line('') // test%subject()
4142

42-
associate(test_results => test%results())
43+
test_results = test%results()
4344

44-
passing_tests = test_results%passed()
45-
skipped_tests = test_results%skipped()
45+
skipped_tests = test_results%skipped()
4646

47-
associate(num_tests => size(test_results))
47+
associate(num_tests => size(test_results))
4848

4949
do t = 1, num_tests
5050
call test_results(t)%co_characterize()
5151
end do
52+
passing_tests = test_results%passed() ! may be altered by co_characterize
5253

5354
tests = tests + num_tests
5455

@@ -57,7 +58,6 @@
5758
passes = passes + num_passes
5859
skips = skips + num_skipped
5960
end associate
60-
end associate
6161
end associate
6262
end associate
6363
end procedure

0 commit comments

Comments
 (0)