kwiver icon indicating copy to clipboard operation
kwiver copied to clipboard

Improve testing tmpfile creation

Open daniel-riehm opened this issue 1 year ago • 0 comments

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.

daniel-riehm avatar May 06 '24 17:05 daniel-riehm