tests/lit: Change test default parameters to assume local build.
- Also, support overriding them with lit parameters. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168749 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b0895ff8ae
commit
af01e708aa
44
test/lit.cfg
44
test/lit.cfg
@ -114,31 +114,42 @@ config.suffixes = ['.cpp']
|
||||
# test_source_root: The root path where tests are located.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# FIXME: Would be nice to Use -stdlib=libc++ option with Clang's that accept it.
|
||||
# Gather various compiler parameters.
|
||||
cxx_under_test = lit.params.get('cxx_under_test', None)
|
||||
if cxx_under_test is None:
|
||||
cxx_under_test = getattr(config, 'cxx_under_test', None)
|
||||
if cxx_under_test is None:
|
||||
lit.fatal('must specify user parameter cxx_under_test '
|
||||
'(e.g., --param=cxx_under_test=clang++)')
|
||||
include_paths = []
|
||||
library_paths = []
|
||||
|
||||
libcxx_src_root = getattr(config, 'libcxx_src_root', None)
|
||||
if libcxx_src_root is not None:
|
||||
include_paths += ['-I' + libcxx_src_root + '/include']
|
||||
else:
|
||||
include_paths += ['-I/usr/include/c++/v1']
|
||||
libcxx_src_root = lit.params.get('libcxx_src_root', None)
|
||||
if libcxx_src_root is None:
|
||||
libcxx_src_root = getattr(config, 'libcxx_src_root', None)
|
||||
if libcxx_src_root is None:
|
||||
libcxx_src_root = os.path.dirname(config.test_source_root)
|
||||
|
||||
libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
|
||||
if libcxx_obj_root is not None:
|
||||
library_paths += ['-L' + libcxx_obj_root + '/lib']
|
||||
libcxx_obj_root = lit.params.get('libcxx_obj_root', None)
|
||||
if libcxx_obj_root is None:
|
||||
libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
|
||||
if libcxx_obj_root is None:
|
||||
libcxx_obj_root = libcxx_src_root
|
||||
|
||||
cxx_has_stdcxx0x_flag_str = lit.params.get('cxx_has_stdcxx0x_flag', None)
|
||||
if cxx_has_stdcxx0x_flag_str is not None:
|
||||
if cxx_has_stdcxx0x_flag_str in ('1', 'True'):
|
||||
cxx_has_stdcxx0x_flag = True
|
||||
elif cxx_has_stdcxx0x_flag_str in ('', '0', 'False'):
|
||||
cxx_has_stdcxx0x_flag = False
|
||||
else:
|
||||
lit.fatal('user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
|
||||
else:
|
||||
libcxx_obj_root = "/usr"
|
||||
cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
|
||||
|
||||
# Configure extra compiler flags.
|
||||
include_paths = ['-I' + libcxx_src_root + '/include']
|
||||
library_paths = ['-L' + libcxx_obj_root + '/lib']
|
||||
compile_flags = []
|
||||
if getattr(config, 'cxx_has_stdcxx0x_flag', False):
|
||||
if cxx_has_stdcxx0x_flag:
|
||||
compile_flags += ['-std=c++0x']
|
||||
|
||||
# Configure extra libraries.
|
||||
@ -149,8 +160,9 @@ if sys.platform == 'linux2':
|
||||
libraries += ['-lgcc_eh', '-lsupc++', '-lc', '-lm', '-lrt', '-lgcc_s']
|
||||
libraries += ['-Wl,-R', libcxx_obj_root + '/lib']
|
||||
|
||||
config.test_format = LibcxxTestFormat(cxx_under_test,
|
||||
cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
|
||||
ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries)
|
||||
config.test_format = LibcxxTestFormat(
|
||||
cxx_under_test,
|
||||
cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
|
||||
ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries)
|
||||
|
||||
config.target_triple = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user