| 1 |
# Copyright (C) 2004-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 |
# GCC testsuite that uses the `dg.exp' driver. |
| 18 |
|
| 19 |
# Exit immediately if this isn't a PowerPC target. |
| 20 |
if { ![istarget powerpc*-*-*] && ![istarget rs6000-*-*] } then { |
| 21 |
return |
| 22 |
} |
| 23 |
|
| 24 |
# Make sure there is a fortran compiler to test. |
| 25 |
if { ![check_no_compiler_messages fortran_available assembly { |
| 26 |
! Fortran |
| 27 |
program P |
| 28 |
stop |
| 29 |
end program P |
| 30 |
} ""] } { |
| 31 |
return |
| 32 |
} |
| 33 |
|
| 34 |
# Load support procs. |
| 35 |
load_lib gfortran-dg.exp |
| 36 |
|
| 37 |
# If a testcase doesn't have special options, use these. |
| 38 |
global DEFAULT_FFLAGS |
| 39 |
if ![info exists DEFAULT_FFLAGS] then { |
| 40 |
set DEFAULT_FFLAGS " -pedantic-errors" |
| 41 |
} |
| 42 |
|
| 43 |
# Initialize `dg'. |
| 44 |
dg-init |
| 45 |
|
| 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-compile-aux-modules: needs one argument" |
| 55 |
return |
| 56 |
} |
| 57 |
|
| 58 |
set level [info level] |
| 59 |
if { [info procs dg-save-unknown] != [list] } { |
| 60 |
rename dg-save-unknown dg-save-unknown-level-$level |
| 61 |
} |
| 62 |
|
| 63 |
dg-test $gfortran_test_path/[lindex $args 1] "" $gfortran_aux_module_flags |
| 64 |
# cleanup-modules is intentionally not invoked here. |
| 65 |
|
| 66 |
if { [info procs dg-save-unknown-level-$level] != [list] } { |
| 67 |
rename dg-save-unknown-level-$level dg-save-unknown |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
# Override gcc_{warning,error}_prefix with Fortran specific prefixes used |
| 72 |
# in gfortran_init to support dg-{warning,error} checks. |
| 73 |
set gcc_warning_prefix "\[Ww\]arning:" |
| 74 |
set gcc_error_prefix "(Fatal )?\[Ee\]rror:" |
| 75 |
|
| 76 |
# Main loop. |
| 77 |
gfortran-dg-runtest [lsort \ |
| 78 |
[glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS |
| 79 |
|
| 80 |
gfortran-dg-runtest [lsort \ |
| 81 |
[glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS |
| 82 |
|
| 83 |
|
| 84 |
# All done. |
| 85 |
dg-finish |