OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [testsuite/] [gdb.base/] [fileio.exp] - Blame information for rev 127

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

Line No. Rev Author Line
1 24 jeremybenn
#   Copyright 2002, 2003, 2004, 2007, 2008 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 this program.  If not, see .
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# This file was written by Corinna Vinschen 
20
 
21
if [target_info exists gdb,nofileio] {
22
    verbose "Skipping fileio.exp because of no fileio capabilities."
23
    continue
24
}
25
 
26
if $tracelevel then {
27
        strace $tracelevel
28
}
29
 
30
set prms_id 0
31
set bug_id 0
32
 
33
set testfile "fileio"
34
set srcfile ${testfile}.c
35
set binfile ${objdir}/${subdir}/${testfile}
36
 
37
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
38
    untested fileio.exp
39
    return -1
40
}
41
 
42
# Create and source the file that provides information about the compiler
43
# used to compile the test case.
44
 
45
if [get_compiler_info ${binfile}] {
46
    return -1;
47
}
48
 
49
remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
50
remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
51
 
52
set oldtimeout $timeout
53
set timeout [expr "$timeout + 60"]
54
 
55
# Start with a fresh gdb.
56
 
57
gdb_exit
58
gdb_start
59
gdb_reinitialize_dir $srcdir/$subdir
60
gdb_load ${binfile}
61
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
62
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
63
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
64
 
65
 
66
if ![runto_main] then {
67
    perror "couldn't run to breakpoint"
68
    continue
69
}
70
 
71
send_gdb "break stop\n" ; gdb_expect -re "Breakpoint .*$srcfile.*$gdb_prompt $"
72
set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(\\) {}.*"
73
 
74
gdb_test continue \
75
"Continuing\\..*open 1:.*OK$stop_msg" \
76
"Open a file"
77
 
78
gdb_test continue \
79
"Continuing\\..*open 2:.*EEXIST$stop_msg" \
80
"Creating already existing file returns EEXIST"
81
 
82
gdb_test continue \
83
"Continuing\\..*open 3:.*EISDIR$stop_msg" \
84
"Open directory for writing returns EISDIR"
85
 
86
gdb_test continue \
87
"Continuing\\..*open 4:.*ENOENT$stop_msg" \
88
"Opening nonexistant file returns ENOENT"
89
 
90
send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
91
catch "system \"chmod -f -w nowrt.fileio.test\""
92
 
93
gdb_test continue \
94
"Continuing\\..*open 5:.*EACCES$stop_msg" \
95
"Open for write but no write permission returns EACCES"
96
 
97
gdb_test continue \
98
"Continuing\\..*write 1:.*OK$stop_msg" \
99
"Writing to a file"
100
 
101
gdb_test continue \
102
"Continuing\\..*write 2:.*EBADF$stop_msg" \
103
"Write using invalid file descriptor returns EBADF"
104
 
105
gdb_test continue \
106
"Continuing\\..*write 3:.*EBADF$stop_msg" \
107
"Writing to a read-only file returns EBADF"
108
 
109
gdb_test continue \
110
"Continuing\\..*read 1:.*OK$stop_msg" \
111
"Reading from a file"
112
 
113
gdb_test continue \
114
"Continuing\\..*read 2:.*EBADF$stop_msg" \
115
"Read using invalid file descriptor returns EBADF"
116
 
117
gdb_test continue \
118
"Continuing\\..*lseek 1:.*OK$stop_msg" \
119
"Lseeking CUR a file"
120
 
121
gdb_test continue \
122
"Continuing\\..*lseek 2:.*OK$stop_msg" \
123
"Lseeking END a file"
124
 
125
gdb_test continue \
126
"Continuing\\..*lseek 3:.*OK$stop_msg" \
127
"Lseeking SET a file"
128
 
129
 
130
gdb_test continue \
131
"Continuing\\..*close 1:.*OK$stop_msg" \
132
"Closing a file"
133
 
134
gdb_test continue \
135
"Continuing\\..*close 2:.*EBADF$stop_msg" \
136
"Closing an invalid file descriptor returns EBADF"
137
 
138
gdb_test continue \
139
"Continuing\\..*stat 1:.*OK$stop_msg" \
140
"Stat a file"
141
 
142
gdb_test continue \
143
        "Continuing\\..*stat 2:.*(ENOENT|EFAULT)$stop_msg" \
144
"Stat a NULL pathname returns ENOENT or EFAULT"
145
 
146
gdb_test continue \
147
"Continuing\\..*stat 3:.*ENOENT$stop_msg" \
148
"Stat an empty pathname returns ENOENT"
149
 
150
gdb_test continue \
151
"Continuing\\..*stat 4:.*ENOENT$stop_msg" \
152
"Stat a nonexistant file returns ENOENT"
153
 
154
gdb_test continue \
155
"Continuing\\..*fstat 1:.*OK$stop_msg" \
156
"Fstat an open file"
157
 
158
gdb_test continue \
159
"Continuing\\..*fstat 2:.*EBADF$stop_msg" \
160
"Fstat an invalid file descriptor returns EBADF"
161
 
162
gdb_test continue \
163
"Continuing\\..*isatty 1:.*OK$stop_msg" \
164
"Isatty (stdin)"
165
 
166
gdb_test continue \
167
"Continuing\\..*isatty 2:.*OK$stop_msg" \
168
"Isatty (stdout)"
169
 
170
gdb_test continue \
171
"Continuing\\..*isatty 3:.*OK$stop_msg" \
172
"Isatty (stderr)"
173
 
174
gdb_test continue \
175
"Continuing\\..*isatty 4:.*OK$stop_msg" \
176
"Isatty (invalid fd)"
177
 
178
gdb_test continue \
179
"Continuing\\..*isatty 5:.*OK$stop_msg" \
180
"Isatty (open file)"
181
 
182
gdb_test continue \
183
"Continuing\\..*system 1:.*OK$stop_msg" \
184
"System says shell is available"
185
 
186
send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $"
187
gdb_test continue \
188
"Continuing\\..*system 2:.*OK$stop_msg" \
189
"System(3) call"
190
 
191
# Is this ok?  POSIX says system returns a waitpid status?
192
gdb_test continue \
193
"Continuing\\..*system 3:.*OK$stop_msg" \
194
"System with invalid command returns 127"
195
 
196
gdb_test continue \
197
"Continuing\\..*rename 1:.*OK$stop_msg" \
198
"Rename a file"
199
 
200
gdb_test continue \
201
"Continuing\\..*rename 2:.*EISDIR$stop_msg" \
202
"Renaming a file to existing directory returns EISDIR"
203
 
204
set test "Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST"
205
gdb_test_multiple continue "${test}" {
206
    -re "Continuing\\..*rename 3:.*(ENOTEMPTY|EEXIST)$stop_msg$gdb_prompt $" {
207
        pass "${test}"
208
    }
209
    -re "Continuing\\..*rename 3:.*EBUSY$stop_msg$gdb_prompt $" {
210
        # At least version <= 2.6/2004-01-08 of the Linux Kernel gets
211
        # this wrong (reporting EBUSY) when the file system is NFS
212
        # mounted.
213
        setup_xfail *-*-*linux* gdb/1502
214
        fail "${test}"
215
    }
216
}
217
 
218
gdb_test continue \
219
"Continuing\\..*rename 4:.*EINVAL$stop_msg" \
220
"Renaming a directory to a subdir of itself returns EINVAL"
221
 
222
gdb_test continue \
223
"Continuing\\..*rename 5:.*ENOENT$stop_msg" \
224
"Renaming a nonexistant file returns ENOENT"
225
 
226
gdb_test continue \
227
"Continuing\\..*unlink 1:.*OK$stop_msg" \
228
"Unlink a file"
229
 
230
# This test fails on Cygwin because unlink() succeeds on Win32 systems
231
# in that situation.
232
if [ishost *cygwin*] {
233
    setup_xfail "*-*-*"
234
}
235
gdb_test continue \
236
"Continuing\\..*unlink 2:.*EACCES$stop_msg" \
237
"Unlinking a file in a directory w/o write access returns EACCES"
238
 
239
gdb_test continue \
240
"Continuing\\..*unlink 3:.*ENOENT$stop_msg" \
241
"Unlinking a nonexistant file returns ENOENT"
242
 
243
gdb_test continue \
244
"Continuing\\..*time 1:.*OK$stop_msg" \
245
"Time(2) call returns the same value as in parameter"
246
 
247
sleep 2
248
gdb_test continue \
249
"Continuing\\..*time 2:.*OK$stop_msg" \
250
"Time(2) returns feasible values"
251
 
252
send_gdb "quit\n"
253
send_gdb "y\n"
254
 
255
remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
256
remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
257
 
258
set timeout $oldtimeout
259
return 0

powered by: WebSVN 2.1.0

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