[PATCH] libio: Add test case for fflush
Frederic Berat
fberat@redhat.com
Tue Oct 22 14:37:56 GMT 2024
On Tue, Oct 22, 2024 at 4:15 PM Florian Weimer <fweimer@redhat.com> wrote:
> * Frédéric Bérat:
>
> > + TEST_VERIFY_EXIT (fstat (files[to_check].fd, &stats) >= 0);
> > + TEST_VERIFY_EXIT (stats.st_size == 3);
>
> I think we should add one more test here:
>
> TEST_COMPARE (lseek (files[to_check].fd, 0, SEEK_CUR), 3);
>
> Is there a reason why you do not test the behavior on read-only and
> read-write streams? Even for read-only streams and read-write streams
> that are currently reading, there is an observable file position update
> on the underlying file description (just like above for streams written
> to), and any pending ungetc calls are cancelled.
>
I actually assumed it was already covered by unget{w}c tests. But I may
have been wrong.
>
> I think fflush (NULL) currently does not flush read-only streams at
> least, so we do have bugs here.
>
Ok, I'll have a look.
>
> Thanks,
> Florian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20241022/1b59333f/attachment.htm>
More information about the Libc-alpha
mailing list