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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [fileio.exp] - Blame information for rev 252

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

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

powered by: WebSVN 2.1.0

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