-# -*- Python -*-
+# -*- Python -*- vim: set syntax=python tabstop=4 expandtab cc=80:
# Configuration file for the 'lit' test runner.
import subprocess
import errno
import time
+import shlex
# FIXME: For now, this is cribbed from lit.TestRunner, to avoid introducing a
# dependency there. What we more ideally would like to do is lift the "xfail"
#
# FIXME: For now, this is cribbed from lit.TestRunner, to avoid
# introducing a dependency there. What we more ideally would like to do
- # is lift the "xfail" and "requires" handling to be a core lit framework
- # feature.
+ # is lift the "xfail" and "requires" handling to be a core lit
+ # framework feature.
missing_required_features = [f for f in requires
if f not in test.config.available_features]
if missing_required_features:
cmd = lit_config.valgrindArgs + 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])
- report += """Command: %s\n""" % ' '.join(["'%s'" % a
- for a in cmd])
+ report = """Compiled With: %s\n""" % \
+ ' '.join(["'%s'" % a for a in compile_cmd])
+ report += """Command: %s\n""" % \
+ ' '.join(["'%s'" % a for a in cmd])
report += """Exit Code: %d\n""" % exitCode
if out:
report += """Standard Output:\n--\n%s--""" % out
use_system_lib = False
lit.note("inferred use_system_lib as: %r" % (use_system_lib,))
+link_flags = []
+link_flags_str = lit.params.get('link_flags', None)
+if link_flags_str is None:
+ link_flags_str = getattr(config, 'link_flags', None)
+ if link_flags_str is None:
+ if sys.platform == 'darwin':
+ link_flags += ['-lSystem']
+ elif sys.platform == 'linux2':
+ link_flags += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread',
+ '-lrt', '-lgcc_s']
+ else:
+ lit.fatal("unrecognized system")
+ lit.note("inferred link_flags as: %r" % (link_flags,))
+if not link_flags_str is None:
+ link_flags += shlex.split(link_flags_str)
+
# Configure extra compiler flags.
-include_paths = ['-I' + libcxx_src_root + '/include', '-I' + libcxx_src_root + '/test/support']
+include_paths = ['-I' + libcxx_src_root + '/include',
+ '-I' + libcxx_src_root + '/test/support']
library_paths = ['-L' + libcxx_obj_root + '/lib']
compile_flags = []
if cxx_has_stdcxx0x_flag:
compile_flags += ['-std=c++0x']
-# Configure extra libraries.
+# Configure extra linker parameters.
exec_env = {}
-libraries = []
if sys.platform == 'darwin':
- libraries += ['-lSystem']
if not use_system_lib:
exec_env['DYLD_LIBRARY_PATH'] = os.path.join(libcxx_obj_root, 'lib')
elif sys.platform == 'linux2':
- libraries += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread', '-lrt', '-lgcc_s']
if not use_system_lib:
- libraries += ['-Wl,-R', libcxx_obj_root + '/lib']
- compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS']
+ link_flags += ['-Wl,-R', libcxx_obj_root + '/lib']
+ compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
+ '-D__STDC_CONSTANT_MACROS']
else:
lit.fatal("unrecognized system")
config.test_format = LibcxxTestFormat(
cxx_under_test,
cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
- ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries,
+ ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + link_flags,
exec_env = exec_env)
# Get or infer the target triple.