[PATCH] Give libcxx tests temporary filenames that are actually unique.
Jon Roelofs
jonathan at codesourcery.com
Mon Aug 18 17:57:28 PDT 2014
================
Comment at: test/support/platform_support.h:44
@@ -43,2 +43,3 @@
#include <stdlib.h>
+#include <algorithm> // std::remove
#include <string>
----------------
s/algorithm/cstdio/
yikes. I guess it builds with out this include...
================
Comment at: test/support/platform_support.h:55
@@ +54,3 @@
+
+class TempFileName {
+public:
----------------
Dan Albert wrote:
> It's actually a TempFile, not a TempFileName, since you leave the fd open. I think what you actually wanted was to mkstemp(), stash the name and then close the fd (before leaving the constructor).
Oh good point. For some reason, I thought I needed to keep the fd open in order to keep the file name unique between concurrent processes running these tests.... but after reading the doc again, I guess not.
================
Comment at: test/support/platform_support.h:76
@@ -58,2 +75,3 @@
#endif
- return s;
+ std::remove(Name.c_str());
+ }
----------------
Dan Albert wrote:
> I must be missing something here... std::remove() takes three arguments.
There's another std::remove... bad naming, as it does something completely different than the version you're thinking of.
http://en.cppreference.com/w/cpp/io/c/remove
http://reviews.llvm.org/D4962
More information about the cfe-commits
mailing list