Debian Codegraph @

gcc/testsuite/g++.dg/guality/guality.exp

raw
1 # This harness is for tests that should be run at all optimisation levels.
2
3 load_lib g++-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 [g++_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 global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
63 set guality_dg_torture_options [guality_minimal_options $DG_TORTURE_OPTIONS]
64 set-torture-options \
65 $guality_dg_torture_options \
66 [list {}] \
67 $LTO_TORTURE_OPTIONS
68
69 if {[check_guality "
70 #include \"$srcdir/$subdir/guality.h\"
71 volatile long int varl = 6;
72 int main (int argc, char *argv\[\])
73 {
74 GUALCHKVAL (varl);
75 return 0;
76 }
77 "]} {
78 set general [list]
79 set Og [list]
80 foreach file [lsort [glob $srcdir/c-c++-common/guality/*.c]] {
81 switch -glob -- [file tail $file] {
82 Og-* { lappend Og $file }
83 * { lappend general $file }
84 }
85 }
86
87 gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "" ""
88 gcc-dg-runtest $general "" ""
89 set-torture-options \
90 [list "-O0" "-Og"] \
91 [list {}] \
92 [list "-Og -flto"]
93 gcc-dg-runtest $Og "" ""
94 }
95
96 if [info exists guality_gdb_name] {
97 unsetenv GUALITY_GDB_NAME
98 }
99
100 if [info exists ::env(DEBUGINFOD_URLS)] {
101 setenv DEBUGINFOD_URLS "$orig_debuginfod_urls"
102 }
103
104 torture-finish
105 dg-finish