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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [a2-run.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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