]>
Commit | Line | Data |
---|---|---|
f1717362 | 1 | # Copyright (C) 2011-2016 Free Software Foundation, Inc. |
214946de | 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 <burnus@net-b.de> | |
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 | ||
32 | # If a testcase doesn't have special options, use these. | |
33 | global DEFAULT_FFLAGS | |
34 | if ![info exists DEFAULT_FFLAGS] then { | |
35 | set DEFAULT_FFLAGS " -pedantic-errors" | |
36 | } | |
37 | ||
38 | dg-init | |
39 | ||
40 | global runtests | |
41 | global DG_TORTURE_OPTIONS torture_with_loops | |
42 | ||
43 | torture-init | |
44 | set-torture-options $DG_TORTURE_OPTIONS | |
45 | ||
6c13ec42 | 46 | global gfortran_test_path |
47 | global gfortran_aux_module_flags | |
48 | set gfortran_test_path $srcdir/$subdir | |
49 | set gfortran_aux_module_flags $DEFAULT_FFLAGS | |
50 | proc dg-compile-aux-modules { args } { | |
51 | global gfortran_test_path | |
52 | global gfortran_aux_module_flags | |
53 | if { [llength $args] != 2 } { | |
54 | error "dg-set-target-env-var: needs one argument" | |
55 | return | |
56 | } | |
57 | dg-test $gfortran_test_path/[lindex $args 1] "" $gfortran_aux_module_flags | |
58 | # cleanup-modules isn't intentionally invoked here. | |
59 | } | |
60 | ||
dd26bf75 | 61 | # Add -latomic only where supported. Assume built-in support elsewhere. |
62 | set maybe_atomic_lib "" | |
63 | if [check_effective_target_libatomic_available] { | |
64 | set maybe_atomic_lib "-latomic" | |
65 | } | |
66 | ||
214946de | 67 | # Main loop. |
68 | foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] { | |
69 | # If we're only testing specific files and this isn't one of them, skip it. | |
70 | if ![runtest_file_p $runtests $test] then { | |
71 | continue | |
72 | } | |
73 | ||
74 | # Enable if you want to test several options: | |
75 | # # look if this is dg-do-run test, in which case | |
76 | # # we cycle through the option list, otherwise we don't | |
77 | # if [expr [search_for $test "dg-do run"]] { | |
78 | # set option_list $torture_with_loops | |
79 | # } else { | |
80 | # set option_list [list { -O } ] | |
81 | # } | |
82 | set option_list [list { -O2 } ] | |
83 | ||
84 | set nshort [file tail [file dirname $test]]/[file tail $test] | |
ce1d2364 | 85 | list-module-names $test |
214946de | 86 | |
87 | foreach flags $option_list { | |
88 | verbose "Testing $nshort (single), $flags" 1 | |
6c13ec42 | 89 | set gfortran_aux_module_flags "-fcoarray=single $flags" |
dd26bf75 | 90 | dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" "" |
ce1d2364 | 91 | cleanup-modules "" |
214946de | 92 | } |
93 | ||
94 | foreach flags $option_list { | |
95 | verbose "Testing $nshort (libcaf_single), $flags" 1 | |
6c13ec42 | 96 | set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single" |
dd26bf75 | 97 | dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" "" |
ce1d2364 | 98 | cleanup-modules "" |
214946de | 99 | } |
100 | } | |
101 | torture-finish | |
102 | dg-finish |