This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Remove some spurious test fails
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 09 Jun 2006 16:27:39 +0100
- Subject: Remove some spurious test fails
I have a target where, due to a gcc defficiency, one cannot set a breakpoint at
the very end of a function.
This causes problems in the gdb testsuite because several tests presume one can
set a breakpoint or step to the final } of a function. The tests which do this
are not actually testing for that functionality, but merely using it. For my
target, this leads to a lot of spurious test failures.
Although it would be good to fix gcc, that's not practical right now, and I
thought it would be better to defensively code the gdb testsuite anyway. To
that end I
*) added an explicit test in gdb.base/break.exp to test for breaking at the end
of a function. IMHO, that is where such a test belongs
*) recoded the spurious fails to add real code just before the end of the
function in order to guarantee we'd stop there.
*) fileio.exp was one such test, it has a lot of explicit line numbers in the
.exp file, making adjustment of the .c file practically impossible. I've
recoded it so that we have a single breakpoint in a 'stop' routine.
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2006-06-09 Nathan Sidwell <nathan@codesourcery.com>
gdb/testsuite/
* gdb.base/break.c: Add 10a breakpoint at }
* gdb.base/break.exp: Add test for breakpoint at }
* gdb.cp/anon-union.cc: Add code at end of function.
* gdb.cp/anon-union.exp: Adjust end of function breakpoint.
* gdb.mi/var-cmd.c: Add code at end of function.
* gdb.mi/mi-var-display.exp: Adjust end of next.
* gdb.mi/mi2-var-display.exp: Likewise.
* gdb.base/fileio.c: Add stop function and insert calls at
stopping places.
* gdb.base/fileio.exp: Breakpoint stop function and remove
explicit line number references.
Index: gdb/testsuite/gdb.base/break.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 break.c
*** gdb/testsuite/gdb.base/break.c 9 Dec 2003 18:19:20 -0000 1.4
--- gdb/testsuite/gdb.base/break.c 9 Jun 2006 15:12:56 -0000
*************** char *argv[], **envp;
*** 99,105 ****
marker4 (177601976L);
argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
return argc; /* set breakpoint 10 here */
! }
#ifdef PROTOTYPES
int factorial (int value)
--- 99,105 ----
marker4 (177601976L);
argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
return argc; /* set breakpoint 10 here */
! } /* set breakpoint 10a here */
#ifdef PROTOTYPES
int factorial (int value)
Index: gdb/testsuite/gdb.base/break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v
retrieving revision 1.20.6.1
diff -c -3 -p -r1.20.6.1 break.exp
*** gdb/testsuite/gdb.base/break.exp 7 Mar 2006 15:48:33 -0000 1.20.6.1
--- gdb/testsuite/gdb.base/break.exp 9 Jun 2006 15:12:56 -0000
*************** gdb_test "step" \
*** 262,267 ****
--- 262,278 ----
".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \
"step onto breakpoint"
+ # Check to see if breakpoint can be set on ending brace of function
+ set bp_location10a [gdb_get_line_number "set breakpoint 10a here"]
+
+ gdb_test "break $bp_location10a" \
+ "Breakpoint.*at.* file .*$srcfile, line $bp_location10a\\." \
+ "setting breakpoint at }"
+
+ gdb_test "continue" \
+ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10a.*$bp_location10a\[\t \]+}.*breakpoint 10a here.*" \
+ "continue to breakpoint at }"
+
#
# delete all breakpoints so we can start over, course this can be a test too
#
Index: gdb/testsuite/gdb.cp/anon-union.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/anon-union.cc,v
retrieving revision 1.1
diff -c -3 -p -r1.1 anon-union.cc
*** gdb/testsuite/gdb.cp/anon-union.cc 23 Aug 2003 03:55:59 -0000 1.1
--- gdb/testsuite/gdb.cp/anon-union.cc 9 Jun 2006 15:12:57 -0000
*************** int main()
*** 52,55 ****
--- 52,56 ----
w = 45;
+ int j = 0;
}
Index: gdb/testsuite/gdb.cp/anon-union.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/anon-union.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 anon-union.exp
*** gdb/testsuite/gdb.cp/anon-union.exp 11 Feb 2004 14:01:25 -0000 1.2
--- gdb/testsuite/gdb.cp/anon-union.exp 9 Jun 2006 15:12:57 -0000
*************** gdb_expect {
*** 288,294 ****
# Step over next assignment to w
send_gdb "next\n"
gdb_expect {
! -re "55\[ \t\]*\}\r\n$gdb_prompt $" {
pass "next 4"
}
-re ".*$gdb_prompt $" { fail "next 4" }
--- 288,294 ----
# Step over next assignment to w
send_gdb "next\n"
gdb_expect {
! -re "55\[ \t\]*int j = 0;\r\n$gdb_prompt $" {
pass "next 4"
}
-re ".*$gdb_prompt $" { fail "next 4" }
Index: gdb/testsuite/gdb.mi/mi-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-display.exp,v
retrieving revision 1.13.10.1
diff -c -3 -p -r1.13.10.1 mi-var-display.exp
*** gdb/testsuite/gdb.mi/mi-var-display.exp 3 May 2006 17:54:32 -0000 1.13.10.1
--- gdb/testsuite/gdb.mi/mi-var-display.exp 9 Jun 2006 15:12:58 -0000
*************** mi_delete_breakpoints
*** 40,55 ****
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
! set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1]
! mi_gdb_test "200-break-insert $line_dct_close_brace" \
! "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
# The running part has been checked already by mi_run_cmd
gdb_expect {
! -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
--- 40,55 ----
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
! set line_dct_end [gdb_get_line_number "{int a = 0;}"]
! mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
! "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
# The running part has been checked already by mi_run_cmd
gdb_expect {
! -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_dct_end\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
Index: gdb/testsuite/gdb.mi/mi2-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-var-display.exp,v
retrieving revision 1.5.10.1
diff -c -3 -p -r1.5.10.1 mi2-var-display.exp
*** gdb/testsuite/gdb.mi/mi2-var-display.exp 3 May 2006 17:54:32 -0000 1.5.10.1
--- gdb/testsuite/gdb.mi/mi2-var-display.exp 9 Jun 2006 15:12:58 -0000
*************** mi_delete_breakpoints
*** 40,55 ****
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
! set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1]
! mi_gdb_test "200-break-insert $line_dct_close_brace" \
! "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
# The running part has been checked already by mi_run_cmd
gdb_expect {
! -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
--- 40,55 ----
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
! set line_dct_end [gdb_get_line_number "{int a = 0;}"]
! mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
! "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
# The running part has been checked already by mi_run_cmd
gdb_expect {
! -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_end\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
Index: gdb/testsuite/gdb.mi/var-cmd.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/var-cmd.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 var-cmd.c
*** gdb/testsuite/gdb.mi/var-cmd.c 31 Jul 2005 21:24:25 -0000 1.5
--- gdb/testsuite/gdb.mi/var-cmd.c 9 Jun 2006 15:12:58 -0000
*************** do_children_tests (void)
*** 278,283 ****
--- 278,284 ----
snp0.long_ptr = &y3;
snp1.long_ptr = &x3;
snp2.long_ptr = &z3;
+ {int a = 0;}
}
void
Index: gdb/testsuite/gdb.base/fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 fileio.c
*** gdb/testsuite/gdb.base/fileio.c 10 Jan 2005 15:58:23 -0000 1.8
--- gdb/testsuite/gdb.base/fileio.c 5 Jun 2006 15:29:49 -0000
*************** static const char *strerrno (int err);
*** 68,73 ****
--- 68,75 ----
#define STRING "Hello World"
+ static void stop () {}
+
int
test_open ()
{
*************** test_open ()
*** 78,85 ****
--- 80,89 ----
ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR);
printf ("open 1: ret = %d, errno = %d %s\n", ret, errno,
ret >= 0 ? "OK" : "");
+
if (ret >= 0)
close (ret);
+ stop ();
/* Creating an already existing file (created by fileio.exp) */
errno = 0;
ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR);
*************** test_open ()
*** 87,92 ****
--- 91,97 ----
strerrno (errno));
if (ret >= 0)
close (ret);
+ stop ();
/* Open directory (for writing) */
errno = 0;
ret = open (".", O_WRONLY);
*************** test_open ()
*** 94,99 ****
--- 99,105 ----
strerrno (errno));
if (ret >= 0)
close (ret);
+ stop ();
/* Opening nonexistant file */
errno = 0;
ret = open (NONEXISTANT, O_RDONLY);
*************** test_open ()
*** 101,112 ****
--- 107,120 ----
strerrno (errno));
if (ret >= 0)
close (ret);
+ stop ();
/* Open for write but no write permission */
errno = 0;
ret = open (NOWRITE, O_CREAT | O_RDONLY, S_IRUSR);
if (ret >= 0)
{
close (ret);
+ stop ();
errno = 0;
ret = open (NOWRITE, O_WRONLY);
printf ("open 5: ret = %d, errno = %d %s\n", ret, errno,
*************** test_open ()
*** 115,121 ****
close (ret);
}
else
! printf ("open 5: ret = %d, errno = %d\n", ret, errno);
}
int
--- 123,133 ----
close (ret);
}
else
! {
! stop ();
! printf ("open 5: ret = %d, errno = %d\n", ret, errno);
! }
! stop ();
}
int
*************** test_write ()
*** 136,146 ****
--- 148,160 ----
}
else
printf ("write 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* Write using invalid file descriptor */
errno = 0;
ret = write (999, STRING, strlen (STRING));
printf ("write 2: ret = %d, errno = %d, %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* Write to a read-only file */
errno = 0;
fd = open (FILENAME, O_RDONLY);
*************** test_write ()
*** 153,158 ****
--- 167,173 ----
}
else
printf ("write 3: ret = %d, errno = %d\n", ret, errno);
+ stop ();
}
int
*************** test_read ()
*** 178,188 ****
--- 193,205 ----
}
else
printf ("read 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* Read using invalid file descriptor */
errno = 0;
ret = read (999, buf, 16);
printf ("read 2: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_lseek ()
*** 200,209 ****
--- 217,228 ----
ret = lseek (fd, 0, SEEK_CUR);
printf ("lseek 1: ret = %ld, errno = %d, %s\n", (long) ret, errno,
ret == 0 ? "OK" : "");
+ stop ();
errno = 0;
ret = lseek (fd, 0, SEEK_END);
printf ("lseek 2: ret = %ld, errno = %d, %s\n", (long) ret, errno,
ret == 11 ? "OK" : "");
+ stop ();
errno = 0;
ret = lseek (fd, 3, SEEK_SET);
printf ("lseek 3: ret = %ld, errno = %d, %s\n", (long) ret, errno,
*************** test_lseek ()
*** 212,223 ****
}
else
{
! printf ("lseek 1: ret = %d, errno = %d\n", ret, errno);
! printf ("lseek 2: ret = %d, errno = %d\n", ret, errno);
! printf ("lseek 3: ret = %d, errno = %d\n", ret, errno);
}
/* Seeking on an invalid file descriptor */
!
}
int
--- 231,247 ----
}
else
{
! printf ("lseek 1: ret = %d, errno = %d %s\n", ret, errno,
! strerrno (errno));
! stop ();
! printf ("lseek 2: ret = %d, errno = %d %s\n", ret, errno,
! strerrno (errno));
! stop ();
! printf ("lseek 3: ret = %d, errno = %d %s\n", ret, errno,
! strerrno (errno));
}
/* Seeking on an invalid file descriptor */
! stop ();
}
int
*************** test_close ()
*** 237,247 ****
--- 261,273 ----
}
else
printf ("close 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* Close an invalid file descriptor */
errno = 0;
ret = close (999);
printf ("close 2: ret = %d, errno = %d, %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_stat ()
*** 258,278 ****
--- 284,308 ----
st.st_size == 11 ? "OK" : "");
else
printf ("stat 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* NULL pathname */
errno = 0;
ret = stat (NULL, &st);
printf ("stat 2: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* Empty pathname */
errno = 0;
ret = stat ("", &st);
printf ("stat 3: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* Nonexistant file */
errno = 0;
ret = stat (NONEXISTANT, &st);
printf ("stat 4: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_fstat ()
*** 297,307 ****
--- 327,339 ----
}
else
printf ("fstat 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* Fstat using invalid file descriptor */
errno = 0;
ret = fstat (999, &st);
printf ("fstat 2: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_isatty ()
*** 311,320 ****
--- 343,356 ----
/* Check std I/O */
printf ("isatty 1: stdin %s\n", isatty (0) ? "yes OK" : "no");
+ stop ();
printf ("isatty 2: stdout %s\n", isatty (1) ? "yes OK" : "no");
+ stop ();
printf ("isatty 3: stderr %s\n", isatty (2) ? "yes OK" : "no");
+ stop ();
/* Check invalid fd */
printf ("isatty 4: invalid %s\n", isatty (999) ? "yes" : "no OK");
+ stop ();
/* Check open file */
fd = open (FILENAME, O_RDONLY);
if (fd >= 0)
*************** test_isatty ()
*** 324,329 ****
--- 360,366 ----
}
else
printf ("isatty 5: file couldn't open\n");
+ stop ();
}
*************** test_system ()
*** 343,351 ****
--- 380,390 ----
printf ("system 1: ret = %d /bin/sh unavailable???\n", ret);
else
printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
+ stop ();
/* Invalid command (just guessing ;-) ) */
ret = system ("wrtzlpfrmpft");
printf ("system 2: ret = %d %s\n", ret, WEXITSTATUS (ret) == 127 ? "OK" : "");
+ stop ();
}
int
*************** test_rename ()
*** 374,399 ****
--- 413,443 ----
}
else
printf ("rename 1: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* newpath is existing directory, oldpath is not a directory */
errno = 0;
ret = rename (RENAMED, TESTDIR2);
printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* newpath is a non-empty directory */
errno = 0;
ret = rename (TESTDIR2, TESTDIR1);
printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* newpath is a subdirectory of old path */
errno = 0;
ret = rename (TESTDIR1, TESTSUBDIR);
printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* oldpath does not exist */
errno = 0;
ret = rename (NONEXISTANT, FILENAME);
printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_unlink ()
*** 408,413 ****
--- 452,458 ----
ret = unlink (RENAMED);
printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
/* No write access */
sprintf (name, "%s/%s", TESTDIR2, FILENAME);
errno = 0;
*************** test_unlink ()
*** 428,438 ****
--- 473,485 ----
}
else
printf ("unlink 2: ret = %d, errno = %d\n", ret, errno);
+ stop ();
/* pathname doesn't exist */
errno = 0;
ret = unlink (NONEXISTANT);
printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno,
strerrno (errno));
+ stop ();
}
int
*************** test_time ()
*** 443,452 ****
--- 490,501 ----
errno = 0;
ret = time (&t);
printf ("time 1: ret = %ld, errno = %d, t = %ld %s\n", (long) ret, errno, (long) t, ret == t ? "OK" : "");
+ stop ();
errno = 0;
ret = time (NULL);
printf ("time 2: ret = %ld, errno = %d, t = %ld %s\n",
(long) ret, errno, (long) t, ret >= t && ret < t + 10 ? "OK" : "");
+ stop ();
}
static const char *
Index: gdb/testsuite/gdb.base/fileio.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.exp,v
retrieving revision 1.7
diff -c -3 -p -r1.7 fileio.exp
*** gdb/testsuite/gdb.base/fileio.exp 18 Jan 2004 21:17:57 -0000 1.7
--- gdb/testsuite/gdb.base/fileio.exp 5 Jun 2006 15:29:49 -0000
*************** if ![runto_main] then {
*** 69,227 ****
continue
}
! send_gdb "tbreak 81\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*open 1:.*OK.*test_open \\(\\) at.*$srcfile:81.*" \
"Open a file"
- send_gdb "tbreak 88\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*open 2:.*EEXIST.*test_open \\(\\) at.*$srcfile:88.*" \
"Creating already existing file returns EEXIST"
- send_gdb "tbreak 95\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*open 3:.*EISDIR.*test_open \\(\\) at.*$srcfile:95.*" \
"Open directory for writing returns EISDIR"
- send_gdb "tbreak 102\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*open 4:.*ENOENT.*test_open \\(\\) at.*$srcfile:102.*" \
"Opening nonexistant file returns ENOENT"
- send_gdb "tbreak 109\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
catch "system \"chmod -f -w nowrt.fileio.test\""
- send_gdb "tbreak 119\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*open 5:.*EACCES.*test_open \\(\\) at.*$srcfile:119.*" \
"Open for write but no write permission returns EACCES"
- send_gdb "tbreak 140\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*write 1:.*OK.*test_write \\(\\) at.*$srcfile:140.*" \
"Writing to a file"
- send_gdb "tbreak 145\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*write 2:.*EBADF.*test_write \\(\\) at.*$srcfile:145.*" \
"Write using invalid file descriptor returns EBADF"
- send_gdb "tbreak 156\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*write 3:.*EBADF.*test_write \\(\\) at.*$srcfile:156.*" \
"Writing to a read-only file returns EBADF"
- send_gdb "tbreak 182\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*read 1:.*OK.*test_read \\(\\) at.*$srcfile:182.*" \
"Reading from a file"
- send_gdb "tbreak 186\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*read 2:.*EBADF.*test_read \\(\\) at.*$srcfile:186.*" \
"Read using invalid file descriptor returns EBADF"
- send_gdb "tbreak 221\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*lseek 1:.*OK.*lseek 2:.*OK.*lseek 3:.*OK.*test_lseek \\(\\) at.*$srcfile:221.*" \
! "Lseeking a file"
- send_gdb "tbreak 241\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*close 1:.*OK.*test_close \\(\\) at.*$srcfile:241.*" \
"Closing a file"
- send_gdb "tbreak 245\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*close 2:.*EBADF.*test_close \\(\\) at.*$srcfile:245.*" \
"Closing an invalid file descriptor returns EBADF"
- send_gdb "tbreak 262\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*stat 1:.*OK.*test_stat \\(\\) at.*$srcfile:262.*" \
"Stat a file"
- send_gdb "tbreak 267\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*stat 2:.*(ENOENT|EFAULT).*test_stat \\(\\) at.*$srcfile:267.*" \
"Stat a NULL pathname returns ENOENT or EFAULT"
- send_gdb "tbreak 272\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*stat 3:.*ENOENT.*test_stat \\(\\) at.*$srcfile:272.*" \
"Stat an empty pathname returns ENOENT"
- send_gdb "tbreak 276\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*stat 4:.*ENOENT.*test_stat \\(\\) at.*$srcfile:276.*" \
"Stat a nonexistant file returns ENOENT"
- send_gdb "tbreak 301\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*fstat 1:.*OK.*test_fstat \\(\\) at.*$srcfile:301.*" \
"Fstat an open file"
- send_gdb "tbreak 305\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*fstat 2:.*EBADF.*test_fstat \\(\\) at.*$srcfile:305.*" \
"Fstat an invalid file descriptor returns EBADF"
- send_gdb "tbreak 314\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*isatty 1:.*OK.*test_isatty \\(\\) at.*$srcfile:314.*" \
"Isatty (stdin)"
- send_gdb "tbreak 315\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*isatty 2:.*OK.*test_isatty \\(\\) at.*$srcfile:315.*" \
"Isatty (stdout)"
- send_gdb "tbreak 317\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*isatty 3:.*OK.*test_isatty \\(\\) at.*$srcfile:317.*" \
"Isatty (stderr)"
- send_gdb "tbreak 319\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*isatty 4:.*OK.*test_isatty \\(\\) at.*$srcfile:319.*" \
"Isatty (invalid fd)"
- send_gdb "tbreak 327\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*isatty 5:.*OK.*test_isatty \\(\\) at.*$srcfile:327.*" \
"Isatty (open file)"
send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $"
- send_gdb "tbreak 347\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*system 1:.*OK.*test_system \\(\\) at.*$srcfile:347.*" \
"System(3) call"
# Is this ok? POSIX says system returns a waitpid status?
- send_gdb "tbreak 349\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*system 2:.*OK.*test_system \\(\\) at.*$srcfile:349.*" \
"System with invalid command returns 127"
- send_gdb "tbreak 378\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*rename 1:.*OK.*test_rename \\(\\) at.*$srcfile:378.*" \
"Rename a file"
- send_gdb "tbreak 383\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*rename 2:.*EISDIR.*test_rename \\(\\) at.*$srcfile:383.*" \
"Renaming a file to existing directory returns EISDIR"
- send_gdb "tbreak 388\n" ; gdb_expect -re "$gdb_prompt $"
set test "Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST"
gdb_test_multiple continue "${test}" {
! -re "Continuing\\..*rename 3:.*(ENOTEMPTY|EEXIST).*test_rename \\(\\) at.*$srcfile:388.*$gdb_prompt $" {
pass "${test}"
}
! -re "Continuing\\..*rename 3:.*EBUSY.*test_rename \\(\\) at.*$srcfile:388.*$gdb_prompt $" {
# At least version <= 2.6/2004-01-08 of the Linux Kernel gets
# this wrong (reporting EBUSY) when the file system is NFS
# mounted.
--- 69,209 ----
continue
}
! send_gdb "break stop\n" ; gdb_expect -re "Breakpoint .*$srcfile.*$gdb_prompt $"
! set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(\\) {}.*"
!
gdb_test continue \
! "Continuing\\..*open 1:.*OK$stop_msg" \
"Open a file"
gdb_test continue \
! "Continuing\\..*open 2:.*EEXIST$stop_msg" \
"Creating already existing file returns EEXIST"
gdb_test continue \
! "Continuing\\..*open 3:.*EISDIR$stop_msg" \
"Open directory for writing returns EISDIR"
gdb_test continue \
! "Continuing\\..*open 4:.*ENOENT$stop_msg" \
"Opening nonexistant file returns ENOENT"
send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
catch "system \"chmod -f -w nowrt.fileio.test\""
gdb_test continue \
! "Continuing\\..*open 5:.*EACCES$stop_msg" \
"Open for write but no write permission returns EACCES"
gdb_test continue \
! "Continuing\\..*write 1:.*OK$stop_msg" \
"Writing to a file"
gdb_test continue \
! "Continuing\\..*write 2:.*EBADF$stop_msg" \
"Write using invalid file descriptor returns EBADF"
gdb_test continue \
! "Continuing\\..*write 3:.*EBADF$stop_msg" \
"Writing to a read-only file returns EBADF"
gdb_test continue \
! "Continuing\\..*read 1:.*OK$stop_msg" \
"Reading from a file"
gdb_test continue \
! "Continuing\\..*read 2:.*EBADF$stop_msg" \
"Read using invalid file descriptor returns EBADF"
gdb_test continue \
! "Continuing\\..*lseek 1:.*OK$stop_msg" \
! "Lseeking CUR a file"
!
! gdb_test continue \
! "Continuing\\..*lseek 2:.*OK$stop_msg" \
! "Lseeking END a file"
!
! gdb_test continue \
! "Continuing\\..*lseek 3:.*OK$stop_msg" \
! "Lseeking SET a file"
!
gdb_test continue \
! "Continuing\\..*close 1:.*OK$stop_msg" \
"Closing a file"
gdb_test continue \
! "Continuing\\..*close 2:.*EBADF$stop_msg" \
"Closing an invalid file descriptor returns EBADF"
gdb_test continue \
! "Continuing\\..*stat 1:.*OK$stop_msg" \
"Stat a file"
gdb_test continue \
! "Continuing\\..*stat 2:.*(ENOENT|EFAULT)$stop_msg" \
"Stat a NULL pathname returns ENOENT or EFAULT"
gdb_test continue \
! "Continuing\\..*stat 3:.*ENOENT$stop_msg" \
"Stat an empty pathname returns ENOENT"
gdb_test continue \
! "Continuing\\..*stat 4:.*ENOENT$stop_msg" \
"Stat a nonexistant file returns ENOENT"
gdb_test continue \
! "Continuing\\..*fstat 1:.*OK$stop_msg" \
"Fstat an open file"
gdb_test continue \
! "Continuing\\..*fstat 2:.*EBADF$stop_msg" \
"Fstat an invalid file descriptor returns EBADF"
gdb_test continue \
! "Continuing\\..*isatty 1:.*OK$stop_msg" \
"Isatty (stdin)"
gdb_test continue \
! "Continuing\\..*isatty 2:.*OK$stop_msg" \
"Isatty (stdout)"
gdb_test continue \
! "Continuing\\..*isatty 3:.*OK$stop_msg" \
"Isatty (stderr)"
gdb_test continue \
! "Continuing\\..*isatty 4:.*OK$stop_msg" \
"Isatty (invalid fd)"
gdb_test continue \
! "Continuing\\..*isatty 5:.*OK$stop_msg" \
"Isatty (open file)"
send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*system 1:.*OK$stop_msg" \
"System(3) call"
# Is this ok? POSIX says system returns a waitpid status?
gdb_test continue \
! "Continuing\\..*system 2:.*OK$stop_msg" \
"System with invalid command returns 127"
gdb_test continue \
! "Continuing\\..*rename 1:.*OK$stop_msg" \
"Rename a file"
gdb_test continue \
! "Continuing\\..*rename 2:.*EISDIR$stop_msg" \
"Renaming a file to existing directory returns EISDIR"
set test "Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST"
gdb_test_multiple continue "${test}" {
! -re "Continuing\\..*rename 3:.*(ENOTEMPTY|EEXIST)$stop_msg$gdb_prompt $" {
pass "${test}"
}
! -re "Continuing\\..*rename 3:.*EBUSY$stop_msg$gdb_prompt $" {
# At least version <= 2.6/2004-01-08 of the Linux Kernel gets
# this wrong (reporting EBUSY) when the file system is NFS
# mounted.
*************** gdb_test_multiple continue "${test}" {
*** 230,274 ****
}
}
- send_gdb "tbreak 393\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*rename 4:.*EINVAL.*test_rename \\(\\) at.*$srcfile:393.*" \
"Renaming a directory to a subdir of itself returns EINVAL"
- send_gdb "tbreak 397\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*rename 5:.*ENOENT.*test_rename \\(\\) at.*$srcfile:397.*" \
"Renaming a nonexistant file returns ENOENT"
- send_gdb "tbreak 412\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*unlink 1:.*OK.*test_unlink \\(\\) at.*$srcfile:412.*" \
"Unlink a file"
- send_gdb "tbreak 432\n" ; gdb_expect -re "$gdb_prompt $"
# This test fails on Cygwin because unlink() succeeds on Win32 systems
# in that situation.
if [ishost *cygwin*] {
setup_xfail "*-*-*"
}
gdb_test continue \
! "Continuing\\..*unlink 2:.*EACCES.*test_unlink \\(\\) at.*$srcfile:432.*" \
"Unlinking a file in a directory w/o write access returns EACCES"
- send_gdb "tbreak 436\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*unlink 3:.*ENOENT.*test_unlink \\(\\) at.*$srcfile:436.*" \
"Unlinking a nonexistant file returns ENOENT"
- send_gdb "tbreak 446\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*time 1:.*OK.*test_time \\(\\) at.*$srcfile:446.*" \
"Time(2) call returns the same value as in parameter"
sleep 2
- send_gdb "tbreak 450\n" ; gdb_expect -re "$gdb_prompt $"
gdb_test continue \
! "Continuing\\..*time 2:.*OK.*test_time \\(\\) at.*$srcfile:450.*" \
"Time(2) returns feasible values"
send_gdb "quit\n"
--- 212,249 ----
}
}
gdb_test continue \
! "Continuing\\..*rename 4:.*EINVAL$stop_msg" \
"Renaming a directory to a subdir of itself returns EINVAL"
gdb_test continue \
! "Continuing\\..*rename 5:.*ENOENT$stop_msg" \
"Renaming a nonexistant file returns ENOENT"
gdb_test continue \
! "Continuing\\..*unlink 1:.*OK$stop_msg" \
"Unlink a file"
# This test fails on Cygwin because unlink() succeeds on Win32 systems
# in that situation.
if [ishost *cygwin*] {
setup_xfail "*-*-*"
}
gdb_test continue \
! "Continuing\\..*unlink 2:.*EACCES$stop_msg" \
"Unlinking a file in a directory w/o write access returns EACCES"
gdb_test continue \
! "Continuing\\..*unlink 3:.*ENOENT$stop_msg" \
"Unlinking a nonexistant file returns ENOENT"
gdb_test continue \
! "Continuing\\..*time 1:.*OK$stop_msg" \
"Time(2) call returns the same value as in parameter"
sleep 2
gdb_test continue \
! "Continuing\\..*time 2:.*OK$stop_msg" \
"Time(2) returns feasible values"
send_gdb "quit\n"