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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [a2-run.exp] - Blame information for rev 833

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

Line No. Rev Author Line
1 227 jeremybenn
#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 2000,
2
#   2007, 2008, 2009, 2010 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 this program.  If not, see .
16
 
17
# This file was written by Rob Savoye. (rob@cygnus.com)
18
 
19
# Can't do this test without stdio support.
20
if [gdb_skip_stdio_test "a2run.exp"] {
21
    return
22
}
23
 
24
if $tracelevel then {
25
    strace $tracelevel
26
}
27
 
28
#
29
# test running programs
30
#
31
set prms_id 0
32
set bug_id 0
33
 
34
set testfile a2-run
35
if { [prepare_for_testing ${testfile}.exp $testfile run.c] } {
36
    return -1
37
}
38
 
39
# Run with no arguments.
40
# On VxWorks this justs make sure the program was run.
41
gdb_run_cmd
42
 
43
if [istarget "*-*-vxworks*"] then {
44
    set timeout 120
45
    verbose "Timeout is now $timeout seconds" 2
46
    gdb_expect {
47
         "Program exited normally" {
48
            unresolved "run \"$testfile\" with no args"
49
        }
50
         -re "usage:  factorial " {
51
            pass "run \"$testfile\" with no args"
52
        }
53
        timeout {
54
            fail "(timeout) run \"$testfile\" with no args"
55
        }
56
    }
57
    set timeout 10
58
    verbose "Timeout is now $timeout seconds" 2
59
    gdb_expect -re "$gdb_prompt $" {}
60
} else {
61
    gdb_expect {
62
        -re ".*usage:  factorial .*Program exited with code 01\.\r\n$gdb_prompt $" {
63
            pass "run \"$testfile\" with no args"
64
            pass "no spurious messages at program exit"
65
        }
66
        -re ".*usage:  factorial .*Program exited with code 01.*$gdb_prompt $" {
67
            pass "run \"$testfile\" with no args"
68
            fail "no spurious messages at program exit"
69
        }
70
        -re ".*usage:  factorial .* EXIT code 1.*Program exited normally\.\r\n$gdb_prompt $" {
71
            pass "run \"$testfile\" with no args (exit wrapper)"
72
            pass "no spurious messages at program exit"
73
        }
74
        -re ".*usage:  factorial .* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
75
            pass "run \"$testfile\" with no args (exit wrapper)"
76
            fail "no spurious messages at program exit"
77
        }
78
        -re ".*$gdb_prompt $" {
79
            fail "run \"$testfile\" with no args"
80
            verbose "expect_out is $expect_out(buffer)" 2
81
        }
82
        timeout {
83
            fail "(timeout) run \"$testfile\" no args"
84
        }
85
    }
86
}
87
 
88
# The remaining tests don't work for targets can't take arguments...
89
 
90
if [target_info exists noargs] then {
91
    verbose "Skipping rest of a2-run.exp because of noargs."
92
    return
93
}
94
 
95
# Now run with some arguments
96
if [istarget "*-*-vxworks*"] then {
97
    send_gdb "run vxmain \"5\"\n"
98
    gdb_expect -re "run vxmain \"5\"\r\n" {}
99
    set timeout 120
100
    verbose "Timeout is now $timeout seconds" 2
101
    gdb_expect {
102
         "Program exited normally" {
103
            unresolved "run \"$testfile\" with arg"
104
        }
105
         "120" {
106
            pass "run \"$testfile\" with arg"
107
        }
108
        timeout {
109
            fail "(timeout) run \"$testfile\" with arg"
110
        }
111
    }
112
    set timeout 10
113
    verbose "Timeout is now $timeout seconds" 2
114
    gdb_expect -re "$gdb_prompt $" {}
115
} else {
116
        setup_xfail "mips-idt-*" "arm-*-coff strongarm-*-coff"
117
        gdb_run_cmd 5
118
        gdb_expect {
119
            -re ".*120.*$gdb_prompt $"\
120
                                { pass "run \"$testfile\" with arg" }
121
            -re ".*$gdb_prompt $"       { fail "run \"$testfile\" with arg" }
122
            timeout             { fail "(timeout) run \"$testfile\" with arg" }
123
        }
124
}
125
 
126
# Run again with same arguments.
127
setup_xfail "mips-idt-*"
128
gdb_run_cmd
129
 
130
if [istarget "*-*-vxworks*"] then {
131
    set timeout 120
132
    verbose "Timeout is now $timeout seconds" 2
133
    gdb_expect {
134
         "Program exited normally" {
135
            unresolved "run \"$testfile\" again with same args"
136
        }
137
         "120" { pass "run \"$testfile\" again with same args" }
138
        timeout { fail "(timeout) run \"$testfile\" again with same args" }
139
    }
140
    set timeout 10
141
    verbose "Timeout is now $timeout seconds" 2
142
    gdb_expect -re "$gdb_prompt $" {}
143
} else {
144
    setup_xfail "arm-*-coff strongarm-*-coff"
145
    gdb_expect {
146
            -re ".*120.*$gdb_prompt $"\
147
                                { pass "run \"$testfile\" again with same args" }
148
            -re ".*$gdb_prompt $"       { fail "run \"$testfile\" again with same args" }
149
            timeout             { fail "(timeout) run \"$testfile\" again with same args" }
150
        }
151
}
152
 
153
# Use "set args" command to specify no arguments as default and run again.
154
if [istarget "*-*-vxworks*"] then {
155
    send_gdb "set args main\n"
156
} else {
157
    send_gdb "set args\n"
158
}
159
gdb_expect -re "$gdb_prompt $"
160
 
161
gdb_run_cmd
162
 
163
if [istarget "*-*-vxworks*"] then {
164
    set timeout 120
165
    verbose "Timeout is now $timeout seconds" 2
166
    gdb_expect {
167
         "Program exited normally" {
168
            unresolved "run after setting args to nil"
169
        }
170
         "usage:  factorial " {
171
            pass "run after setting args to nil"
172
        }
173
        timeout {
174
            fail "(timeout) run after setting args to nil"
175
        }
176
    }
177
    set timeout 10
178
    verbose "Timeout is now $timeout seconds" 2
179
    gdb_expect -re "$gdb_prompt $" {}
180
} else {
181
    gdb_expect {
182
        -re ".*usage:  factorial .*$gdb_prompt $" {
183
            pass "run after setting args to nil"
184
        }
185
        -re ".*$gdb_prompt $" {
186
            fail "run after setting args to nil"
187
        }
188
        timeout {
189
            fail "(timeout) run after setting args to nil"
190
        }
191
    }
192
}
193
 
194
# Use "set args" command to specify an argument and run again.
195
setup_xfail "mips-idt-*"
196
if [istarget "*-*-vxworks*"] then {
197
   send_gdb "set args vxmain \"6\"\n"
198
} else {
199
        send_gdb "set args 6\n"
200
}
201
gdb_expect -re "$gdb_prompt $"
202
gdb_run_cmd
203
 
204
if [istarget "*-*-vxworks*"] then {
205
    set timeout 120
206
    verbose "Timeout is now $timeout seconds" 2
207
    gdb_expect {
208
         "Program exited normally" {
209
            unresolved "run \"$testfile\" again after setting args"
210
        }
211
         "720" {
212
            pass "run \"$testfile\" again after setting args"
213
        }
214
        timeout {
215
            fail "(timeout) run \"$testfile\" again after setting args"
216
        }
217
    }
218
    set timeout 10
219
    verbose "Timeout is now $timeout seconds" 2
220
    gdb_expect -re "$gdb_prompt $" {}
221
} else {
222
    setup_xfail "arm-*-coff strongarm-*-coff"
223
    gdb_expect {
224
            -re ".*720.*$gdb_prompt $" {
225
                pass "run \"$testfile\" again after setting args"
226
            }
227
            -re ".*$gdb_prompt $" {
228
                fail "run \"$testfile\" again after setting args"
229
            }
230
            timeout {
231
                fail "(timeout) run \"$testfile\" again after setting args"
232
            }
233
        }
234
}
235
 
236
# GOAL: Test that shell is being used with "run".  For remote debugging
237
# targets, there is no guarantee that a "shell" (whatever that is) is used.
238
if ![is_remote target] then {
239
    send_gdb "run `echo 8`\n"
240
    gdb_expect {
241
        -re "Starting program.*40320.*$gdb_prompt $" {
242
            pass "run \"$testfile\" with shell"
243
        }
244
        -re ".*$gdb_prompt $" {
245
            fail "run \"$testfile\" with shell"
246
        }
247
        timeout {
248
            fail "(timeout) run \"$testfile\" with shell"
249
        }
250
    }
251
}
252
 
253
# Reset the default arguments for VxWorks
254
if [istarget "*-*-vxworks*"] then {
255
    send_gdb "set args main\n"
256
    gdb_expect -re ".*$gdb_prompt $" {}
257
}

powered by: WebSVN 2.1.0

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