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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [lib/] [mike-gcc.exp] - Blame information for rev 12

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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