| 1 |
# This harness is for tests that should be run at all optimisation levels. |
| 2 |
|
| 3 |
load_lib gcc-dg.exp |
| 4 |
load_lib gcc-gdb-test.exp |
| 5 |
|
| 6 |
# Disable on darwin until radr://7264615 is resolved. |
| 7 |
if { [istarget *-*-darwin*] } { |
| 8 |
return |
| 9 |
} |
| 10 |
|
| 11 |
if { [istarget hppa*-*-hpux*] } { |
| 12 |
return |
| 13 |
} |
| 14 |
|
| 15 |
if { [istarget "powerpc-ibm-aix*"] } { |
| 16 |
set torture_execute_xfail "powerpc-ibm-aix*" |
| 17 |
return |
| 18 |
} |
| 19 |
|
| 20 |
proc check_guality {args} { |
| 21 |
# Don't count check_guality as PASS, or FAIL etc., that would make |
| 22 |
# the total PASS count dependent on how many parallel runtest invocations |
| 23 |
# ran guality.exp. So save the counts first and restore them afterwards. |
| 24 |
global test_counts |
| 25 |
array set saved_test_counts [array get test_counts] |
| 26 |
set result [eval check_compile guality_check executable $args "-g -O0"] |
| 27 |
set lines [lindex $result 0] |
| 28 |
set output [lindex $result 1] |
| 29 |
set ret 0 |
| 30 |
if {[string match "" $lines]} { |
| 31 |
set execout [gcc_load "./$output"] |
| 32 |
set ret [string match "*1 PASS, 0 FAIL, 0 UNRESOLVED*" $execout] |
| 33 |
} |
| 34 |
remote_file build delete $output |
| 35 |
array set test_counts [array get saved_test_counts] |
| 36 |
return $ret |
| 37 |
} |
| 38 |
|
| 39 |
dg-init |
| 40 |
torture-init |
| 41 |
|
| 42 |
global GDB |
| 43 |
if ![info exists ::env(GUALITY_GDB_NAME)] { |
| 44 |
if [info exists GDB] { |
| 45 |
set guality_gdb_name "$GDB" |
| 46 |
} elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } { |
| 47 |
# If we're doing a combined build, and gdb is available, use it. |
| 48 |
set guality_gdb_name "$rootme/../gdb/gdb" |
| 49 |
} else { |
| 50 |
set guality_gdb_name "[transform gdb]" |
| 51 |
} |
| 52 |
setenv GUALITY_GDB_NAME "$guality_gdb_name" |
| 53 |
} |
| 54 |
|
| 55 |
if [info exists ::env(DEBUGINFOD_URLS)] { |
| 56 |
set orig_debuginfod_urls "$::env(DEBUGINFOD_URLS)" |
| 57 |
setenv DEBUGINFOD_URLS "" |
| 58 |
} |
| 59 |
|
| 60 |
report_gdb $::env(GUALITY_GDB_NAME) [info script] |
| 61 |
|
| 62 |
proc guality_transform_options { args } { |
| 63 |
set res [list] |
| 64 |
foreach opt [lindex $args 0] { |
| 65 |
# |
| 66 |
if { ! [regexp -- "-O0" $opt] } { |
| 67 |
set opt "$opt -DPREVENT_OPTIMIZATION" |
| 68 |
} |
| 69 |
lappend res $opt |
| 70 |
} |
| 71 |
|
| 72 |
return $res |
| 73 |
} |
| 74 |
|
| 75 |
global DG_TORTURE_OPTIONS |
| 76 |
set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS] |
| 77 |
set guality_dg_torture_options [guality_transform_options $guality_dg_torture_options] |
| 78 |
set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS] |
| 79 |
set-torture-options \ |
| 80 |
$guality_dg_torture_options \ |
| 81 |
[list {}] \ |
| 82 |
$guality_lto_torture_options |
| 83 |
|
| 84 |
if {[check_guality " |
| 85 |
#include \"$srcdir/$subdir/guality.h\" |
| 86 |
volatile long int varl = 6; |
| 87 |
int main (int argc, char *argv\[\]) |
| 88 |
{ |
| 89 |
GUALCHKVAL (varl); |
| 90 |
return 0; |
| 91 |
} |
| 92 |
"]} { |
| 93 |
set general [list] |
| 94 |
set Og [list] |
| 95 |
foreach file [lsort [glob $srcdir/c-c++-common/guality/*.c]] { |
| 96 |
switch -glob -- [file tail $file] { |
| 97 |
Og-* { lappend Og $file } |
| 98 |
* { lappend general $file } |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" "" |
| 103 |
gcc-dg-runtest $general "" "-Wc++-compat" |
| 104 |
set-torture-options \ |
| 105 |
[list "-O0" "-Og"] \ |
| 106 |
[list {}] \ |
| 107 |
[list "-Og -flto"] |
| 108 |
gcc-dg-runtest $Og "" "-Wc++-compat" |
| 109 |
} |
| 110 |
|
| 111 |
if [info exists guality_gdb_name] { |
| 112 |
unsetenv GUALITY_GDB_NAME |
| 113 |
} |
| 114 |
|
| 115 |
if [info exists ::env(DEBUGINFOD_URLS)] { |
| 116 |
setenv DEBUGINFOD_URLS "$orig_debuginfod_urls" |
| 117 |
} |
| 118 |
|
| 119 |
torture-finish |
| 120 |
dg-finish |