[cfe-commits] [libcxx] r172436 - in /libcxx/trunk/test: lit.cfg support/platform_support.h
Howard Hinnant
hhinnant at apple.com
Mon Jan 14 09:12:54 PST 2013
Author: hhinnant
Date: Mon Jan 14 11:12:54 2013
New Revision: 172436
URL: http://llvm.org/viewvc/llvm-project?rev=172436&view=rev
Log:
Michael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14892.
Modified:
libcxx/trunk/test/lit.cfg
libcxx/trunk/test/support/platform_support.h
Modified: libcxx/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=172436&r1=172435&r2=172436&view=diff
==============================================================================
--- libcxx/trunk/test/lit.cfg (original)
+++ libcxx/trunk/test/lit.cfg Mon Jan 14 11:12:54 2013
@@ -8,6 +8,8 @@
import tempfile
import signal
import subprocess
+import errno
+import time
class LibcxxTestFormat(lit.formats.FileBasedTest):
"""
@@ -24,9 +26,15 @@
self.cpp_flags = list(cpp_flags)
self.ld_flags = list(ld_flags)
- def execute_command(self, command):
- p = subprocess.Popen(command, stdin=subprocess.PIPE,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ def execute_command(self, command, in_dir=None):
+ kwargs = {
+ 'stdin' :subprocess.PIPE,
+ 'stdout':subprocess.PIPE,
+ 'stderr':subprocess.PIPE,
+ }
+ if in_dir:
+ kwargs['cwd'] = in_dir
+ p = subprocess.Popen(command, **kwargs)
out,err = p.communicate()
exitCode = p.wait()
@@ -37,8 +45,18 @@
return out, err, exitCode
def execute(self, test, lit_config):
+ while True:
+ try:
+ return self._execute(test, lit_config)
+ except OSError, oe:
+ if oe.errno != errno.ETXTBSY:
+ raise
+ time.sleep(0.1)
+
+ def _execute(self, test, lit_config):
name = test.path_in_suite[-1]
source_path = test.getSourcePath()
+ source_dir = os.path.dirname(source_path)
# Check what kind of test this is.
assert name.endswith('.pass.cpp') or name.endswith('.fail.cpp')
@@ -85,7 +103,7 @@
cmd = [exec_path]
if lit_config.useValgrind:
cmd = lit_config.valgrindArgs + cmd
- out, err, exitCode = self.execute_command(cmd)
+ out, err, exitCode = self.execute_command(cmd, source_dir)
if exitCode != 0:
report = """Compiled With: %s\n""" % ' '.join(["'%s'" % a
for a in compile_cmd])
@@ -157,8 +175,9 @@
if sys.platform == 'darwin':
libraries += ['-lSystem']
if sys.platform == 'linux2':
- libraries += ['-lgcc_eh', '-lsupc++', '-lc', '-lm', '-lrt', '-lgcc_s']
+ libraries += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread', '-lrt', '-lgcc_s']
libraries += ['-Wl,-R', libcxx_obj_root + '/lib']
+ compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS']
config.test_format = LibcxxTestFormat(
cxx_under_test,
Modified: libcxx/trunk/test/support/platform_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=172436&r1=172435&r2=172436&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Mon Jan 14 11:12:54 2013
@@ -27,9 +27,14 @@
#define LOCALE_zh_CN_UTF_8 "Chinese_China.936"
#else
#define LOCALE_en_US_UTF_8 "en_US.UTF-8"
-#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"
#define LOCALE_fr_FR_UTF_8 "fr_FR.UTF-8"
+#ifdef __linux__
+#define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1"
+#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO-8859-2"
+#else
#define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO8859-1"
+#define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"
+#endif
#define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8"
#define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8"
#endif
More information about the cfe-commits
mailing list