OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [lib/] [gcc-defs.exp] - Blame information for rev 306

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 306 jeremybenn
# Copyright (C) 2001, 2003, 2004, 2007 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
# .
16
 
17
load_lib target-libpath.exp
18
 
19
load_lib wrapper.exp
20
 
21
#
22
# ${tool}_check_compile -- Reports and returns pass/fail for a compilation
23
#
24
 
25
proc ${tool}_check_compile {testcase option objname gcc_output} {
26
    global tool
27
    set fatal_signal "*cc: Internal compiler error: program*got fatal signal"
28
 
29
    if [string match "$fatal_signal 6" $gcc_output] then {
30
        ${tool}_fail $testcase "Got Signal 6, $option"
31
        return 0
32
    }
33
 
34
    if [string match "$fatal_signal 11" $gcc_output] then {
35
        ${tool}_fail $testcase "Got Signal 11, $option"
36
        return 0
37
    }
38
 
39
    if [string match "*internal compiler error*" $gcc_output] then {
40
        ${tool}_fail $testcase "$option (internal compiler error)"
41
        return 0
42
    }
43
 
44
    # We shouldn't get these because of -w, but just in case.
45
    if [string match "*cc:*warning:*" $gcc_output] then {
46
        warning "$testcase: (with warnings) $option"
47
        send_log "$gcc_output\n"
48
        unresolved "$testcase, $option"
49
        return 0
50
    }
51
 
52
    set gcc_output [prune_warnings $gcc_output]
53
 
54
    if { [info proc ${tool}-dg-prune] != "" } {
55
        global target_triplet
56
        set gcc_output [${tool}-dg-prune $target_triplet $gcc_output]
57
    }
58
 
59
    set unsupported_message [${tool}_check_unsupported_p $gcc_output]
60
    if { $unsupported_message != "" } {
61
        unsupported "$testcase: $unsupported_message"
62
        return 0
63
    }
64
 
65
    # remove any leftover LF/CR to make sure any output is legit
66
    regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output
67
 
68
    # If any message remains, we fail.
69
    if ![string match "" $gcc_output] then {
70
        ${tool}_fail $testcase $option
71
        return 0
72
    }
73
 
74
    # fail if the desired object file doesn't exist.
75
    # FIXME: there's no way of checking for existence on a remote host.
76
    if {$objname != "" && ![is3way] && ![file exists $objname]} {
77
        ${tool}_fail $testcase $option
78
        return 0
79
    }
80
 
81
    ${tool}_pass $testcase $option
82
    return 1
83
}
84
 
85
#
86
# ${tool}_pass -- utility to record a testcase passed
87
#
88
 
89
proc ${tool}_pass { testcase cflags } {
90
    if { "$cflags" == "" } {
91
        pass "$testcase"
92
    } else {
93
        pass "$testcase, $cflags"
94
    }
95
}
96
 
97
#
98
# ${tool}_fail -- utility to record a testcase failed
99
#
100
 
101
proc ${tool}_fail { testcase cflags } {
102
    if { "$cflags" == "" } {
103
        fail "$testcase"
104
    } else {
105
        fail "$testcase, $cflags"
106
    }
107
}
108
 
109
#
110
# ${tool}_finish -- called at the end of every script that calls ${tool}_init
111
#
112
# Hide all quirks of the testing environment from the testsuites.  Also
113
# undo anything that ${tool}_init did that needs undoing.
114
#
115
 
116
proc ${tool}_finish { } {
117
    # The testing harness apparently requires this.
118
    global errorInfo
119
 
120
    if [info exists errorInfo] then {
121
        unset errorInfo
122
    }
123
 
124
    # Might as well reset these (keeps our caller from wondering whether
125
    # s/he has to or not).
126
    global prms_id bug_id
127
    set prms_id 0
128
    set bug_id 0
129
}
130
 
131
#
132
# ${tool}_exit -- Does final cleanup when testing is complete
133
#
134
 
135
proc ${tool}_exit { } {
136
    global gluefile
137
 
138
    if [info exists gluefile] {
139
        file_on_build delete $gluefile
140
        unset gluefile
141
    }
142
}
143
 
144
#
145
# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output
146
#       for text indicating that the testcase should be marked as "unsupported"
147
#
148
# Utility used by mike-gcc.exp and c-torture.exp.
149
# When dealing with a large number of tests, it's difficult to weed out the
150
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
151
# of memory).  There are various ways to deal with this.  Here's one.
152
# Fortunately, all of the cases where this is likely to happen will be using
153
# gld so we can tell what the error text will look like.
154
#
155
 
156
proc ${tool}_check_unsupported_p { output } {
157
    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
158
        return "memory full"
159
    }
160
    if {[istarget spu-*-*] && \
161
            [string match "*exceeds local store*" $output]} {
162
        return "memory full"
163
    }
164
    return ""
165
}
166
 
167
#
168
# runtest_file_p -- Provide a definition for older dejagnu releases
169
#                   and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
170
#                   (delete after next dejagnu release).
171
#
172
 
173
if { [info procs runtest_file_p] == "" } then {
174
    proc runtest_file_p { runtests testcase } {
175
        if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
176
            if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
177
                return 1
178
            } else {
179
                return 0
180
            }
181
        }
182
        return 1
183
    }
184
}
185
 
186
# Record additional sources files that must be compiled along with the
187
# main source file.
188
 
189
set additional_sources ""
190
 
191
proc dg-additional-sources { args } {
192
    global additional_sources
193
    set additional_sources [lindex $args 1]
194
}
195
 
196
# Record additional files -- other than source files -- that must be
197
# present on the system where the compiler runs.
198
 
199
set additional_files ""
200
 
201
proc dg-additional-files { args } {
202
    global additional_files
203
    set additional_files [lindex $args 1]
204
}
205
 
206
# Return an updated version of OPTIONS that mentions any additional
207
# source files registered with dg-additional-sources.  SOURCE is the
208
# name of the test case.
209
 
210
proc dg-additional-files-options { options source } {
211
    global additional_sources
212
    global additional_files
213
    set to_download [list]
214
    if { $additional_sources != "" } then {
215
        if [is_remote host] {
216
            lappend options "additional_flags=$additional_sources"
217
        }
218
        regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
219
        if ![is_remote host] {
220
            lappend options "additional_flags=$additional_sources"
221
        }
222
        set to_download [concat $to_download $additional_sources]
223
        set additional_sources ""
224
    }
225
    if { $additional_files != "" } then {
226
        regsub -all " " $additional_files " [file dirname $source]/" additional_files
227
        set to_download [concat $to_download $additional_files]
228
        set additional_files ""
229
    }
230
    if [is_remote host] {
231
        foreach file $to_download {
232
            remote_download host $file
233
        }
234
    }
235
 
236
    return $options
237
}
238
 
239
# Return a colon-separate list of directories to search for libraries
240
# for COMPILER, including multilib directories.
241
 
242
proc gcc-set-multilib-library-path { compiler } {
243
    global rootme
244
 
245
    # ??? rootme will not be set when testing an installed compiler.
246
    # In that case, we should perhaps use some other method to find
247
    # libraries.
248
    if {![info exists rootme]} {
249
        return ""
250
    }
251
 
252
    set libpath ":${rootme}"
253
    set compiler [lindex $compiler 0]
254
    if { [is_remote host] == 0 && [which $compiler] != 0 } {
255
        foreach i "[exec $compiler --print-multi-lib]" {
256
            set mldir ""
257
            regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
258
            set mldir [string trimright $mldir "\;@"]
259
            if { "$mldir" == "." } {
260
                continue
261
            }
262
            if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
263
                append libpath ":${rootme}/${mldir}"
264
            }
265
        }
266
    }
267
 
268
    return $libpath
269
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.