2015-01-10 02:03:29 +08:00
|
|
|
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
2010-09-15 11:57:04 +08:00
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
import os
|
2015-01-10 02:03:29 +08:00
|
|
|
import site
|
2014-08-22 01:30:44 +08:00
|
|
|
|
2015-01-10 02:03:29 +08:00
|
|
|
site.addsitedir(os.path.dirname(__file__))
|
2014-09-03 12:32:08 +08:00
|
|
|
|
2014-08-22 01:30:44 +08:00
|
|
|
|
2015-01-10 02:03:29 +08:00
|
|
|
# Tell pylint that we know config and lit_config exist somewhere.
|
|
|
|
if 'PYLINT_IMPORT' in os.environ:
|
|
|
|
config = object()
|
|
|
|
lit_config = object()
|
2014-08-22 01:30:44 +08:00
|
|
|
|
2010-09-15 11:57:04 +08:00
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'libc++'
|
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
2015-01-23 02:05:58 +08:00
|
|
|
config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp']
|
2010-09-15 11:57:04 +08:00
|
|
|
|
|
|
|
# test_source_root: The root path where tests are located.
|
|
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
|
2014-12-20 11:16:55 +08:00
|
|
|
# Infer the test_exec_root from the libcxx_object root.
|
2015-01-23 02:05:58 +08:00
|
|
|
obj_root = getattr(config, 'libcxx_obj_root', None)
|
2014-12-20 11:16:55 +08:00
|
|
|
|
|
|
|
# Check that the test exec root is known.
|
2015-01-23 02:05:58 +08:00
|
|
|
if obj_root is None:
|
|
|
|
import libcxx.test.config
|
|
|
|
libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
|
|
|
|
'LIBCXX_SITE_CONFIG')
|
|
|
|
obj_root = getattr(config, 'libcxx_obj_root', None)
|
|
|
|
if obj_root is None:
|
|
|
|
import tempfile
|
|
|
|
obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-')
|
|
|
|
lit_config.warning('Creating temporary directory for object root: %s' %
|
|
|
|
obj_root)
|
|
|
|
|
|
|
|
config.test_exec_root = os.path.join(obj_root, 'test')
|
2014-12-20 11:16:55 +08:00
|
|
|
|
2015-01-10 02:03:29 +08:00
|
|
|
cfg_variant = getattr(config, 'configuration_variant', 'libcxx')
|
Add better support for custom test runners.
Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.
First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.
Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.
As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/
Reviewers: jroelofs, mclow.lists, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6373
llvm-svn: 222698
2014-11-25 06:24:06 +08:00
|
|
|
if cfg_variant:
|
2015-01-17 05:59:07 +08:00
|
|
|
lit_config.note('Using configuration variant: %s' % cfg_variant)
|
Add better support for custom test runners.
Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.
First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.
Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.
As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/
Reviewers: jroelofs, mclow.lists, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6373
llvm-svn: 222698
2014-11-25 06:24:06 +08:00
|
|
|
|
2015-01-10 02:03:29 +08:00
|
|
|
# Load the Configuration class from the module name <cfg_variant>.test.config.
|
|
|
|
config_module_name = '.'.join([cfg_variant, 'test', 'config'])
|
|
|
|
config_module = __import__(config_module_name, fromlist=['Configuration'])
|
|
|
|
|
|
|
|
configuration = config_module.Configuration(lit_config, config)
|
2014-08-22 01:30:44 +08:00
|
|
|
configuration.configure()
|
2015-01-21 00:26:48 +08:00
|
|
|
configuration.print_config_info()
|
2014-08-22 01:30:44 +08:00
|
|
|
config.test_format = configuration.get_test_format()
|