mbox series

[v2,0/1] stdio-common: Add more tests of the setvbuf() function.

Message ID 8734llkrdd.fsf@redhat.com
Headers show
Series stdio-common: Add more tests of the setvbuf() function. | expand

Message

Nick Clifton Sept. 27, 2024, 4:12 p.m. UTC
Hi Everyone,

As part of ongoing work at Red Hat to improve the quality of the glibc
testsuite I am submitting this patch to extend the test coverage of
the setvbuf() function.  The current test (tst-setvbuf1.c) only checks
that full buffering can be enabled on stderr.  The new tests extend
this to cover line buffering and no buffering for stderr and stdout
as well as buffering for non-terminal I/O files.

There is one issue however.  One of the new tests fails.
tst-setvbuf4.c attempts to check that when full buffering is enabled
on a non-terminal file, writing a single byte to the file does not
cause the byte to appear in the file.  (At least not until a flush or
some other similar file operation is performed).  The test however
shows that the byte *does* appear.

The test is correct I believe, and I think that it does indicate that
there is a underlying bug in glibc's file buffering mechanisms.  But
knowledge of glibc's code base is insufficient to allow me to say
where or why.

It is possible that the same bug is affecting the tst-setvbuf5.c which
checks that line buffering on non-terminal files works.  But the POSIX
standard explicitly states that line buffering does not have to work
for these kind of files, so the test does not fail if line buffering
is found to be unsupported.

Cheers
  Nick

PS  As a new contributor I just wish to confirm that as an engineer
working at Red Hat this contribution is covered by a blanket FSF
copyright assignment.

Nick Clifton (1):
  stdio-common: Add more tests of the setvbuf() function.

 stdio-common/Makefile            |  23 +++++
 stdio-common/tst-setvbuf2.c      |  85 +++++++++++++++
 stdio-common/tst-setvbuf2.expect |   3 +
 stdio-common/tst-setvbuf3.c      | 111 ++++++++++++++++++++
 stdio-common/tst-setvbuf3.expect |   3 +
 stdio-common/tst-setvbuf4.c      | 154 ++++++++++++++++++++++++++++
 stdio-common/tst-setvbuf5.c      | 171 +++++++++++++++++++++++++++++++
 stdio-common/tst-setvbuf6.c      | 136 ++++++++++++++++++++++++
 8 files changed, 686 insertions(+)
 create mode 100644 stdio-common/tst-setvbuf2.c
 create mode 100644 stdio-common/tst-setvbuf2.expect
 create mode 100644 stdio-common/tst-setvbuf3.c
 create mode 100644 stdio-common/tst-setvbuf3.expect
 create mode 100644 stdio-common/tst-setvbuf4.c
 create mode 100644 stdio-common/tst-setvbuf5.c
 create mode 100644 stdio-common/tst-setvbuf6.c