2015-01-09 18:03:29 +00:00
|
|
|
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
2010-09-15 03:57:04 +00:00
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
import os
|
2015-01-09 18:03:29 +00:00
|
|
|
import site
|
2014-08-21 17:30:44 +00:00
|
|
|
|
2017-02-09 23:18:11 +00:00
|
|
|
site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'utils'))
|
2014-09-03 04:32:08 +00:00
|
|
|
|
2014-08-21 17:30:44 +00:00
|
|
|
|
2015-01-09 18:03:29 +00: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-21 17:30:44 +00:00
|
|
|
|
2010-09-15 03:57:04 +00:00
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'libc++'
|
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
2015-01-22 18:05:58 +00:00
|
|
|
config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp']
|
2010-09-15 03:57:04 +00:00
|
|
|
|
|
|
|
# test_source_root: The root path where tests are located.
|
|
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
|
2016-10-12 00:00:37 +00:00
|
|
|
loaded_site_cfg = getattr(config, 'loaded_site_config', False)
|
|
|
|
if not loaded_site_cfg:
|
|
|
|
import libcxx.test.config
|
|
|
|
libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
|
|
|
|
'LIBCXX_SITE_CONFIG')
|
|
|
|
|
2014-12-20 03:16:55 +00:00
|
|
|
# Infer the test_exec_root from the libcxx_object root.
|
2015-01-22 18:05:58 +00:00
|
|
|
obj_root = getattr(config, 'libcxx_obj_root', None)
|
2014-12-20 03:16:55 +00:00
|
|
|
|
|
|
|
# Check that the test exec root is known.
|
2015-01-22 18:05:58 +00:00
|
|
|
if obj_root is None:
|
|
|
|
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 03:16:55 +00:00
|
|
|
|
2015-01-09 18:03:29 +00: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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222698 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 22:24:06 +00:00
|
|
|
if cfg_variant:
|
2015-01-16 21:59:07 +00: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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222698 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 22:24:06 +00:00
|
|
|
|
2015-01-09 18:03:29 +00: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-21 17:30:44 +00:00
|
|
|
configuration.configure()
|
2015-01-20 16:26:48 +00:00
|
|
|
configuration.print_config_info()
|
2014-08-21 17:30:44 +00:00
|
|
|
config.test_format = configuration.get_test_format()
|