Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/caf.exp

raw
1 # Copyright (C) 2011-2025 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
16 #
17 # Contributed by Tobias Burnus <[email protected]>
18
19
20 # Test coarray support.
21 #
22 # For the compilation tests, all files are compiles with the
23 # option -fcoarray=single and with -fcoarray=lib
24 #
25 # For the link and execution tests, for -fcoarray=lib the
26 # libcaf_single library is linked. Additionally, with the
27 # required settings another CAF library is used.
28
29 # Load procedures from common libraries.
30 load_lib gfortran-dg.exp
31 load_lib atomic-dg.exp
32
33 # If a testcase doesn't have special options, use these.
34 global DEFAULT_FFLAGS
35 if ![info exists DEFAULT_FFLAGS] then {
36 set DEFAULT_FFLAGS " -pedantic-errors"
37 }
38
39 dg-init
40
41 global runtests
42 global DG_TORTURE_OPTIONS torture_with_loops
43
44 torture-init
45 set-torture-options $DG_TORTURE_OPTIONS
46
47 global gfortran_test_path
48 global gfortran_aux_module_flags
49 set gfortran_test_path $srcdir/$subdir
50 set gfortran_aux_module_flags $DEFAULT_FFLAGS
51
52 proc dg-compile-aux-modules { args } {
53 global gfortran_test_path
54 global gfortran_aux_module_flags
55 if { [llength $args] != 2 } {
56 error "dg-compile-aux-modules: needs one argument"
57 return
58 }
59
60 set level [info level]
61 if { [info procs dg-save-unknown] != [list] } {
62 rename dg-save-unknown dg-save-unknown-level-$level
63 }
64
65 dg-test $gfortran_test_path/[lindex $args 1] "" $gfortran_aux_module_flags
66 # cleanup-modules is intentionally not invoked here.
67
68 if { [info procs dg-save-unknown-level-$level] != [list] } {
69 rename dg-save-unknown-level-$level dg-save-unknown
70 }
71 }
72
73 # Main loop.
74 foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] {
75 # If we're only testing specific files and this isn't one of them, skip it.
76 if ![runtest_file_p $runtests $test] then {
77 continue
78 }
79
80 # Enable if you want to test several options:
81 # # look if this is dg-do run test, in which case
82 # # we cycle through the option list, otherwise we don't
83 # if [expr [search_for $test "dg-do run"]] {
84 # set option_list $torture_with_loops
85 # } else {
86 # set option_list [list { -O } ]
87 # }
88 set option_list [list { -O2 } ]
89
90 set nshort [file tail [file dirname $test]]/[file tail $test]
91 list-module-names $test
92
93 foreach flags $option_list {
94 verbose "Testing $nshort (single), $flags" 1
95 set gfortran_aux_module_flags "-fcoarray=single $flags"
96 dg-test $test "-fcoarray=single $flags" {}
97 cleanup-modules ""
98 }
99
100 foreach flags $option_list {
101 verbose "Testing $nshort (libcaf_single), $flags" 1
102 set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
103 dg-test $test "-fcoarray=lib $flags -lcaf_single" {}
104 cleanup-modules ""
105 }
106 }
107 torture-finish
108 dg-finish