This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: Increase width of padded output in stdio-common/tst-put-error


On Wed, Dec 05, 2012 at 09:21:47PM +0000, Joseph S. Myers wrote:
> I don't know why the test uses the present approach with setlinebuf.  (To 
> some extent I think this test is illustrating another development 
> guideline: adding new tests to an old testcase is often a bad idea as it 
> can cause what appear to be regressions but aren't.  Any reasons for how 
> things are done in the old (2005) part of the test may not apply to the 
> bit added last month about testing padded printing.)
> 

I just added the test there since it seemed like the right place to
put it - it still does to me.  What's missing in the last bit I added
is the newline that forces the flush due to setlinebuf for the last
case just like the earlier cases, so if it's OK, I'll add it in.

Regards,
Siddhesh

	* stdio-common/tst-put-error.c (do_test): Add newline to the
        padded test to ensure flush.

diff --git a/stdio-common/tst-put-error.c b/stdio-common/tst-put-error.c
index 5209cce..17987d2 100644
--- a/stdio-common/tst-put-error.c
+++ b/stdio-common/tst-put-error.c
@@ -47,7 +47,7 @@ do_test (void)
     error (EXIT_FAILURE, 0, "second fprintf succeeded");
 
   /* Padded printing takes a different code path.  */
-  n = fprintf (fp, "%10000000s", "foo");
+  n = fprintf (fp, "%100s\n", "foo");
   printf ("fprintf = %d\n", n);
   if (n >= 0)
     error (EXIT_FAILURE, 0, "padded fprintf succeeded");

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