1 # Copyright
(C
) 1997, 2011 Free Software Foundation
, Inc.
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.
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.
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
/>.
19 set dg
-linenum-format
":%d:\[-0-9\]+:"
21 if ![info exists DG_UPC_TORTURE_OPTIONS
] {
22 set DG_UPC_TORTURE_OPTIONS
[list \
23 { -O0
-g
-dwarf
-2-upc
-fupc
-threads
-4} \
24 { -O0
-g
-dwarf
-2-upc
-fupc
-threads
-0} \
25 { -O3
-fupc
-threads
-4} \
26 { -O3
-fupc
-threads
-0} ]
29 if [info exists ADDITIONAL_UPC_TORTURE_OPTIONS
] {
30 set DG_UPC_TORTURE_OPTIONS \
31 [concat $DG_UPC_TORTURE_OPTIONS $ADDITIONAL_UPC_TORTURE_OPTIONS
]
34 proc upc
-dg
-test
{ prog do_what extra_tool_flags
} {
35 verbose
"upc-dg-test: $prog, $do_what, $extra_tool_flags" 1
36 return [gcc
-dg
-test
-1 upc_target_compile $prog $do_what $extra_tool_flags
]
39 proc upc
-dg
-prune
{ system text } {
40 return [gcc
-dg
-prune $
system $
text]
43 # Modified dg
-runtest that can cycle through a list of optimization options
44 proc upc
-dg
-runtest
{ testcases default
-extra
-flags
} {
46 global upc_run_arguments
49 # Some callers
set torture options themselves
; don
't override those.
50 set existing_torture_options [torture-options-exist]
51 if { $existing_torture_options == 0 } {
52 global DG_UPC_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
54 # TODO - disable LTO while UPC fails
55 # set-torture-options $DG_UPC_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
56 set-torture-options $DG_UPC_TORTURE_OPTIONS
59 foreach test $testcases {
60 global torture_with_loops torture_without_loops
61 # If we're only testing specific files and this isn
't one of
63 if ![runtest_file_p $runtests $test] {
67 # Look for a loop within the source code - if we don't find one
,
68 # don
't pass -funroll[-all]-loops.
69 if [expr [search_for $test "for*("]+[search_for $test "while*("]] {
70 set option_list $torture_with_loops
72 set option_list $torture_without_loops
75 set nshort [file tail [file dirname $test]]/[file tail $test]
77 foreach flags $option_list {
78 # combine flags so that dg-skip & xfail will see the extras.
79 set combined_flags "$flags ${default-extra-flags}"
80 verbose "$tool UPC Testing $nshort, $combined_flags" 1
81 verbose "UPC Testing $nshort, $combined_flags" 1
82 if { [string first "-fupc-threads-0" $combined_flags] >= 0 } {
83 set upc_run_arguments " -n4"
85 set upc_run_arguments ""
87 verbose "UPC Testing $nshort, $combined_flags, $upc_run_arguments" 1
88 dg-test $test $combined_flags ""
92 if { $existing_torture_options == 0 } {
97 # upc_load -- wrapper around default upc_load to pass an extra
98 # argument for dynamic UPC tests
100 if { [info procs upc_load] != [list] \
101 && [info procs prev_upc_load] == [list] } {
102 rename upc_load prev_upc_load
104 proc upc_load { program args } {
105 global upc_run_arguments
107 if { [llength $args] > 0 } {
108 set pargs [lindex $args 0]
112 set pargs ${pargs}${upc_run_arguments}
114 set result [eval [list prev_upc_load $program] $pargs]