Skip to content

Commit fdc5acd

Browse files
rousonbonachea
authored andcommitted
test(julienne): add driver & tests
This commit adds a test-suite driver, test/julienne/driver.f90, with supporting tests for the following subroutines: - prif_co_broadcast - prif_co_min - prif_co_max - prif_image_queries - prif_init - prif_num_images - prif_this_image_no_coarray - prif_sync_images All new tests are in test/julienne. All tests pass. TODO: restrict output to image 1 chore: rm redundant tests This commit removes veggies tests for the following subroutines because they are now redundant with the correspondiong julienne tests added in a prior commit: - prif_co_broadcast - prif_co_max - prif_co_min - prif_image_queries - prif_num_images - prif_sync_images - prif_this_image This commit retains the redundant prif_init test becuase it is presumalby needed for the proper launch of the veggies tests. build(fpm.toml.template): add Julienne 3.0.0 dep test(co_sum): add julienne test, rm veggies test test(co_reduce): add julienne test|rm veggies test chore: non_overridable test_t child type-bnd-procs fix(image_queries_test): add closing parens test: add prif_coarray_inquiry_test_m fix: rm binary chore: rm veggies prif_coarray_inquiry_test fix(test/julienne): support GCC 13 - 14.2 chore: rm reference to deleted veggies test chore: rm partially complete julienne test build(include): fix macro logic/syntax test(julienne): append to diagnostics strings This commit appends the text from veggies assertions "message" argument to test diagnoses in the corresponding Julienne tests. For example, a veggies assertion of the form assert_equals(actual, expected, message) becomes a Julienne test diagnosis of the following form: (actual .equalsExpected. expected) // message Remove inadvertently added GASNet install trees Remove some stray programs Rename file to match Caffiene source file naming conventions (See docs/README-maintainers.md) test(julienne): fix GCC 13-14.2 workaround Rename test files back to their original location, for ease of PR review and maintenance There are zero code changes in this commit
1 parent cf94e84 commit fdc5acd

14 files changed

+1229
-680
lines changed

include/language-support.F90

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
33

4+
#ifdef __GNUC__
5+
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
6+
#else
7+
# define GCC_VERSION 0
8+
#endif
9+
410
#ifndef HAVE_SELECTED_LOGICAL_KIND
511
! Define whether the compiler supports standard intrinsic function selected_logical_kind(),
612
! a feature introduced in Fortran 2023 clause 16.9.182.
@@ -15,10 +21,10 @@
1521
! Define whether the compiler supports associating a procedure pointer dummy argument with an
1622
! actual argument that is a valid target for the pointer dummy in a procedure assignment, a
1723
! feature introduced in Fortran 2008 and described in Fortran 2023 clause 15.5.2.10 paragraph 5.
18-
#if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__flang__)
19-
#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1
24+
#if defined _CRAYFTN || defined __INTEL_COMPILER || defined NAGFOR || defined __flang__ || (GCC_VERSION > 140200)
25+
# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1
2026
#else
21-
#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0
27+
# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0
2228
#endif
2329
#endif
2430

test/julienne-driver.F90

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
2+
! Terms of use are as specified in LICENSE.txt
3+
4+
program test_suite_driver
5+
use julienne_m, only : test_fixture_t, test_harness_t
6+
use prif_init_test_m, only : prif_init_test_t
7+
use prif_coarray_inquiry_test_m, only : prif_coarray_inquiry_test_t
8+
use prif_co_broadcast_test_m, only : prif_co_broadcast_test_t
9+
use prif_co_max_test_m, only : prif_co_max_test_t
10+
use prif_co_min_test_m, only : prif_co_min_test_t
11+
use prif_co_reduce_test_m, only :prif_co_reduce_test_t
12+
use prif_co_sum_test_m, only : prif_co_sum_test_t
13+
use prif_image_queries_test_m, only : prif_image_queries_test_t
14+
use prif_num_images_test_m, only : prif_num_images_test_t
15+
use prif_sync_images_test_m, only : prif_sync_images_test_t
16+
use prif_this_image_no_coarray_test_m, only : prif_this_image_no_coarray_test_t
17+
implicit none
18+
19+
associate(test_harness => test_harness_t([ &
20+
test_fixture_t( prif_init_test_t() ) &
21+
,test_fixture_t( prif_coarray_inquiry_test_t() ) &
22+
,test_fixture_t( prif_co_broadcast_test_t() ) &
23+
,test_fixture_t( prif_co_max_test_t() ) &
24+
,test_fixture_t( prif_co_min_test_t() ) &
25+
,test_fixture_t( prif_co_reduce_test_t() ) &
26+
,test_fixture_t( prif_co_sum_test_t() ) &
27+
,test_fixture_t( prif_image_queries_test_t() ) &
28+
,test_fixture_t( prif_num_images_test_t() ) &
29+
,test_fixture_t( prif_sync_images_test_t() ) &
30+
,test_fixture_t( prif_this_image_no_coarray_test_t() ) &
31+
]))
32+
call test_harness%report_results
33+
end associate
34+
end program test_suite_driver

test/main.F90

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,9 @@ function run() result(passed)
2323
use caf_allocate_test, only: &
2424
caf_allocate_prif_allocate => &
2525
test_prif_allocate
26-
use caf_co_broadcast_test, only: &
27-
caf_co_broadcast_prif_co_broadcast => &
28-
test_prif_co_broadcast
29-
use caf_co_max_test, only: &
30-
caf_co_max_prif_co_max => &
31-
test_prif_co_max
32-
use caf_co_min_test, only: &
33-
caf_co_min_prif_co_min => &
34-
test_prif_co_min
35-
use caf_co_reduce_test, only: &
36-
caf_co_reduce_prif_co_reduce => &
37-
test_prif_co_reduce
38-
use caf_co_sum_test, only: &
39-
caf_co_sum_prif_co_sum => &
40-
test_prif_co_sum
41-
use caf_coarray_inquiry_test, only: &
42-
caf_coarray_inquiry_coarray_inquiry => &
43-
test_coarray_inquiry
4426
use caf_image_index_test, only: &
4527
caf_image_index_prif_image_index => &
4628
test_prif_image_index
47-
use caf_num_images_test, only: &
48-
caf_num_images_prif_num_images => &
49-
test_prif_num_images
50-
use caf_image_queries_test, only: test_prif_image_queries
51-
use caf_sync_images_test, only: test_prif_sync_images
5229
use caf_rma_test, only: &
5330
caf_rma_prif_rma => &
5431
test_prif_rma
@@ -61,9 +38,6 @@ function run() result(passed)
6138
use caf_teams_test, only: &
6239
caf_teams_caf_teams => &
6340
test_caf_teams
64-
use caf_this_image_test, only: &
65-
caf_this_image_prif_this_image_no_coarray => &
66-
test_prif_this_image_no_coarray
6741
use caf_stop_test, only: test_prif_stop
6842
use caf_error_stop_test, only: test_prif_error_stop
6943
use veggies, only: test_item_t, test_that, run_tests, result_t
@@ -100,22 +74,12 @@ function run() result(passed)
10074
#endif
10175
individual_tests = [a00_caffeinate_caffeinate()]
10276
individual_tests = [individual_tests, caf_allocate_prif_allocate()]
103-
individual_tests = [individual_tests, caf_coarray_inquiry_coarray_inquiry()]
104-
individual_tests = [individual_tests, caf_co_broadcast_prif_co_broadcast()]
105-
individual_tests = [individual_tests, caf_co_max_prif_co_max()]
106-
individual_tests = [individual_tests, caf_co_min_prif_co_min()]
107-
individual_tests = [individual_tests, caf_co_reduce_prif_co_reduce()]
108-
individual_tests = [individual_tests, caf_co_sum_prif_co_sum()]
10977
individual_tests = [individual_tests, caf_image_index_prif_image_index()]
110-
individual_tests = [individual_tests, caf_num_images_prif_num_images()]
111-
individual_tests = [individual_tests, test_prif_image_queries()]
11278
individual_tests = [individual_tests, caf_rma_prif_rma()]
11379
individual_tests = [individual_tests, test_prif_rma_strided()]
11480
individual_tests = [individual_tests, caf_teams_caf_teams()]
115-
individual_tests = [individual_tests, caf_this_image_prif_this_image_no_coarray()]
11681
individual_tests = [individual_tests, test_prif_atomic()]
11782
individual_tests = [individual_tests, test_prif_event()]
118-
individual_tests = [individual_tests, test_prif_sync_images()]
11983
individual_tests = [individual_tests, test_prif_stop()]
12084
individual_tests = [individual_tests, test_prif_error_stop()]
12185

test/prif_co_broadcast_test.F90

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
module caf_co_broadcast_test
1+
#include "language-support.F90"
2+
3+
module prif_co_broadcast_test_m
24
use prif, only : prif_co_broadcast, prif_num_images, prif_this_image_no_coarray
3-
use veggies, only : result_t, test_item_t, describe, it, assert_equals, assert_that
5+
use julienne_m, only : &
6+
test_description_t &
7+
,test_diagnosis_t &
8+
,test_result_t &
9+
,test_t &
10+
,operator(//) &
11+
,operator(.expect.) &
12+
,operator(.equalsExpected.)
13+
#if ! HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY
14+
use julienne_m, only : diagnosis_function_i
15+
#endif
416

517
implicit none
618
private
7-
public :: test_prif_co_broadcast
19+
public :: prif_co_broadcast_test_t
20+
21+
type, extends(test_t) :: prif_co_broadcast_test_t
22+
contains
23+
procedure, nopass, non_overridable :: subject
24+
procedure, nopass, non_overridable :: results
25+
end type
826

927
type object_t
1028
integer i
@@ -19,16 +37,40 @@ module caf_co_broadcast_test
1937

2038
contains
2139

22-
function test_prif_co_broadcast() result(tests)
23-
type(test_item_t) tests
24-
25-
tests = describe( &
26-
"The prif_co_broadcast subroutine", &
27-
[ it("broadcasts a default integer scalar with no optional arguments present", broadcast_default_integer_scalar) &
28-
,it("broadcasts a derived type scalar with no allocatable components", broadcast_derived_type) &
40+
pure function subject() result(test_subject)
41+
character(len=:), allocatable :: test_subject
42+
test_subject = "The prif_co_broadcast subroutine"
43+
end function
44+
45+
#if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY
46+
47+
function results() result(test_results)
48+
type(test_result_t), allocatable :: test_results(:)
49+
type(prif_co_broadcast_test_t) prif_co_broadcast_test
50+
51+
test_results = prif_co_broadcast_test%run([ &
52+
test_description_t("broadcasting a default integer scalar with no optional arguments present", broadcast_default_integer_scalar) &
53+
,test_description_t("broadcasting a derived type scalar with no allocatable components", broadcast_derived_type) &
2954
])
3055
end function
3156

57+
#else
58+
59+
function results() result(test_results)
60+
type(test_result_t), allocatable :: test_results(:)
61+
type(prif_co_broadcast_test_t) prif_co_broadcast_test
62+
procedure(diagnosis_function_i), pointer :: &
63+
broadcast_default_integer_scalar_ptr => broadcast_default_integer_scalar &
64+
,broadcast_derived_type_ptr => broadcast_derived_type
65+
66+
test_results = prif_co_broadcast_test%run([ &
67+
test_description_t("broadcasting a default integer scalar with no optional arguments present", broadcast_default_integer_scalar_ptr) &
68+
,test_description_t("broadcasting a derived type scalar with no allocatable components", broadcast_derived_type_ptr) &
69+
])
70+
end function
71+
72+
#endif
73+
3274
logical pure function equals(lhs, rhs)
3375
type(object_t), intent(in) :: lhs, rhs
3476
equals = all([ &
@@ -39,30 +81,29 @@ logical pure function equals(lhs, rhs)
3981
])
4082
end function
4183

42-
function broadcast_default_integer_scalar() result(result_)
43-
type(result_t) result_
84+
function broadcast_default_integer_scalar() result(test_diagnosis)
85+
type(test_diagnosis_t) test_diagnosis
4486
integer iPhone, me
4587
integer, parameter :: source_value = 7779311, junk = -99
4688

4789
call prif_this_image_no_coarray(this_image=me)
4890
iPhone = merge(source_value, junk, me==1)
4991
call prif_co_broadcast(iPhone, source_image=1)
50-
result_ = assert_equals(source_value, iPhone)
92+
test_diagnosis = iPhone .equalsExpected. source_value
5193
end function
5294

53-
function broadcast_derived_type() result(result_)
54-
type(result_t) result_
95+
function broadcast_derived_type() result(test_diagnosis)
96+
type(test_diagnosis_t) test_diagnosis
5597
type(object_t) object
56-
integer :: me, ni
98+
integer me, ni
5799

58100
call prif_this_image_no_coarray(this_image=me)
59101
call prif_num_images(num_images=ni)
60102
object = object_t(me, .false., "gooey", me*(1.,0.))
61103
call prif_co_broadcast(object, source_image=ni)
62104
associate(expected_object => object_t(ni, .false., "gooey", ni*(1.,0.)))
63-
result_ = assert_that(expected_object == object, "co_broadcast derived type")
105+
test_diagnosis = .expect. (object == expected_object) // "co_broadcast derived type"
64106
end associate
65-
66107
end function
67108

68-
end module caf_co_broadcast_test
109+
end module prif_co_broadcast_test_m

0 commit comments

Comments
 (0)