Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: force output at predictable points in ending-run.c
@ 2002-01-11 22:51 Jim Blandy
  2002-01-20 16:25 ` Andrew Cagney
  2002-01-21  8:31 ` Fernando Nasser
  0 siblings, 2 replies; 4+ messages in thread
From: Jim Blandy @ 2002-01-11 22:51 UTC (permalink / raw)
  To: gdb-patches


2002-01-12  Jim Blandy  <jimb@redhat.com>

	* gdb.base/ending-run.c (main): Avoid messing with setvbuf; just
	call `fflush' after every `printf', so that the output is produced
	at predictable points, regardless of whatever buffering does (or
	doesn't) take place.
	* gdb.base/ending-run.exp: Adjust tests to expect output to appear
	at different points.

Index: gdb/testsuite/gdb.base/ending-run.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.c,v
retrieving revision 1.4
diff -c -r1.4 ending-run.c
*** gdb/testsuite/gdb.base/ending-run.c	2001/09/18 17:50:36	1.4
--- gdb/testsuite/gdb.base/ending-run.c	2002/01/12 06:47:54
***************
*** 22,33 ****
      int i;
  
      p = (int *) malloc( 4 );
!     setvbuf (stdout, alloca (64), _IOLBF, 64);
      for (i = 1; i < 10; i++)
          {
              printf( "%d ", callee( i ));
!             
          }
!     printf( " Goodbye!\n" );
      return 0;
  }
--- 22,33 ----
      int i;
  
      p = (int *) malloc( 4 );
! 
      for (i = 1; i < 10; i++)
          {
              printf( "%d ", callee( i ));
!             fflush (stdout);
          }
!     printf( " Goodbye!\n" ); fflush (stdout);
      return 0;
  }
Index: gdb/testsuite/gdb.base/ending-run.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.exp,v
retrieving revision 1.23
diff -c -r1.23 ending-run.exp
*** gdb/testsuite/gdb.base/ending-run.exp	2001/11/10 22:27:26	1.23
--- gdb/testsuite/gdb.base/ending-run.exp	2002/01/12 06:47:54
***************
*** 129,138 ****
  # See if we can step out with control.  The "1 2 3" stuff
  # is output from the program.
  #
! gdb_test "cont" ".*Breakpoint.*31.*"
  
  if ![gdb_skip_stdio_test "Step to return"] {
!     gdb_test "next" ".*1 2 7 14 23 34 47 62 79  Goodbye!.*32.*" \
  	    "Step to return"
  } else {
      gdb_test "next" "" ""
--- 129,138 ----
  # See if we can step out with control.  The "1 2 3" stuff
  # is output from the program.
  #
! gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*31.*"
  
  if ![gdb_skip_stdio_test "Step to return"] {
!     gdb_test "next" ".*Goodbye!.*32.*" \
  	    "Step to return"
  } else {
      gdb_test "next" "" ""


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: force output at predictable points in ending-run.c
  2002-01-11 22:51 RFA: force output at predictable points in ending-run.c Jim Blandy
@ 2002-01-20 16:25 ` Andrew Cagney
  2002-01-21  8:31 ` Fernando Nasser
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-01-20 16:25 UTC (permalink / raw)
  To: Jim Blandy, Fernando Nasser; +Cc: gdb-patches

> 2002-01-12  Jim Blandy  <jimb@redhat.com>
> 
> * gdb.base/ending-run.c (main): Avoid messing with setvbuf; just
> 	call `fflush' after every `printf', so that the output is produced
> 	at predictable points, regardless of whatever buffering does (or
> 	doesn't) take place.
> 	* gdb.base/ending-run.exp: Adjust tests to expect output to appear
> 	at different points.
> 
> Index: gdb/testsuite/gdb.base/ending-run.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.c,v
> retrieving revision 1.4
> diff -c -r1.4 ending-run.c
> *** gdb/testsuite/gdb.base/ending-run.c	2001/09/18 17:50:36	1.4
> --- gdb/testsuite/gdb.base/ending-run.c	2002/01/12 06:47:54
> ***************
> *** 22,33 ****
>       int i;
>   
>       p = (int *) malloc( 4 );
> !     setvbuf (stdout, alloca (64), _IOLBF, 64);
>       for (i = 1; i < 10; i++)
>           {
>               printf( "%d ", callee( i ));
> !             
>           }
> !     printf( " Goodbye!\n" );
>       return 0;
>   }
> --- 22,33 ----
>       int i;
>   
>       p = (int *) malloc( 4 );
> ! 
>       for (i = 1; i < 10; i++)
>           {
>               printf( "%d ", callee( i ));
> !             fflush (stdout);
>           }
> !     printf( " Goodbye!\n" ); fflush (stdout);
>       return 0;
>   }
> Index: gdb/testsuite/gdb.base/ending-run.exp
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.exp,v
> retrieving revision 1.23
> diff -c -r1.23 ending-run.exp
> *** gdb/testsuite/gdb.base/ending-run.exp	2001/11/10 22:27:26	1.23
> --- gdb/testsuite/gdb.base/ending-run.exp	2002/01/12 06:47:54
> ***************
> *** 129,138 ****
>   # See if we can step out with control.  The "1 2 3" stuff
>   # is output from the program.
>   #
> ! gdb_test "cont" ".*Breakpoint.*31.*"
>   
>   if ![gdb_skip_stdio_test "Step to return"] {
> !     gdb_test "next" ".*1 2 7 14 23 34 47 62 79  Goodbye!.*32.*" \
>   	    "Step to return"
>   } else {
>       gdb_test "next" "" ""
> --- 129,138 ----
>   # See if we can step out with control.  The "1 2 3" stuff
>   # is output from the program.
>   #
> ! gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*31.*"
>   
>   if ![gdb_skip_stdio_test "Step to return"] {
> !     gdb_test "next" ".*Goodbye!.*32.*" \
>   	    "Step to return"
>   } else {
>       gdb_test "next" "" ""
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: force output at predictable points in ending-run.c
  2002-01-11 22:51 RFA: force output at predictable points in ending-run.c Jim Blandy
  2002-01-20 16:25 ` Andrew Cagney
@ 2002-01-21  8:31 ` Fernando Nasser
  2002-01-21 14:12   ` Jim Blandy
  1 sibling, 1 reply; 4+ messages in thread
From: Fernando Nasser @ 2002-01-21  8:31 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

Let's see if your fix makes this test results more predictable.

Pleas check it in and thanks for looking into this.

Regards,
Fernando

Jim Blandy wrote:
> 
> 2002-01-12  Jim Blandy  <jimb@redhat.com>
> 
>         * gdb.base/ending-run.c (main): Avoid messing with setvbuf; just
>         call `fflush' after every `printf', so that the output is produced
>         at predictable points, regardless of whatever buffering does (or
>         doesn't) take place.
>         * gdb.base/ending-run.exp: Adjust tests to expect output to appear
>         at different points.
> 
> Index: gdb/testsuite/gdb.base/ending-run.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.c,v
> retrieving revision 1.4
> diff -c -r1.4 ending-run.c
> *** gdb/testsuite/gdb.base/ending-run.c 2001/09/18 17:50:36     1.4
> --- gdb/testsuite/gdb.base/ending-run.c 2002/01/12 06:47:54
> ***************
> *** 22,33 ****
>       int i;
> 
>       p = (int *) malloc( 4 );
> !     setvbuf (stdout, alloca (64), _IOLBF, 64);
>       for (i = 1; i < 10; i++)
>           {
>               printf( "%d ", callee( i ));
> !
>           }
> !     printf( " Goodbye!\n" );
>       return 0;
>   }
> --- 22,33 ----
>       int i;
> 
>       p = (int *) malloc( 4 );
> !
>       for (i = 1; i < 10; i++)
>           {
>               printf( "%d ", callee( i ));
> !             fflush (stdout);
>           }
> !     printf( " Goodbye!\n" ); fflush (stdout);
>       return 0;
>   }
> Index: gdb/testsuite/gdb.base/ending-run.exp
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.exp,v
> retrieving revision 1.23
> diff -c -r1.23 ending-run.exp
> *** gdb/testsuite/gdb.base/ending-run.exp       2001/11/10 22:27:26     1.23
> --- gdb/testsuite/gdb.base/ending-run.exp       2002/01/12 06:47:54
> ***************
> *** 129,138 ****
>   # See if we can step out with control.  The "1 2 3" stuff
>   # is output from the program.
>   #
> ! gdb_test "cont" ".*Breakpoint.*31.*"
> 
>   if ![gdb_skip_stdio_test "Step to return"] {
> !     gdb_test "next" ".*1 2 7 14 23 34 47 62 79  Goodbye!.*32.*" \
>             "Step to return"
>   } else {
>       gdb_test "next" "" ""
> --- 129,138 ----
>   # See if we can step out with control.  The "1 2 3" stuff
>   # is output from the program.
>   #
> ! gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*31.*"
> 
>   if ![gdb_skip_stdio_test "Step to return"] {
> !     gdb_test "next" ".*Goodbye!.*32.*" \
>             "Step to return"
>   } else {
>       gdb_test "next" "" ""

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: force output at predictable points in ending-run.c
  2002-01-21  8:31 ` Fernando Nasser
@ 2002-01-21 14:12   ` Jim Blandy
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Blandy @ 2002-01-21 14:12 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb-patches

Fernando Nasser <fnasser@redhat.com> writes:
> Let's see if your fix makes this test results more predictable.
> 
> Pleas check it in and thanks for looking into this.

Done, thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-01-21 22:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-11 22:51 RFA: force output at predictable points in ending-run.c Jim Blandy
2002-01-20 16:25 ` Andrew Cagney
2002-01-21  8:31 ` Fernando Nasser
2002-01-21 14:12   ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox