[PATCH] Increase the amount of data tested in stdio-common/tst-fwrite-bz29459.c

Florian Weimer fweimer@redhat.com
Mon Feb 10 21:43:33 GMT 2025


* Adhemerval Zanella Netto:

> On 05/02/25 17:24, Tulio Magno Quites Machado Filho wrote:
>> From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
>> 
>> The number of iterations and the length of the string are not high
>> enough on some systems causing the test to return false-positives.
>> 
>> Fixes: 596a61cf6b (libio: Start to return errors when flushing fwrite's buffer [BZ #29459], 2025-01-28)
>> Reported-by: Florian Weimer <fweimer@redhat.com>
>> ---
>>  stdio-common/tst-fwrite-bz29459.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/stdio-common/tst-fwrite-bz29459.c b/stdio-common/tst-fwrite-bz29459.c
>> index 0640faac0c..4fcc4c89e2 100644
>> --- a/stdio-common/tst-fwrite-bz29459.c
>> +++ b/stdio-common/tst-fwrite-bz29459.c
>> @@ -32,7 +32,7 @@
>>  /* Usually this test reproduces in a few iterations.  However, keep a high
>>     number of iterations in order to avoid return false-positives due to an
>>     overwhelmed/slow system.  */
>> -#define ITERATIONS 5000
>> +#define ITERATIONS 500000
>>  
>>  /* The goal of this test is to use fwrite () on a redirected and closed
>>     stdout.  A script will guarantee that stdout is redirected to another
>> @@ -50,7 +50,7 @@ main (void)
>>    size_t rc;
>>    /* Ensure the string we send has a new line because we're dealing
>>       with a lined-buffered stream.  */
>> -  const char *s = "hello\n";
>> +  const char *s = "hello world\n";
>>    const size_t len = strlen(s);
>>  
>>    /* Ensure that fwrite buffers the output before writing to stdout.  */
>
> I am seeing some failures with this testcase:
>
> $ cat stdio-common/tst-fwrite-bz29459.out
> Error: fwrite did not return an error
>
> With a loaded system on a quite recent chip (Ryzen 5900).  Increasing the
> iteration might fix, but I am not sure if this is a long term solution.  
> Can't we make it more reliable without this?

Have you applied the patch?  We saw this as well.  But with the patch, 6
million bytes are written, which I believe exceeds even the most
generous kernel pipe buffer.

Thanks,
Florian



More information about the Libc-alpha mailing list