Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gfortran.dg / coarray / caf.exp
1 # Copyright (C) 2011-2013 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 <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
46 # Main loop.
47 foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] {
48     # If we're only testing specific files and this isn't one of them, skip it.
49     if ![runtest_file_p $runtests $test] then {
50         continue
51     }
52
53 # Enable if you want to test several options:
54 #    # look if this is dg-do-run test, in which case
55 #    # we cycle through the option list, otherwise we don't
56 #    if [expr [search_for $test "dg-do run"]] {
57 #       set option_list $torture_with_loops
58 #    } else {
59 #       set option_list [list { -O } ]
60 #    }
61     set option_list [list { -O2 } ]
62
63     set nshort [file tail [file dirname $test]]/[file tail $test]
64     list-module-names $test
65
66     foreach flags $option_list {
67         verbose "Testing $nshort (single), $flags" 1
68         dg-test $test "-fcoarray=single $flags" "" 
69         cleanup-modules ""
70     }
71
72     foreach flags $option_list {
73         verbose "Testing $nshort (libcaf_single), $flags" 1
74         dg-test $test "-fcoarray=lib $flags -lcaf_single" ""
75         cleanup-modules ""
76     }
77 }
78 torture-finish
79 dg-finish