<div dir="ltr">Hi Michael,<div><br></div><div style>I'm not a huge fan of handling the ETXTBUSY problem in this fashion, if possible I would rather see if there is a way to avoid this error completely.</div><div style>
<br></div><div style>Do you know why this error is coming up? From my reading of the code, the executable file should be written and closed by the compiler before we ever try to execute it, so I don't see why this should happen (unless there was a name collision on the exec files which is probably not likely).</div>
<div style><br></div><div style> - Daniel</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 14, 2013 at 9:12 AM, Howard Hinnant <span dir="ltr"><<a href="mailto:hhinnant@apple.com" target="_blank">hhinnant@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hhinnant<br>
Date: Mon Jan 14 11:12:54 2013<br>
New Revision: 172436<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=172436&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=172436&view=rev</a><br>
Log:<br>
Michael van der Westhuizen: Improve support for testing on Linux.  Fixes <a href="http://llvm.org/bugs/show_bug.cgi?id=14892" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=14892</a>.<br>
<br>
Modified:<br>
    libcxx/trunk/test/lit.cfg<br>
    libcxx/trunk/test/support/platform_support.h<br>
<br>
Modified: libcxx/trunk/test/lit.cfg<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=172436&r1=172435&r2=172436&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=172436&r1=172435&r2=172436&view=diff</a><br>

==============================================================================<br>
--- libcxx/trunk/test/lit.cfg (original)<br>
+++ libcxx/trunk/test/lit.cfg Mon Jan 14 11:12:54 2013<br>
@@ -8,6 +8,8 @@<br>
 import tempfile<br>
 import signal<br>
 import subprocess<br>
+import errno<br>
+import time<br>
<br>
 class LibcxxTestFormat(lit.formats.FileBasedTest):<br>
     """<br>
@@ -24,9 +26,15 @@<br>
         self.cpp_flags = list(cpp_flags)<br>
         self.ld_flags = list(ld_flags)<br>
<br>
-    def execute_command(self, command):<br>
-        p = subprocess.Popen(command, stdin=subprocess.PIPE,<br>
-                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)<br>
+    def execute_command(self, command, in_dir=None):<br>
+        kwargs = {<br>
+            'stdin' :subprocess.PIPE,<br>
+            'stdout':subprocess.PIPE,<br>
+            'stderr':subprocess.PIPE,<br>
+        }<br>
+        if in_dir:<br>
+            kwargs['cwd'] = in_dir<br>
+        p = subprocess.Popen(command, **kwargs)<br>
         out,err = p.communicate()<br>
         exitCode = p.wait()<br>
<br>
@@ -37,8 +45,18 @@<br>
         return out, err, exitCode<br>
<br>
     def execute(self, test, lit_config):<br>
+        while True:<br>
+            try:<br>
+                return self._execute(test, lit_config)<br>
+            except OSError, oe:<br>
+                if oe.errno != errno.ETXTBSY:<br>
+                    raise<br>
+                time.sleep(0.1)<br>
+<br>
+    def _execute(self, test, lit_config):<br>
         name = test.path_in_suite[-1]<br>
         source_path = test.getSourcePath()<br>
+        source_dir = os.path.dirname(source_path)<br>
<br>
         # Check what kind of test this is.<br>
         assert name.endswith('.pass.cpp') or name.endswith('.fail.cpp')<br>
@@ -85,7 +103,7 @@<br>
                 cmd = [exec_path]<br>
                 if lit_config.useValgrind:<br>
                     cmd = lit_config.valgrindArgs + cmd<br>
-                out, err, exitCode = self.execute_command(cmd)<br>
+                out, err, exitCode = self.execute_command(cmd, source_dir)<br>
                 if exitCode != 0:<br>
                     report = """Compiled With: %s\n""" % ' '.join(["'%s'" % a<br>
                                                                    for a in compile_cmd])<br>
@@ -157,8 +175,9 @@<br>
 if sys.platform == 'darwin':<br>
   libraries += ['-lSystem']<br>
 if sys.platform == 'linux2':<br>
-  libraries += ['-lgcc_eh', '-lsupc++', '-lc', '-lm', '-lrt', '-lgcc_s']<br>
+  libraries += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread', '-lrt', '-lgcc_s']<br>
   libraries += ['-Wl,-R', libcxx_obj_root + '/lib']<br>
+  compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS']<br>
<br>
 config.test_format = LibcxxTestFormat(<br>
     cxx_under_test,<br>
<br>
Modified: libcxx/trunk/test/support/platform_support.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=172436&r1=172435&r2=172436&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=172436&r1=172435&r2=172436&view=diff</a><br>

==============================================================================<br>
--- libcxx/trunk/test/support/platform_support.h (original)<br>
+++ libcxx/trunk/test/support/platform_support.h Mon Jan 14 11:12:54 2013<br>
@@ -27,9 +27,14 @@<br>
 #define LOCALE_zh_CN_UTF_8     "Chinese_China.936"<br>
 #else<br>
 #define LOCALE_en_US_UTF_8     "en_US.UTF-8"<br>
-#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"<br>
 #define LOCALE_fr_FR_UTF_8     "fr_FR.UTF-8"<br>
+#ifdef __linux__<br>
+#define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1"<br>
+#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO-8859-2"<br>
+#else<br>
 #define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO8859-1"<br>
+#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"<br>
+#endif<br>
 #define LOCALE_ru_RU_UTF_8     "ru_RU.UTF-8"<br>
 #define LOCALE_zh_CN_UTF_8     "zh_CN.UTF-8"<br>
 #endif<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>