[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>

yikes. I guess it builds with out this include...

Comment at: test/support/platform_support.h:55
@@ +54,3 @@
+class TempFileName {
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 @@
-   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.



More information about the cfe-commits mailing list