Skip guality tests on hppa-hpux.
[official-gcc.git] / gcc / testsuite / gcc.dg / guality / guality.exp
blob075bebe34e8999fd56ada8a1b50bde5d4e9923f7
1 # This harness is for tests that should be run at all optimisation levels.
3 load_lib gcc-dg.exp
4 load_lib gcc-gdb-test.exp
6 # Disable on darwin until radr://7264615 is resolved.
7 if { [istarget *-*-darwin*] } {
8 return
11 if { [istarget hppa*-*-hpux*] } {
12 return
15 if { [istarget "powerpc-ibm-aix*"] } {
16 set torture_execute_xfail "powerpc-ibm-aix*"
17 return
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]
34 remote_file build delete $output
35 array set test_counts [array get saved_test_counts]
36 return $ret
39 dg-init
41 global GDB
42 if ![info exists ::env(GUALITY_GDB_NAME)] {
43 if [info exists GDB] {
44 set guality_gdb_name "$GDB"
45 } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
46 # If we're doing a combined build, and gdb is available, use it.
47 set guality_gdb_name "$rootme/../gdb/gdb"
48 } else {
49 set guality_gdb_name "[transform gdb]"
51 setenv GUALITY_GDB_NAME "$guality_gdb_name"
53 report_gdb $::env(GUALITY_GDB_NAME) [info script]
55 proc guality_transform_options { args } {
56 set res [list]
57 foreach opt [lindex $args 0] {
59 if { ! [regexp -- "-O0" $opt] } {
60 set opt "$opt -DPREVENT_OPTIMIZATION"
62 lappend res $opt
65 return $res
68 global DG_TORTURE_OPTIONS
69 set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
70 set guality_dg_torture_options [guality_transform_options $guality_dg_torture_options]
71 set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS]
72 torture-init
73 set-torture-options \
74 $guality_dg_torture_options \
75 [list {}] \
76 $guality_lto_torture_options
78 if {[check_guality "
79 #include \"$srcdir/$subdir/guality.h\"
80 volatile long int varl = 6;
81 int main (int argc, char *argv\[\])
83 GUALCHKVAL (varl);
84 return 0;
86 "]} {
87 set general [list]
88 set Og [list]
89 foreach file [lsort [glob $srcdir/c-c++-common/guality/*.c]] {
90 switch -glob -- [file tail $file] {
91 Og-* { lappend Og $file }
92 * { lappend general $file }
96 gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" ""
97 gcc-dg-runtest $general "" "-Wc++-compat"
98 set-torture-options \
99 [list "-O0" "-Og"] \
100 [list {}] \
101 [list "-Og -flto"]
102 gcc-dg-runtest $Og "" "-Wc++-compat"
105 if [info exists guality_gdb_name] {
106 unsetenv GUALITY_GDB_NAME
109 torture-finish
110 dg-finish