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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [lib/] [gcc-defs.exp] - Blame information for rev 701

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 701 jeremybenn
# Copyright (C) 2001, 2003, 2004, 2007, 2010 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
# Like dg-options, but adds to the default options rather than replacing them.
187
 
188
proc dg-additional-options { args } {
189
    upvar dg-extra-tool-flags extra-tool-flags
190
 
191
    if { [llength $args] > 3 } {
192
        error "[lindex $args 0]: too many arguments"
193
        return
194
    }
195
 
196
    if { [llength $args] >= 3 } {
197
        switch [dg-process-target [lindex $args 2]] {
198
            "S" { eval lappend extra-tool-flags [lindex $args 1] }
199
            "N" { }
200
            "F" { error "[lindex $args 0]: `xfail' not allowed here" }
201
            "P" { error "[lindex $args 0]: `xfail' not allowed here" }
202
        }
203
    } else {
204
        eval lappend extra-tool-flags [lindex $args 1]
205
    }
206
}
207
 
208
# Record additional sources files that must be compiled along with the
209
# main source file.
210
 
211
set additional_sources ""
212
 
213
proc dg-additional-sources { args } {
214
    global additional_sources
215
    set additional_sources [lindex $args 1]
216
}
217
 
218
# Record additional files -- other than source files -- that must be
219
# present on the system where the compiler runs.
220
 
221
set additional_files ""
222
 
223
proc dg-additional-files { args } {
224
    global additional_files
225
    set additional_files [lindex $args 1]
226
}
227
 
228
# Return an updated version of OPTIONS that mentions any additional
229
# source files registered with dg-additional-sources.  SOURCE is the
230
# name of the test case.
231
 
232
proc dg-additional-files-options { options source } {
233
    global additional_sources
234
    global additional_files
235
    set to_download [list]
236
    if { $additional_sources != "" } then {
237
        if [is_remote host] {
238
            lappend options "additional_flags=$additional_sources"
239
        }
240
        regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
241
        if ![is_remote host] {
242
            lappend options "additional_flags=$additional_sources"
243
        }
244
        set to_download [concat $to_download $additional_sources]
245
        set additional_sources ""
246
    }
247
    if { $additional_files != "" } then {
248
        regsub -all " " $additional_files " [file dirname $source]/" additional_files
249
        set to_download [concat $to_download $additional_files]
250
        set additional_files ""
251
    }
252
    if [is_remote host] {
253
        foreach file $to_download {
254
            remote_download host $file
255
        }
256
    }
257
 
258
    return $options
259
}
260
 
261
# Return a colon-separate list of directories to search for libraries
262
# for COMPILER, including multilib directories.
263
 
264
proc gcc-set-multilib-library-path { compiler } {
265
    global rootme
266
 
267
    # ??? rootme will not be set when testing an installed compiler.
268
    # In that case, we should perhaps use some other method to find
269
    # libraries.
270
    if {![info exists rootme]} {
271
        return ""
272
    }
273
 
274
    set libpath ":${rootme}"
275
    set options [lrange $compiler 1 end]
276
    set compiler [lindex $compiler 0]
277
    if { [is_remote host] == 0 && [which $compiler] != 0 } {
278
        foreach i "[eval exec $compiler $options --print-multi-lib]" {
279
            set mldir ""
280
            regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
281
            set mldir [string trimright $mldir "\;@"]
282
            if { "$mldir" == "." } {
283
                continue
284
            }
285
            if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
286
                append libpath ":${rootme}/${mldir}"
287
            }
288
        }
289
    }
290
 
291
    return $libpath
292
}

powered by: WebSVN 2.1.0

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