This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[m68k] adjust some tests


This patch adjusts a couple of tests, removing spurious failures.

Coldfire has no jbsr instruction, so I changed the assembler test to use a jsr, which is valid on both coldfire & m68k

The charset.exp test would spuriously fail because the previous test left $pc in what was now malloc. Therefore the 'break 150' line would be interpretted as a line in malloc's source and not the test program's source

The fileio tests were failing because we didn't quite stop where we expected in the source (that might be a further problem I have to investigate). I decided to robustify the fileio tests by inserting calls to a 'stop' routine, and having a permanent breakpoint there.

ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2006-06-05  Nathan Sidwell  <nathan@codesourcery.com>

	* gdb/testsuite/gdb.asm/m68k.inc (gdbasm_call): Use jsr.
	* gdb/testsuite/gdb.base/fileio.c (stop): New.  Call it everywhere
	the debugger should stop.
	* gdb/testsuite/gdb.base/fileio.exp: Add breakpoint to stop
	routine and adjust.
	* gdb/testsuite/gdb.base/charset.exp: Specify source file for
	breakpoint address.

Index: gdb/testsuite/gdb.asm/m68k.inc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/m68k.inc,v
retrieving revision 1.2
diff -c -3 -p -r1.2 m68k.inc
*** gdb/testsuite/gdb.asm/m68k.inc	7 Mar 2005 21:16:50 -0000	1.2
--- gdb/testsuite/gdb.asm/m68k.inc	5 Jun 2006 15:29:49 -0000
***************
*** 10,16 ****
  	.endm
  
  	.macro gdbasm_call subr
! 	jbsr	\subr
  	.endm
  
  	.macro gdbasm_several_nops
--- 10,16 ----
  	.endm
  
  	.macro gdbasm_call subr
! 	jsr	\subr
  	.endm
  
  	.macro gdbasm_several_nops
Index: gdb/testsuite/gdb.base/charset.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/charset.exp,v
retrieving revision 1.6
diff -c -3 -p -r1.6 charset.exp
*** gdb/testsuite/gdb.base/charset.exp	13 May 2005 17:36:43 -0000	1.6
--- gdb/testsuite/gdb.base/charset.exp	5 Jun 2006 15:29:49 -0000
*************** foreach host_charset [all_charset_names]
*** 388,394 ****
  # some strings in various target character sets.  We need to run the
  # test program to the point at which the strings have been
  # initialized.
! gdb_test "break [gdb_get_line_number "all strings initialized"]" \
           ".*Breakpoint.* at .*" \
           "set breakpoint after all strings have been initialized"
  gdb_run_cmd
--- 388,394 ----
  # some strings in various target character sets.  We need to run the
  # test program to the point at which the strings have been
  # initialized.
! gdb_test "break charset.c:[gdb_get_line_number "all strings initialized"]" \
           ".*Breakpoint.* at .*" \
           "set breakpoint after all strings have been initialized"
  gdb_run_cmd
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"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]