]> git.ipfire.org Git - thirdparty/glibc.git/commit
Add more thorough tests of freopen
authorJoseph Myers <josmyers@redhat.com>
Wed, 4 Sep 2024 16:32:21 +0000 (16:32 +0000)
committerJoseph Myers <josmyers@redhat.com>
Wed, 4 Sep 2024 16:32:21 +0000 (16:32 +0000)
commited4bb289cf739f537deb735eaa01be531df084b9
tree4f72104640ca6f2e3edb79b676401fe2749233d4
parentae4d44b1d501421ad9a3af95279b8f4d1546f1ce
Add more thorough tests of freopen

freopen is rather minimally tested in libio/tst-freopen and
libio/test-freopen.  Add some more thorough tests, covering different
cases for change of mode in particular.  The tests are run for both
freopen and freopen64 (given that those functions have two separate
copies of much of the code, so any bug fix directly in the freopen
code would probably need applying in both places).

Note that there are two parts of the tests disabled because of bugs
discovered through running the tests, with bug numbers given in
comments.  I expect to address those separately.  The tests also don't
cover changes to cancellation ("c" in mode); I think that will better
be handled through a separate test.  Also to handle separately:
testing on stdin / stdout / stderr; documenting lack of support for
streams opened with popen / fmemopen / open_memstream / fopencookie;
maybe also a chroot test without /proc; maybe also more thorough tests
for large file handling on 32-bit systems (freopen64).

Tested for x86_64.
stdio-common/Makefile
stdio-common/tst-freopen2-main.c [new file with mode: 0644]
stdio-common/tst-freopen2.c [new file with mode: 0644]
stdio-common/tst-freopen3-main.c [new file with mode: 0644]
stdio-common/tst-freopen3.c [new file with mode: 0644]
stdio-common/tst-freopen64-2.c [new file with mode: 0644]
stdio-common/tst-freopen64-3.c [new file with mode: 0644]