]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: testsuite: avoid predictable mkstemp
authorAlexandre Oliva <oliva@adacore.com>
Fri, 24 Jun 2022 02:20:47 +0000 (23:20 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 24 Jun 2022 02:25:52 +0000 (23:25 -0300)
commit2b86788d7c976a261446654166291e855cdc8191
tree328818f19846359012717fd6e9a1d651386b0f43
parent0b2c1781db8df9051ce3d160af2113387742fef2
libstdc++: testsuite: avoid predictable mkstemp

This patch was originally meant to reduce the likelihood that
nonexistent_path() returns the same pathname for from and to.

It was prompted by a target system with a non-random implementation of
mkstemp, that returns a predictable sequence of filenames and selects
the first one that isn't already taken.

That turned out not to be enough: nonexistent_path adds a suffix to
the filename chosen by mkstemp and removes the file it created, so
mkstemp may very well insist on the same basename, and the case that
doesn't use mkstemp doesn't even check whether the file already
exists.

Anyway, by the time I realized this wasn't enough, I'd already
implemented some of the changes, and I figured I might as well
contribute them, even though they don't really solve any problem, and
even if they did, they'd be just a partial solution.

for  libstdc++-v3/ChangeLog

* testsuite/27_io/filesystem/operations/copy.cc (test02):
Select TO after creating FROM.
(test03, test04): Likewise.
* testsuite/experimental/filesystem/operations/copy.cc
(test02, test03, test04): Likewise.
libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc