Skip to content

Commit 32668dc

Browse files
authored
Merge pull request #110 from BerkeleyLab/return-to-print
Fix ifx support
2 parents 999421e + 9cb56b2 commit 32668dc

File tree

5 files changed

+41
-55
lines changed

5 files changed

+41
-55
lines changed

src/julienne/julienne_test_harness_s.F90

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
submodule(julienne_test_harness_m) julienne_test_harness_s
77
use iso_fortran_env, only : int64, real64
88
use julienne_command_line_m, only : command_line_t
9-
use julienne_one_image_prints_m, only : one_image_prints
109
use julienne_string_m, only : string_t
1110
implicit none
1211

@@ -37,11 +36,14 @@
3736
#else
3837
associate(me => 1, image_count => 1)
3938
#endif
40-
call one_image_prints("")
41-
call one_image_prints("Test-suite execution time: " // string_t(real(end_time - start_time, real64)/real(clock_rate, real64)) // " seconds")
42-
call one_image_prints("Number of images: " // string_t(image_count))
43-
call one_image_prints("")
44-
call one_image_prints("_____ " // string_t(passes) // " of " // string_t(tests) // " tests passed. " // string_t(skips) // " tests were skipped _____")
39+
if (me==1) then
40+
print *
41+
print '(*(a,:,en10.2))', "Test-suite run time: ", real(end_time - start_time, real64)/real(clock_rate, real64), " seconds"
42+
print '(a,i0)', "Number of images: ", image_count
43+
print *
44+
print '(*(a,:,i0))', "_____ ", passes, " of ", tests, " tests passed. ", skips, " tests were skipped _____"
45+
print *
46+
end if
4547
if (passes + skips /= tests .and. me==1) error stop "Some tests failed."
4648
end associate
4749

@@ -57,16 +59,22 @@ subroutine print_usage_info_and_stop_if_requested
5759
'angular brackets (<>) denote a user-provided value, and passing a substring limits execution to' // new_line('') // &
5860
'the tests with test subjects or test descriptions containing the user-specified substring.' // new_line('')
5961

60-
associate(command_line => command_line_t())
62+
#if HAVE_MULTI_IMAGE_SUPPORT
63+
associate(me => this_image())
64+
#else
65+
associate(me => 1)
66+
#endif
67+
associate(command_line => command_line_t())
6168

62-
if (command_line%argument_present([character(len=len("--help"))::"--help","-h"])) then
63-
call one_image_prints(usage)
64-
stop
65-
end if
69+
if (command_line%argument_present([character(len=len("--help"))::"--help","-h"])) then
70+
if (me==1) print '(a)', usage
71+
stop
72+
end if
6673

67-
call one_image_prints(new_line("") // "Append '-- --help' or '-- -h' to your `fpm test` command to display usage information.")
74+
if (me==1) print '(a)', new_line("") // "Append '-- --help' or '-- -h' to your `fpm test` command to display usage information."
6875

76+
end associate
6977
end associate
7078
end subroutine
7179

72-
end submodule julienne_test_harness_s
80+
end submodule julienne_test_harness_s

src/julienne/julienne_test_s.F90

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
submodule(julienne_test_m) julienne_test_s
77
use julienne_test_description_m, only : test_description_t
8-
use julienne_one_image_prints_m, only : one_image_prints
98
use julienne_string_m, only : string_t
109
implicit none
1110

@@ -35,8 +34,7 @@
3534
#if HAVE_MULTI_IMAGE_SUPPORT
3635
associate(me => this_image())
3736
#else
38-
integer me
39-
me = 1
37+
associate(me => 1)
4038
#endif
4139
image_1_prints_usage_info: &
4240
if (me==1) then
@@ -49,25 +47,17 @@
4947
character(len=:), allocatable :: search_string
5048
search_string = command_line%flag_value("--contains")
5149
if (len(search_string)==0) then
52-
call one_image_prints( new_line('') // &
50+
if (me==1) print '(a)', new_line('') // &
5351
"Running all tests." // new_line('') // &
54-
"(Add '-- --contains <string>' to run only tests with subjects or descriptions containing the specified string.)")
52+
"(Add '-- --contains <string>' to run only tests with subjects or descriptions containing the specified string.)"
5553
else
56-
#ifndef NAGFOR
57-
call one_image_prints(new_line('') // "Running only tests with subjects or descriptions containing '" // search_string // "'.")
58-
#else
59-
call one_image_prints(new_line('') // "Running only tests with subjects or descriptions containing '" // string_t(search_string) // "'.")
60-
#endif
54+
if (me==1) print '(a)', new_line('') // "Running only tests with subjects or descriptions containing '" // search_string // "'."
6155
end if
6256
end block
6357
end if first_report
6458
end block
6559

66-
#ifndef NAGFOR
67-
call one_image_prints(new_line('') // test%subject())
68-
#else
69-
call one_image_prints(new_line('') // string_t(test%subject()))
70-
#endif
60+
if (me==1) print '(a)', new_line('') // test%subject()
7161

7262
end if image_1_prints_usage_info
7363

@@ -79,11 +69,7 @@
7969
block
8070
integer i
8171
do i=1,num_tests
82-
#ifndef NAGFOR
83-
call one_image_prints(" " // test_results(i)%characterize())
84-
#else
85-
call one_image_prints(" " // string_t(test_results(i)%characterize()))
86-
#endif
72+
if (me==1) print '(a)', " " // test_results(i)%characterize()
8773
end do
8874
end block
8975
end if
@@ -97,16 +83,13 @@
9783
call co_all(skipped_tests)
9884

9985
associate(num_passes => count(passing_tests), num_skipped => count(skipped_tests))
100-
call one_image_prints(" " // string_t(num_passes) // " of " // string_t(num_tests) // " tests passed. " // string_t(num_skipped) // " tests were skipped.")
86+
if (me==1) print '(*(a,:,i0))', " ", num_passes, " of ", num_tests, " tests passed. ", num_skipped, " tests were skipped."
10187
passes = passes + num_passes
10288
skips = skips + num_skipped
10389
end associate
10490
end block
10591
end associate
106-
#if HAVE_MULTI_IMAGE_SUPPORT
10792
end associate
108-
#endif
109-
11093
#else
11194
block
11295
logical, allocatable :: passing_tests(:)
@@ -118,13 +101,13 @@
118101
tests = tests + num_tests
119102
if (me==1) then
120103
do i=1,num_tests
121-
call one_image_prints(test_results(i)%characterize())
104+
print '(a)', test_results(i)%characterize()
122105
end do
123106
end if
124107
passing_tests = test_results%passed()
125108
call co_all(passing_tests)
126109
associate(num_passes => count(passing_tests))
127-
call one_image_prints(" " // string_t(num_passes) // " of " // string_t(num_tests) // " tests passed.")
110+
if (me==1) print '(a)', " " // string_t(num_passes) // " of " // string_t(num_tests) // " tests passed."
128111
passes = passes + num_passes
129112
end associate
130113
end associate

test/idiomatic_assertion_failure_test.F90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ program idiomatic_assertion_failure_test
1616
#endif
1717
if (.not. command_line%argument_present([character(len=len("--help"))::"--help","-h"])) then
1818
#ifdef RUN_FALSE_ASSERTIONS
19-
call one_image_prints(new_line('') // 'Test the intentional failure of an idiomatic assertion: ' // new_line(''))
19+
if (me==1) print '(a)', new_line('') // 'Test the intentional failure of an idiomatic assertion: ' // new_line('')
2020
call_julienne_assert(1 .equalsExpected. 2)
2121
#else
22-
call one_image_prints( &
22+
if (me==1) print '(a)', &
2323
new_line('') // &
2424
'Skipping the test in ' // __FILE__ // '.' // new_line('') // &
2525
'Add the following to your fpm command to test assertion failures: --flag "-DASSERTIONS -DRUN_FALSE_ASSERTIONS"' // &
26-
new_line('') &
27-
)
26+
new_line('')
2827
#endif
2928
end if
3029
end associate

test/logical_assertion_failure_test.F90

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

77
program logical_assertion_failure_test
88
!! Conditionally test an assertion that is hardwired to fail.
9-
use julienne_m, only : call_julienne_assert_, command_line_t, operator(.equalsExpected.),one_image_prints
9+
use julienne_m, only : call_julienne_assert_, command_line_t, operator(.equalsExpected.)
1010
implicit none
1111
integer, allocatable :: array(:)
1212

@@ -17,16 +17,15 @@ program logical_assertion_failure_test
1717
#endif
1818
if (.not. command_line%argument_present([character(len=len("--help"))::"--help","-h"])) then
1919
#ifdef RUN_FALSE_ASSERTIONS
20-
call one_image_prints(new_line('') // 'Test the intentional failure of a logical assertion: ' // new_line(''))
20+
if (me==1) print '(a)', new_line('') // 'Test the intentional failure of a logical assertion: ' // new_line('')
2121
if (allocated(array)) deallocate(array)
2222
call_julienne_assert(allocated(array))
2323
#else
24-
call one_image_prints( &
24+
if (me==1) print '(a)', &
2525
new_line('') // &
2626
'Skipping the test in ' // __FILE__ // '.' // new_line('') // &
2727
'Add the following to your fpm command to test assertion failures: --flag "-DASSERTIONS -DRUN_FALSE_ASSERTIONS"' // &
28-
new_line('') &
29-
)
28+
new_line('')
3029
#endif
3130
end if
3231
end associate

test/modules/command_line_test_m.F90

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module command_line_test_m
88
use julienne_m, only : &
99
command_line_t &
1010
,GitHub_CI &
11-
,one_image_prints &
1211
,operator(.equalsExpected.) &
1312
,operator(.expect.) &
1413
,string_t &
@@ -77,12 +76,11 @@ function results() result(test_results)
7776
,test_description_t(string_t("argument_present() result is .true. if a command-line argument is present")) &
7877
]
7978
if (me==1) then
80-
call one_image_prints( &
79+
print '(a)', &
8180
new_line('') &
8281
// "----> Skipping the command_line_t tests in GitHub CI." // new_line('') &
8382
// "----> To test locally, append the following flags to the 'fpm test' command: -- --test command_line_t --type" &
84-
// new_line('') &
85-
)
83+
// new_line('')
8684
end if
8785
else if (.not. command_line%argument_present(["--test"])) then ! skip the tests if not explicitly requested
8886
test_descriptions = [ &
@@ -93,11 +91,10 @@ function results() result(test_results)
9391
,test_description_t(string_t("argument_present() result is .true. if a command-line argument is present")) &
9492
]
9593
if (me==1) then
96-
call one_image_prints( &
94+
print '(a)', &
9795
new_line('') &
9896
// "-----> To test command_line_t, append the following to the 'fpm test' command: -- --test command_line_t --type" &
99-
// new_line('') &
100-
)
97+
// new_line('')
10198
end if
10299
else ! run the tests
103100
#if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY

0 commit comments

Comments
 (0)