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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [lib/] [mike-g++.exp] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
# Copyright (C) 1988, 90, 91, 92, 95, 96, 1997, 2007
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with GCC; see the file COPYING3.  If not see
16
# .
17
 
18
# This file was written by Mike Stump 
19
 
20
#
21
# mike_cleanup -- remove any files that are created by the testcase
22
#
23
proc mike_cleanup { src_code output_file assembly_file } {
24
    remote_file build delete $output_file $assembly_file
25
}
26
 
27
#
28
# prebase -- sets up a Mike Stump (mrs@cygnus.com) style G++ test
29
#
30
proc prebase { } {
31
    global compiler_output
32
    global not_compiler_output
33
    global compiler_result
34
    global not_compiler_result
35
    global program_output
36
    global groups
37
    global run
38
    global actions
39
    global target_regexp
40
 
41
    set compiler_output "^$"
42
    set not_compiler_output ".*Internal compiler error.*"
43
    set compiler_result ""
44
    set not_compiler_result ""
45
    set program_output ".*PASS.*"
46
    set groups {}
47
    set run no
48
    set actions assemble
49
    set target_regexp ".*"
50
}
51
 
52
#
53
# run the test
54
#
55
proc postbase  { src_code run groups args } {
56
    global verbose
57
    global srcdir
58
    global subdir
59
    global not_compiler_output
60
    global compiler_output
61
    global compiler_result
62
    global not_compiler_result
63
    global program_output
64
    global actions
65
    global target_regexp
66
    global host_triplet
67
    global target_triplet
68
    global tool
69
    global tmpdir
70
    global objdir
71
    global base_dir
72
 
73
    if ![regexp $target_regexp $target_triplet] {
74
        unsupported $subdir/$src_code
75
        return
76
    }
77
 
78
    if { [llength $args] > 0 } {
79
        set comp_options [lindex $args 0]
80
    } else {
81
        set comp_options ""
82
    }
83
 
84
    set fail_message $subdir/$src_code
85
    set pass_message $subdir/$src_code
86
 
87
    if [info exists GROUP] {
88
        if {[lsearch $groups $GROUP] == -1} {
89
            return
90
        }
91
    }
92
 
93
    if [string match $run yes] {
94
        set actions run
95
    }
96
 
97
    set output_file "$tmpdir/[file tail [file rootname $src_code]]"
98
    set assembly_file "$output_file"
99
    append assembly_file ".S"
100
 
101
    set compile_type "none"
102
 
103
    case $actions {
104
        compile
105
        {
106
            set compile_type "assembly"
107
            set output_file $assembly_file
108
        }
109
        assemble
110
        {
111
            set compile_type "object"
112
            append output_file ".o"
113
        }
114
        link
115
        {
116
            set compile_type "executable"
117
            append output_file ".exe"
118
        }
119
        run
120
        {
121
            set compile_type "executable"
122
            append output_file ".exe"
123
            set run yes
124
        }
125
        default
126
        {
127
            set output_file ""
128
            set compile_type "none"
129
        }
130
    }
131
 
132
    set src_file "$srcdir/$subdir/$src_code"
133
    set options ""
134
 
135
    if { $comp_options != "" } {
136
        lappend options "additional_flags=$comp_options"
137
    }
138
 
139
    if ![ishost "*-dos-*"] {
140
        lappend options "libs=-lstdc++ -lg++"
141
    } else {
142
        lappend options "libs=-lstdcxx -lgxx"
143
    }
144
 
145
    set comp_output [g++_target_compile $src_file $output_file $compile_type $options]
146
 
147
    set pass no
148
 
149
    # Delete things like "ld.so warning" messages.
150
    set comp_output [prune_warnings $comp_output]
151
 
152
    if [regexp -- $not_compiler_output $comp_output] {
153
        if { $verbose > 1 } {
154
            send_user "\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"
155
        } else {
156
            send_log "\nCompiler output:\n$comp_output\n\n"
157
        }
158
        fail $fail_message
159
        # The framework doesn't like to see any error remnants,
160
        # so remove them.
161
        uplevel {
162
            if [info exists errorInfo] {
163
                unset errorInfo
164
            }
165
        }
166
        mike_cleanup $src_code $output_file $assembly_file
167
        return
168
    }
169
 
170
    # remove any leftover CRs.
171
    regsub -all -- "\r" $comp_output "" comp_output
172
 
173
    regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
174
    regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
175
 
176
    set unsupported_message [${tool}_check_unsupported_p $comp_output]
177
    if { $unsupported_message != "" } {
178
        unsupported "$subdir/$src_code: $unsupported_message"
179
        mike_cleanup $src_code $output_file $assembly_file
180
        return
181
    }
182
 
183
    if { $verbose > 1 } {
184
        send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"
185
    } else {
186
        send_log "\nCompiler output:\n$comp_output\n\n"
187
    }
188
    if [regexp -- $compiler_output $comp_output] {
189
        if { $verbose > 1 } {
190
            send_user "Yes, it matches.\n\n"
191
        }
192
        set pass yes
193
        if [file exists [file rootname [file tail $src_code]].s] {
194
            set fd [open [file rootname [file tail $src_code]].s r]
195
            set dot_s [read $fd]
196
            close $fd
197
            if { $compiler_result != "" } {
198
                verbose "Checking .s file for $compiler_result" 2
199
                if [regexp -- $compiler_result $dot_s] {
200
                    verbose "Yes, it matches." 2
201
                } else {
202
                    verbose "Nope, doesn't match." 2
203
                    verbose $dot_s 4
204
                    set pass no
205
                }
206
            }
207
            if { $not_compiler_result != "" } {
208
                verbose "Checking .s file for not $not_compiler_result" 2
209
                if ![regexp -- $not_compiler_result $dot_s] {
210
                    verbose "Nope, not found (that's good)." 2
211
                } else {
212
                    verbose "Uh oh, it was found." 2
213
                    verbose $dot_s 4
214
                    set pass no
215
                }
216
            }
217
        }
218
        if [string match $run yes] {
219
            set result [g++_load $output_file]
220
            set status [lindex $result 0]
221
            set output [lindex $result 1]
222
 
223
            if { $status == -1 } {
224
                mike_cleanup $src_code $output_file $assembly_file
225
                return
226
            }
227
            if { $verbose > 1 } {
228
                send_user "Checking:\n$program_output\nto see if it matches:\n$output\n\n"
229
            }
230
            if ![regexp -- $program_output $output] {
231
                set pass no
232
                if { $verbose > 1 } {
233
                    send_user "Nope, does not match.\n\n"
234
                }
235
            } else {
236
                if { $verbose > 1 } {
237
                    send_user "Yes, it matches.\n\n"
238
                }
239
            }
240
        }
241
    } else {
242
        if { $verbose > 1 } {
243
            send_user "Nope, does not match.\n\n"
244
        }
245
    }
246
 
247
    if [string match $pass "yes"] {
248
        pass $pass_message
249
    } else {
250
        fail $fail_message
251
    }
252
 
253
    # The framework doesn't like to see any error remnants,
254
    # so remove them.
255
    uplevel {
256
        if [info exists errorInfo] {
257
            unset errorInfo
258
        }
259
    }
260
 
261
    mike_cleanup $src_code $output_file $assembly_file
262
}

powered by: WebSVN 2.1.0

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