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]

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


MIPS testing for 2.17 showed, in addition to failures known from 2.16
or other architectures, and a couple of new failures where the test or
the relevant bit of it was new but the cause was the same as other
previously known failures, unexpected failures of
stdio-common/tst-put-error ("padded fprintf succeeded").

The test checks for errors being detected when writing 10000 bytes of
padded string with fprintf.  This will only occur if the bytes do not
fit in stdio buffers so an attempt is actually made to write them out.
The file in question is on /tmp (before the file descriptor is closed
to cause the errors to occur) and the buffer size is determined by
libio from the block size for that file.  When /tmp is a tmpfs
filesystem, as on the test systems I'm using for MIPS, the block size
is the kernel's page size - which is 16384 bytes in this case.

It appears the Linux kernel has various cases with page sizes up to at
least 1MB.  This patch changes the test to use a width of 10000000
instead of 10000, hopefully covering all the likely cases of larger
page sizes causing this test to fail.

Tested x86_64 and x86, and on MIPS that this does fix the observed
failure.

2012-12-05  Joseph Myers  <joseph@codesourcery.com>

	* stdio-common/tst-put-error.c (do_test): Use 10000000 instead of
	10000 as width of padded output.

diff --git a/stdio-common/tst-put-error.c b/stdio-common/tst-put-error.c
index 7b95491..5209cce 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, "%10000s", "foo");
+  n = fprintf (fp, "%10000000s", "foo");
   printf ("fprintf = %d\n", n);
   if (n >= 0)
     error (EXIT_FAILURE, 0, "padded fprintf succeeded");

-- 
Joseph S. Myers
joseph@codesourcery.com


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