2003-06-14 Andrew Cagney <cagney@redhat.com>

* gdb.base/fileio.c: Include <errno.h>, and <sys/wait.h>.  Gag
	-Wformat errors.  Add lost line.  Use WEXITSTATUS to get system
	exit status.
	* gdb.base/fileio.exp: Disable target when nointerrupts and
	noinferiorio, instead of limiting it to remote.  Use remote_exec
	instead of system.
This commit is contained in:
Andrew Cagney 2003-06-14 16:51:42 +00:00
parent eb01fc6294
commit b257a0d30a
3 changed files with 113 additions and 63 deletions

View file

@ -1,3 +1,13 @@
2003-06-14 Andrew Cagney <cagney@redhat.com>
* gdb.base/fileio.c: Include <errno.h>, and <sys/wait.h>. Gag
-Wformat errors. Add lost line. Use WEXITSTATUS to get system
exit status.
* gdb.base/fileio.exp: Disable target when nointerrupts and
noinferiorio, instead of limiting it to remote. Use remote_exec
instead of system.
2003-06-12 Jeff Johnston <jjohnstn@redhat.com> 2003-06-12 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/float.exp: Add ia64 support. * gdb.base/float.exp: Add ia64 support.

View file

@ -6,8 +6,9 @@
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
/************************************************************************** #include <errno.h>
* TESTS : #include <sys/wait.h>
/* TESTS :
* - open(const char *pathname, int flags, mode_t mode); * - open(const char *pathname, int flags, mode_t mode);
1) Attempt to create file that already exists - EEXIST 1) Attempt to create file that already exists - EEXIST
2) Attempt to open a directory for writing - EISDIR 2) Attempt to open a directory for writing - EISDIR
@ -53,15 +54,14 @@ time(time_t *t);
Not applicable. Not applicable.
system (const char * string); system (const char * string);
1) Invalid string/command. - returns 127. 1) Invalid string/command. - returns 127. */
***************************************************************************/ static const char *strerrno (int err);
#define FILENAME "foo.fileio.test" #define FILENAME "foo.fileio.test"
#define RENAMED "bar.fileio.test" #define RENAMED "bar.fileio.test"
#define NONEXISTANT "nofoo.fileio.test" #define NONEXISTANT "nofoo.fileio.test"
#define NOWRITE "nowrt.fileio.test" #define NOWRITE "nowrt.fileio.test"
#define TESTDIR1 "dir1.fileio.test" #define TESTDIR1 "dir1.fileio.test"
#define TESTDIR2 "dir2.fileio.test" #define TESTDIR2 "dir2.fileio.test"
#define TESTSUBDIR "dir1.fileio.test/subdir.fileio.test" #define TESTSUBDIR "dir1.fileio.test/subdir.fileio.test"
@ -84,21 +84,21 @@ test_open ()
errno = 0; errno = 0;
ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR); ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR);
printf ("open 2: ret = %d, errno = %d %s\n", ret, errno, printf ("open 2: ret = %d, errno = %d %s\n", ret, errno,
errno == EEXIST ? "OK" : ""); strerrno (errno));
if (ret >= 0) if (ret >= 0)
close (ret); close (ret);
/* Open directory (for writing) */ /* Open directory (for writing) */
errno = 0; errno = 0;
ret = open (".", O_WRONLY); ret = open (".", O_WRONLY);
printf ("open 3: ret = %d, errno = %d %s\n", ret, errno, printf ("open 3: ret = %d, errno = %d %s\n", ret, errno,
errno == EISDIR ? "OK" : ""); strerrno (errno));
if (ret >= 0) if (ret >= 0)
close (ret); close (ret);
/* Opening nonexistant file */ /* Opening nonexistant file */
errno = 0; errno = 0;
ret = open (NONEXISTANT, O_RDONLY); ret = open (NONEXISTANT, O_RDONLY);
printf ("open 4: ret = %d, errno = %d %s\n", ret, errno, printf ("open 4: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
if (ret >= 0) if (ret >= 0)
close (ret); close (ret);
/* Open for write but no write permission */ /* Open for write but no write permission */
@ -110,7 +110,7 @@ test_open ()
errno = 0; errno = 0;
ret = open (NOWRITE, O_WRONLY); ret = open (NOWRITE, O_WRONLY);
printf ("open 5: ret = %d, errno = %d %s\n", ret, errno, printf ("open 5: ret = %d, errno = %d %s\n", ret, errno,
errno == EACCES ? "OK" : ""); strerrno (errno));
if (ret >= 0) if (ret >= 0)
close (ret); close (ret);
} }
@ -140,7 +140,7 @@ test_write ()
errno = 0; errno = 0;
ret = write (999, STRING, strlen (STRING)); ret = write (999, STRING, strlen (STRING));
printf ("write 2: ret = %d, errno = %d, %s\n", ret, errno, printf ("write 2: ret = %d, errno = %d, %s\n", ret, errno,
errno == EBADF ? "OK" : ""); strerrno (errno));
/* Write to a read-only file */ /* Write to a read-only file */
errno = 0; errno = 0;
fd = open (FILENAME, O_RDONLY); fd = open (FILENAME, O_RDONLY);
@ -149,7 +149,7 @@ test_write ()
errno = 0; errno = 0;
ret = write (fd, STRING, strlen (STRING)); ret = write (fd, STRING, strlen (STRING));
printf ("write 3: ret = %d, errno = %d %s\n", ret, errno, printf ("write 3: ret = %d, errno = %d %s\n", ret, errno,
errno == EBADF ? "OK" : ""); strerrno (errno));
} }
else else
printf ("write 3: ret = %d, errno = %d\n", ret, errno); printf ("write 3: ret = %d, errno = %d\n", ret, errno);
@ -182,14 +182,14 @@ test_read ()
errno = 0; errno = 0;
ret = read (999, buf, 16); ret = read (999, buf, 16);
printf ("read 2: ret = %d, errno = %d %s\n", ret, errno, printf ("read 2: ret = %d, errno = %d %s\n", ret, errno,
errno == EBADF ? "OK" : ""); strerrno (errno));
} }
int int
test_lseek () test_lseek ()
{ {
int fd; int fd;
off_t ret; off_t ret = 0;
/* Test seeking */ /* Test seeking */
errno = 0; errno = 0;
@ -198,15 +198,15 @@ test_lseek ()
{ {
errno = 0; errno = 0;
ret = lseek (fd, 0, SEEK_CUR); ret = lseek (fd, 0, SEEK_CUR);
printf ("lseek 1: ret = %ld, errno = %d, %s\n", ret, errno, printf ("lseek 1: ret = %ld, errno = %d, %s\n", (long) ret, errno,
ret == 0 ? "OK" : ""); ret == 0 ? "OK" : "");
errno = 0; errno = 0;
ret = lseek (fd, 0, SEEK_END); ret = lseek (fd, 0, SEEK_END);
printf ("lseek 2: ret = %ld, errno = %d, %s\n", ret, errno, printf ("lseek 2: ret = %ld, errno = %d, %s\n", (long) ret, errno,
ret == 11 ? "OK" : ""); ret == 11 ? "OK" : "");
errno = 0; errno = 0;
ret = lseek (fd, 3, SEEK_SET); ret = lseek (fd, 3, SEEK_SET);
printf ("lseek 3: ret = %ld, errno = %d, %s\n", ret, errno, printf ("lseek 3: ret = %ld, errno = %d, %s\n", (long) ret, errno,
ret == 3 ? "OK" : ""); ret == 3 ? "OK" : "");
close (fd); close (fd);
} }
@ -232,7 +232,7 @@ test_close ()
{ {
errno = 0; errno = 0;
ret = close (fd); ret = close (fd);
printf ("close 1: ret = %ld, errno = %d, %s\n", ret, errno, printf ("close 1: ret = %d, errno = %d, %s\n", ret, errno,
ret == 0 ? "OK" : ""); ret == 0 ? "OK" : "");
} }
else else
@ -240,8 +240,8 @@ test_close ()
/* Close an invalid file descriptor */ /* Close an invalid file descriptor */
errno = 0; errno = 0;
ret = close (999); ret = close (999);
printf ("close 2: ret = %ld, errno = %d, %s\n", ret, errno, printf ("close 2: ret = %d, errno = %d, %s\n", ret, errno,
errno == EBADF ? "OK" : ""); strerrno (errno));
} }
int int
@ -262,17 +262,17 @@ test_stat ()
errno = 0; errno = 0;
ret = stat (NULL, &st); ret = stat (NULL, &st);
printf ("stat 2: ret = %d, errno = %d %s\n", ret, errno, printf ("stat 2: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
/* Empty pathname */ /* Empty pathname */
errno = 0; errno = 0;
ret = stat ("", &st); ret = stat ("", &st);
printf ("stat 3: ret = %d, errno = %d %s\n", ret, errno, printf ("stat 3: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
/* Nonexistant file */ /* Nonexistant file */
errno = 0; errno = 0;
ret = stat (NONEXISTANT, &st); ret = stat (NONEXISTANT, &st);
printf ("stat 4: ret = %d, errno = %d %s\n", ret, errno, printf ("stat 4: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
} }
int int
@ -301,7 +301,7 @@ test_fstat ()
errno = 0; errno = 0;
ret = fstat (999, &st); ret = fstat (999, &st);
printf ("fstat 2: ret = %d, errno = %d %s\n", ret, errno, printf ("fstat 2: ret = %d, errno = %d %s\n", ret, errno,
errno == EBADF ? "OK" : ""); strerrno (errno));
} }
int int
@ -326,6 +326,7 @@ test_isatty ()
printf ("isatty 5: file couldn't open\n"); printf ("isatty 5: file couldn't open\n");
} }
int int
test_system () test_system ()
{ {
@ -344,7 +345,7 @@ test_system ()
printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : ""); printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
/* Invalid command (just guessing ;-) ) */ /* Invalid command (just guessing ;-) ) */
ret = system ("wrtzlpfrmpft"); ret = system ("wrtzlpfrmpft");
printf ("system 2: ret = %d %s\n", ret, ret == 127 ? "OK" : ""); printf ("system 2: ret = %d %s\n", ret, WEXITSTATUS (ret) == 127 ? "OK" : "");
} }
int int
@ -365,7 +366,7 @@ test_rename ()
errno = 0; errno = 0;
ret = stat (RENAMED, &st); ret = stat (RENAMED, &st);
printf ("rename 1: ret = %d, errno = %d %s\n", ret, errno, printf ("rename 1: ret = %d, errno = %d %s\n", ret, errno,
errno == 0 ? "OK" : ""); strerrno (errno));
errno = 0; errno = 0;
} }
else else
@ -377,22 +378,22 @@ test_rename ()
errno = 0; errno = 0;
ret = rename (RENAMED, TESTDIR2); ret = rename (RENAMED, TESTDIR2);
printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno, printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno,
errno == EISDIR ? "OK" : ""); strerrno (errno));
/* newpath is a non-empty directory */ /* newpath is a non-empty directory */
errno = 0; errno = 0;
ret = rename (TESTDIR2, TESTDIR1); ret = rename (TESTDIR2, TESTDIR1);
printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno, printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOTEMPTY || errno == EEXIST ? "OK" : ""); strerrno (errno));
/* newpath is a subdirectory of old path */ /* newpath is a subdirectory of old path */
errno = 0; errno = 0;
ret = rename (TESTDIR1, TESTSUBDIR); ret = rename (TESTDIR1, TESTSUBDIR);
printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno, printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno,
errno == EINVAL ? "OK" : ""); strerrno (errno));
/* oldpath does not exist */ /* oldpath does not exist */
errno = 0; errno = 0;
ret = rename (NONEXISTANT, FILENAME); ret = rename (NONEXISTANT, FILENAME);
printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno, printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
} }
int int
@ -406,7 +407,7 @@ test_unlink ()
errno = 0; errno = 0;
ret = unlink (RENAMED); ret = unlink (RENAMED);
printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno, printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno,
errno == 0 ? "OK" : ""); strerrno (errno));
/* No write access */ /* No write access */
sprintf (name, "%s/%s", TESTDIR2, FILENAME); sprintf (name, "%s/%s", TESTDIR2, FILENAME);
errno = 0; errno = 0;
@ -420,7 +421,7 @@ test_unlink ()
errno = 0; errno = 0;
ret = unlink (name); ret = unlink (name);
printf ("unlink 2: ret = %d, errno = %d %s\n", ret, errno, printf ("unlink 2: ret = %d, errno = %d %s\n", ret, errno,
errno == EACCES ? "OK" : ""); strerrno (errno));
} }
else else
printf ("unlink 2: ret = %d chmod failed\n", ret, errno); printf ("unlink 2: ret = %d chmod failed\n", ret, errno);
@ -431,7 +432,7 @@ test_unlink ()
errno = 0; errno = 0;
ret = unlink (NONEXISTANT); ret = unlink (NONEXISTANT);
printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno, printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno,
errno == ENOENT ? "OK" : ""); strerrno (errno));
} }
int int
@ -441,11 +442,45 @@ test_time ()
errno = 0; errno = 0;
ret = time (&t); ret = time (&t);
printf ("time 1: ret = %d, errno = %d, t = %d %s\n", ret, errno, t, ret == t ? "OK" : ""); printf ("time 1: ret = %ld, errno = %d, t = %ld %s\n", (long) ret, errno, (long) t, ret == t ? "OK" : "");
errno = 0; errno = 0;
ret = time (NULL); ret = time (NULL);
printf ("time 2: ret = %d, errno = %d, t = %d %s\n", ret, errno, t, printf ("time 2: ret = %ld, errno = %d, t = %ld %s\n",
ret >= t && ret < t + 10 ? "OK" : ""); (long) ret, errno, (long) t, ret >= t && ret < t + 10 ? "OK" : "");
}
static const char *
strerrno (int err)
{
switch (err)
{
case 0: return "OK";
#ifdef EACCES
case EACCES: return "EACCES";
#endif
#ifdef EBADF
case EBADF: return "EBADF";
#endif
#ifdef EEXIST
case EEXIST: return "EEXIST";
#endif
#ifdef EFAULT
case EFAULT: return "EFAULT";
#endif
#ifdef EINVAL
case EINVAL: return "EINVAL";
#endif
#ifdef EISDIR
case EISDIR: return "EISDIR";
#endif
#ifdef ENOENT
case ENOENT: return "ENOENT";
#endif
#ifdef ENOTEMPTY
case ENOTEMPTY: return "ENOTEMPTY";
#endif
default: return "E??";
}
} }
int int

View file

@ -20,6 +20,15 @@
# This file was written by Corinna Vinschen <vinschen@redhat.com> # This file was written by Corinna Vinschen <vinschen@redhat.com>
if [target_info exists gdb,nointerrupts] {
verbose "Skipping interrupt.exp because of nointerrupts."
continue
}
if [target_info exists gdb,noinferiorio] {
verbose "Skipping interrupt.exp because of noinferiorio."
return
}
if $tracelevel then { if $tracelevel then {
strace $tracelevel strace $tracelevel
@ -32,11 +41,6 @@ set testfile "fileio"
set srcfile ${testfile}.c set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile} set binfile ${objdir}/${subdir}/${testfile}
# test only on a remote target board
if {! [is_remote target]} {
return 0;
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
} }
@ -48,8 +52,8 @@ if [get_compiler_info ${binfile}] {
return -1; return -1;
} }
catch "system \"chmod -f +w dir2.fileio.test\"" remote_exec build "test -r dir2.fileio.test && chmod -f +w dir2.fileio.test"
catch "system \"rm -rf *.fileio.test\"" remote_exec build "rm -rf *.fileio.test"
set oldtimeout $timeout set oldtimeout $timeout
set timeout [expr "$timeout + 60"] set timeout [expr "$timeout + 60"]
@ -77,17 +81,17 @@ gdb_test continue \
send_gdb "tbreak 88\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 88\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 2:.*OK.*test_open \\(\\) at.*$srcfile:88.*" \ "Continuing\\..*open 2:.*EEXIST.*test_open \\(\\) at.*$srcfile:88.*" \
"Creating already existing file returns EEXIST" "Creating already existing file returns EEXIST"
send_gdb "tbreak 95\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 95\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 3:.*OK.*test_open \\(\\) at.*$srcfile:95.*" \ "Continuing\\..*open 3:.*EISDIR.*test_open \\(\\) at.*$srcfile:95.*" \
"Open directory for writing returns EISDIR" "Open directory for writing returns EISDIR"
send_gdb "tbreak 102\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 102\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 4:.*OK.*test_open \\(\\) at.*$srcfile:102.*" \ "Continuing\\..*open 4:.*ENOENT.*test_open \\(\\) at.*$srcfile:102.*" \
"Opening nonexistant file returns ENOENT" "Opening nonexistant file returns ENOENT"
send_gdb "tbreak 109\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 109\n" ; gdb_expect -re "$gdb_prompt $"
@ -96,7 +100,7 @@ catch "system \"chmod -f -w nowrt.fileio.test\""
send_gdb "tbreak 119\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 119\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 5:.*OK.*test_open \\(\\) at.*$srcfile:119.*" \ "Continuing\\..*open 5:.*EACCES.*test_open \\(\\) at.*$srcfile:119.*" \
"Open for write but no write permission returns EACCES" "Open for write but no write permission returns EACCES"
send_gdb "tbreak 140\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 140\n" ; gdb_expect -re "$gdb_prompt $"
@ -106,12 +110,12 @@ gdb_test continue \
send_gdb "tbreak 145\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 145\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*write 2:.*OK.*test_write \\(\\) at.*$srcfile:145.*" \ "Continuing\\..*write 2:.*EBADF.*test_write \\(\\) at.*$srcfile:145.*" \
"Write using invalid file descriptor returns EBADF" "Write using invalid file descriptor returns EBADF"
send_gdb "tbreak 156\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 156\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*write 3:.*OK.*test_write \\(\\) at.*$srcfile:156.*" \ "Continuing\\..*write 3:.*EBADF.*test_write \\(\\) at.*$srcfile:156.*" \
"Writing to a read-only file returns EBADF" "Writing to a read-only file returns EBADF"
send_gdb "tbreak 182\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 182\n" ; gdb_expect -re "$gdb_prompt $"
@ -121,7 +125,7 @@ gdb_test continue \
send_gdb "tbreak 186\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 186\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*read 2:.*OK.*test_read \\(\\) at.*$srcfile:186.*" \ "Continuing\\..*read 2:.*EBADF.*test_read \\(\\) at.*$srcfile:186.*" \
"Read using invalid file descriptor returns EBADF" "Read using invalid file descriptor returns EBADF"
send_gdb "tbreak 221\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 221\n" ; gdb_expect -re "$gdb_prompt $"
@ -136,7 +140,7 @@ gdb_test continue \
send_gdb "tbreak 245\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 245\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*close 2:.*OK.*test_close \\(\\) at.*$srcfile:245.*" \ "Continuing\\..*close 2:.*EBADF.*test_close \\(\\) at.*$srcfile:245.*" \
"Closing an invalid file descriptor returns EBADF" "Closing an invalid file descriptor returns EBADF"
send_gdb "tbreak 262\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 262\n" ; gdb_expect -re "$gdb_prompt $"
@ -146,17 +150,17 @@ gdb_test continue \
send_gdb "tbreak 267\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 267\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*stat 2:.*OK.*test_stat \\(\\) at.*$srcfile:267.*" \ "Continuing\\..*stat 2:.*(ENOENT|EFAULT).*test_stat \\(\\) at.*$srcfile:267.*" \
"Stat a NULL pathname returns ENOENT" "Stat a NULL pathname returns ENOENT or EFAULT"
send_gdb "tbreak 272\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 272\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*stat 3:.*OK.*test_stat \\(\\) at.*$srcfile:272.*" \ "Continuing\\..*stat 3:.*ENOENT.*test_stat \\(\\) at.*$srcfile:272.*" \
"Stat an empty pathname returns ENOENT" "Stat an empty pathname returns ENOENT"
send_gdb "tbreak 276\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 276\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*stat 4:.*OK.*test_stat \\(\\) at.*$srcfile:276.*" \ "Continuing\\..*stat 4:.*ENOENT.*test_stat \\(\\) at.*$srcfile:276.*" \
"Stat a nonexistant file returns ENOENT" "Stat a nonexistant file returns ENOENT"
send_gdb "tbreak 301\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 301\n" ; gdb_expect -re "$gdb_prompt $"
@ -166,7 +170,7 @@ gdb_test continue \
send_gdb "tbreak 305\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 305\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*fstat 2:.*OK.*test_fstat \\(\\) at.*$srcfile:305.*" \ "Continuing\\..*fstat 2:.*EBADF.*test_fstat \\(\\) at.*$srcfile:305.*" \
"Fstat an invalid file descriptor returns EBADF" "Fstat an invalid file descriptor returns EBADF"
send_gdb "tbreak 314\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 314\n" ; gdb_expect -re "$gdb_prompt $"
@ -200,6 +204,7 @@ gdb_test continue \
"Continuing\\..*system 1:.*OK.*test_system \\(\\) at.*$srcfile:347.*" \ "Continuing\\..*system 1:.*OK.*test_system \\(\\) at.*$srcfile:347.*" \
"System(3) call" "System(3) call"
# Is this ok? POSIX says system returns a waitpid status?
send_gdb "tbreak 349\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 349\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*system 2:.*OK.*test_system \\(\\) at.*$srcfile:349.*" \ "Continuing\\..*system 2:.*OK.*test_system \\(\\) at.*$srcfile:349.*" \
@ -212,22 +217,22 @@ gdb_test continue \
send_gdb "tbreak 383\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 383\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*rename 2:.*OK.*test_rename \\(\\) at.*$srcfile:383.*" \ "Continuing\\..*rename 2:.*EISDIR.*test_rename \\(\\) at.*$srcfile:383.*" \
"Renaming a file to existing directory returns EISDIR" "Renaming a file to existing directory returns EISDIR"
send_gdb "tbreak 388\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 388\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*rename 3:.*OK.*test_rename \\(\\) at.*$srcfile:388.*" \ "Continuing\\..*rename 3:.*(ENOTEMPTY|EEXIST).*test_rename \\(\\) at.*$srcfile:388.*" \
"Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST" "Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST"
send_gdb "tbreak 393\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 393\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*rename 4:.*OK.*test_rename \\(\\) at.*$srcfile:393.*" \ "Continuing\\..*rename 4:.*EINVAL.*test_rename \\(\\) at.*$srcfile:393.*" \
"Renaming a directory to a subdir of itself returns EINVAL" "Renaming a directory to a subdir of itself returns EINVAL"
send_gdb "tbreak 397\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 397\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*rename 5:.*OK.*test_rename \\(\\) at.*$srcfile:397.*" \ "Continuing\\..*rename 5:.*ENOENT.*test_rename \\(\\) at.*$srcfile:397.*" \
"Renaming a nonexistant file returns ENOENT" "Renaming a nonexistant file returns ENOENT"
send_gdb "tbreak 412\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 412\n" ; gdb_expect -re "$gdb_prompt $"
@ -242,12 +247,12 @@ if [ishost *cygwin*] {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_test continue \ gdb_test continue \
"Continuing\\..*unlink 2:.*OK.*test_unlink \\(\\) at.*$srcfile:432.*" \ "Continuing\\..*unlink 2:.*EACCES.*test_unlink \\(\\) at.*$srcfile:432.*" \
"Unlinking a file in a directory w/o write access returns EACCES" "Unlinking a file in a directory w/o write access returns EACCES"
send_gdb "tbreak 436\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 436\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \ gdb_test continue \
"Continuing\\..*unlink 3:.*OK.*test_unlink \\(\\) at.*$srcfile:436.*" \ "Continuing\\..*unlink 3:.*ENOENT.*test_unlink \\(\\) at.*$srcfile:436.*" \
"Unlinking a nonexistant file returns ENOENT" "Unlinking a nonexistant file returns ENOENT"
send_gdb "tbreak 446\n" ; gdb_expect -re "$gdb_prompt $" send_gdb "tbreak 446\n" ; gdb_expect -re "$gdb_prompt $"
@ -264,8 +269,8 @@ gdb_test continue \
send_gdb "quit\n" send_gdb "quit\n"
send_gdb "y\n" send_gdb "y\n"
catch "system \"chmod -f +w dir2.fileio.test\"" remote_exec build "test -r dir2.fileio.test && chmod -f +w dir2.fileio.test"
catch "system \"rm -rf *.fileio.test\"" remote_exec build "rm -rf *.fileio.test"
set timeout $oldtimeout set timeout $oldtimeout
return 0 return 0