Skip to content

Commit c6bc982

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
1 parent a247128 commit c6bc982

26 files changed

+1581
-1018
lines changed

hello.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
implicit none
2+
print *,"hello from image", this_image(), " of ", num_images()
3+
end

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,9 +21,9 @@
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

include/macro.F90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "language-support.F90"
2+
implicit none
3+
4+
#if (GCC_VERSION > 140200)
5+
print *,"(GCC_VERSION > 140200)"
6+
#else
7+
print *,"! (GCC_VERSION > 140200)"
8+
#endif
9+
10+
end

manifest/fpm.toml.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ copyright = "2021-2025 The Regents of the University of California, through Lawr
99
assert = {git = "https://github.com/berkeleylab/assert.git", tag = "3.0.0"}
1010
veggies = {git = "https://gitlab.com/everythingfunctional/veggies", tag = "v1.1.3"}
1111
iso_varying_string = {git = "https://gitlab.com/everythingfunctional/iso_varying_string.git", tag = "v3.0.4"}
12+
julienne = {git = "https://github.com/berkeleylab/julienne.git", tag = "3.0.0"}
1213

1314
[build]

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_this_image_no_coarray_test_m, only : prif_this_image_no_coarray_test_t
16+
use prif_sync_images_test_m, only : prif_sync_images_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_this_image_no_coarray_test_t() ) &
30+
,test_fixture_t( prif_sync_images_test_t() ) &
31+
]))
32+
call test_harness%report_results
33+
end associate
34+
end program test_suite_driver
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#include "language-support.F90"
2+
3+
module prif_co_broadcast_test_m
4+
use prif, only : prif_co_broadcast, prif_num_images, prif_this_image_no_coarray
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
16+
17+
implicit none
18+
private
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
26+
27+
type object_t
28+
integer i
29+
logical fallacy
30+
character(len=len("fooey")) actor
31+
complex issues
32+
end type
33+
34+
interface operator(==)
35+
module procedure equals
36+
end interface
37+
38+
contains
39+
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) &
54+
])
55+
end function
56+
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+
74+
logical pure function equals(lhs, rhs)
75+
type(object_t), intent(in) :: lhs, rhs
76+
equals = all([ &
77+
lhs%i == rhs%i &
78+
,lhs%fallacy .eqv. rhs%fallacy &
79+
,lhs%actor == rhs%actor &
80+
,lhs%issues == rhs%issues &
81+
])
82+
end function
83+
84+
function broadcast_default_integer_scalar() result(test_diagnosis)
85+
type(test_diagnosis_t) test_diagnosis
86+
integer iPhone, me
87+
integer, parameter :: source_value = 7779311, junk = -99
88+
89+
call prif_this_image_no_coarray(this_image=me)
90+
iPhone = merge(source_value, junk, me==1)
91+
call prif_co_broadcast(iPhone, source_image=1)
92+
test_diagnosis = iPhone .equalsExpected. source_value
93+
end function
94+
95+
function broadcast_derived_type() result(test_diagnosis)
96+
type(test_diagnosis_t) test_diagnosis
97+
type(object_t) object
98+
integer me, ni
99+
100+
call prif_this_image_no_coarray(this_image=me)
101+
call prif_num_images(num_images=ni)
102+
object = object_t(me, .false., "gooey", me*(1.,0.))
103+
call prif_co_broadcast(object, source_image=ni)
104+
associate(expected_object => object_t(ni, .false., "gooey", ni*(1.,0.)))
105+
test_diagnosis = .expect. (object == expected_object) // "co_broadcast derived type"
106+
end associate
107+
end function
108+
109+
end module prif_co_broadcast_test_m

0 commit comments

Comments
 (0)