[tests] Update to use lit_config and lit package, as appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
051c848e88
commit
bd7b48a628
37
test/lit.cfg
37
test/lit.cfg
@ -12,6 +12,10 @@ import errno
|
|||||||
import time
|
import time
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
|
import lit.Test
|
||||||
|
import lit.formats
|
||||||
|
import lit.util
|
||||||
|
|
||||||
# FIXME: For now, this is cribbed from lit.TestRunner, to avoid introducing a
|
# 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"
|
# dependency there. What we more ideally would like to do is lift the "xfail"
|
||||||
# and "requires" handling to be a core lit framework feature.
|
# and "requires" handling to be a core lit framework feature.
|
||||||
@ -207,7 +211,7 @@ config.suffixes = ['.cpp']
|
|||||||
config.test_source_root = os.path.dirname(__file__)
|
config.test_source_root = os.path.dirname(__file__)
|
||||||
|
|
||||||
# Gather various compiler parameters.
|
# Gather various compiler parameters.
|
||||||
cxx_under_test = lit.params.get('cxx_under_test', None)
|
cxx_under_test = lit_config.params.get('cxx_under_test', None)
|
||||||
if cxx_under_test is None:
|
if cxx_under_test is None:
|
||||||
cxx_under_test = getattr(config, 'cxx_under_test', None)
|
cxx_under_test = getattr(config, 'cxx_under_test', None)
|
||||||
|
|
||||||
@ -215,52 +219,53 @@ if cxx_under_test is None:
|
|||||||
clangxx = lit.util.which('clang++', config.environment['PATH'])
|
clangxx = lit.util.which('clang++', config.environment['PATH'])
|
||||||
if clangxx is not None:
|
if clangxx is not None:
|
||||||
cxx_under_test = clangxx
|
cxx_under_test = clangxx
|
||||||
lit.note("inferred cxx_under_test as: %r" % (cxx_under_test,))
|
lit_config.note("inferred cxx_under_test as: %r" % (cxx_under_test,))
|
||||||
if cxx_under_test is None:
|
if cxx_under_test is None:
|
||||||
lit.fatal('must specify user parameter cxx_under_test '
|
lit_config.fatal('must specify user parameter cxx_under_test '
|
||||||
'(e.g., --param=cxx_under_test=clang++)')
|
'(e.g., --param=cxx_under_test=clang++)')
|
||||||
|
|
||||||
libcxx_src_root = lit.params.get('libcxx_src_root', None)
|
libcxx_src_root = lit_config.params.get('libcxx_src_root', None)
|
||||||
if libcxx_src_root is None:
|
if libcxx_src_root is None:
|
||||||
libcxx_src_root = getattr(config, 'libcxx_src_root', None)
|
libcxx_src_root = getattr(config, 'libcxx_src_root', None)
|
||||||
if libcxx_src_root is None:
|
if libcxx_src_root is None:
|
||||||
libcxx_src_root = os.path.dirname(config.test_source_root)
|
libcxx_src_root = os.path.dirname(config.test_source_root)
|
||||||
|
|
||||||
libcxx_obj_root = lit.params.get('libcxx_obj_root', None)
|
libcxx_obj_root = lit_config.params.get('libcxx_obj_root', None)
|
||||||
if libcxx_obj_root is None:
|
if libcxx_obj_root is None:
|
||||||
libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
|
libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
|
||||||
if libcxx_obj_root is None:
|
if libcxx_obj_root is None:
|
||||||
libcxx_obj_root = libcxx_src_root
|
libcxx_obj_root = libcxx_src_root
|
||||||
|
|
||||||
cxx_has_stdcxx0x_flag_str = lit.params.get('cxx_has_stdcxx0x_flag', None)
|
cxx_has_stdcxx0x_flag_str = lit_config.params.get('cxx_has_stdcxx0x_flag', None)
|
||||||
if cxx_has_stdcxx0x_flag_str is not None:
|
if cxx_has_stdcxx0x_flag_str is not None:
|
||||||
if cxx_has_stdcxx0x_flag_str.lower() in ('1', 'true'):
|
if cxx_has_stdcxx0x_flag_str.lower() in ('1', 'true'):
|
||||||
cxx_has_stdcxx0x_flag = True
|
cxx_has_stdcxx0x_flag = True
|
||||||
elif cxx_has_stdcxx0x_flag_str.lower() in ('', '0', 'false'):
|
elif cxx_has_stdcxx0x_flag_str.lower() in ('', '0', 'false'):
|
||||||
cxx_has_stdcxx0x_flag = False
|
cxx_has_stdcxx0x_flag = False
|
||||||
else:
|
else:
|
||||||
lit.fatal('user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
|
lit_config.fatal(
|
||||||
|
'user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
|
||||||
else:
|
else:
|
||||||
cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
|
cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
|
||||||
|
|
||||||
# This test suite supports testing against either the system library or the
|
# This test suite supports testing against either the system library or the
|
||||||
# locally built one; the former mode is useful for testing ABI compatibility
|
# locally built one; the former mode is useful for testing ABI compatibility
|
||||||
# between the current headers and a shipping dynamic library.
|
# between the current headers and a shipping dynamic library.
|
||||||
use_system_lib_str = lit.params.get('use_system_lib', None)
|
use_system_lib_str = lit_config.params.get('use_system_lib', None)
|
||||||
if use_system_lib_str is not None:
|
if use_system_lib_str is not None:
|
||||||
if use_system_lib_str.lower() in ('1', 'true'):
|
if use_system_lib_str.lower() in ('1', 'true'):
|
||||||
use_system_lib = True
|
use_system_lib = True
|
||||||
elif use_system_lib_str.lower() in ('', '0', 'false'):
|
elif use_system_lib_str.lower() in ('', '0', 'false'):
|
||||||
use_system_lib = False
|
use_system_lib = False
|
||||||
else:
|
else:
|
||||||
lit.fatal('user parameter use_system_lib should be 0 or 1')
|
lit_config.fatal('user parameter use_system_lib should be 0 or 1')
|
||||||
else:
|
else:
|
||||||
# Default to testing against the locally built libc++ library.
|
# Default to testing against the locally built libc++ library.
|
||||||
use_system_lib = False
|
use_system_lib = False
|
||||||
lit.note("inferred use_system_lib as: %r" % (use_system_lib,))
|
lit_config.note("inferred use_system_lib as: %r" % (use_system_lib,))
|
||||||
|
|
||||||
link_flags = []
|
link_flags = []
|
||||||
link_flags_str = lit.params.get('link_flags', None)
|
link_flags_str = lit_config.params.get('link_flags', None)
|
||||||
if link_flags_str is None:
|
if link_flags_str is None:
|
||||||
link_flags_str = getattr(config, 'link_flags', None)
|
link_flags_str = getattr(config, 'link_flags', None)
|
||||||
if link_flags_str is None:
|
if link_flags_str is None:
|
||||||
@ -270,8 +275,8 @@ if link_flags_str is None:
|
|||||||
link_flags += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread',
|
link_flags += ['-lsupc++', '-lgcc_eh', '-lc', '-lm', '-lpthread',
|
||||||
'-lrt', '-lgcc_s']
|
'-lrt', '-lgcc_s']
|
||||||
else:
|
else:
|
||||||
lit.fatal("unrecognized system")
|
lit_config.fatal("unrecognized system")
|
||||||
lit.note("inferred link_flags as: %r" % (link_flags,))
|
lit_config.note("inferred link_flags as: %r" % (link_flags,))
|
||||||
if not link_flags_str is None:
|
if not link_flags_str is None:
|
||||||
link_flags += shlex.split(link_flags_str)
|
link_flags += shlex.split(link_flags_str)
|
||||||
|
|
||||||
@ -294,7 +299,7 @@ elif sys.platform == 'linux2':
|
|||||||
compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
|
compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
|
||||||
'-D__STDC_CONSTANT_MACROS']
|
'-D__STDC_CONSTANT_MACROS']
|
||||||
else:
|
else:
|
||||||
lit.fatal("unrecognized system")
|
lit_config.fatal("unrecognized system")
|
||||||
|
|
||||||
config.test_format = LibcxxTestFormat(
|
config.test_format = LibcxxTestFormat(
|
||||||
cxx_under_test,
|
cxx_under_test,
|
||||||
@ -303,12 +308,12 @@ config.test_format = LibcxxTestFormat(
|
|||||||
exec_env = exec_env)
|
exec_env = exec_env)
|
||||||
|
|
||||||
# Get or infer the target triple.
|
# Get or infer the target triple.
|
||||||
config.target_triple = lit.params.get('target_triple', None)
|
config.target_triple = lit_config.params.get('target_triple', None)
|
||||||
# If no target triple was given, try to infer it from the compiler under test.
|
# If no target triple was given, try to infer it from the compiler under test.
|
||||||
if config.target_triple is None:
|
if config.target_triple is None:
|
||||||
config.target_triple = lit.util.capture(
|
config.target_triple = lit.util.capture(
|
||||||
[cxx_under_test, '-dumpmachine']).strip()
|
[cxx_under_test, '-dumpmachine']).strip()
|
||||||
lit.note("inferred target_triple as: %r" % (config.target_triple,))
|
lit_config.note("inferred target_triple as: %r" % (config.target_triple,))
|
||||||
|
|
||||||
# Write an "available feature" that combines the triple when use_system_lib is
|
# Write an "available feature" that combines the triple when use_system_lib is
|
||||||
# enabled. This is so that we can easily write XFAIL markers for tests that are
|
# enabled. This is so that we can easily write XFAIL markers for tests that are
|
||||||
|
@ -7,4 +7,4 @@ config.python_executable = "@PYTHON_EXECUTABLE@"
|
|||||||
config.enable_shared = @LIBCXX_ENABLE_SHARED@
|
config.enable_shared = @LIBCXX_ENABLE_SHARED@
|
||||||
|
|
||||||
# Let the main config do the real work.
|
# Let the main config do the real work.
|
||||||
lit.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
|
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user