kwiver
kwiver copied to clipboard
Improve testing tmpfile creation
Currently it is possible for our temporary filename creator to yield a filename that already exists, possibly in use by another test program running in parallel in CTest. This happens most often using MSVC, which employs a very simple incrementing-number filename generator in its _tempnam. This PR fixes this issue by attempting to create the empty test file first with the O_EXCL flag, which will fail if the file already exists. Once a filename is found that can be successfully created in this way, it can be returned without fear of clobber another test file.