mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-27 05:40:48 +00:00
33f50fb940
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226330 91177308-0d34-0410-b5e6-96231b3b80d8
61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
|
# Configuration file for the 'lit' test runner.
|
|
import os
|
|
import site
|
|
|
|
site.addsitedir(os.path.dirname(__file__))
|
|
|
|
|
|
# Tell pylint that we know config and lit_config exist somewhere.
|
|
if 'PYLINT_IMPORT' in os.environ:
|
|
config = object()
|
|
lit_config = object()
|
|
|
|
# name: The name of this test suite.
|
|
config.name = 'libc++'
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
|
config.suffixes = ['.cpp']
|
|
|
|
# test_source_root: The root path where tests are located.
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
# Infer the test_exec_root from the libcxx_object root.
|
|
libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
|
|
if libcxx_obj_root is not None:
|
|
config.test_exec_root = os.path.join(libcxx_obj_root, 'test')
|
|
|
|
# Check that the test exec root is known.
|
|
if config.test_exec_root is None:
|
|
# Otherwise, we haven't loaded the site specific configuration (the user is
|
|
# probably trying to run on a test file directly, and either the site
|
|
# configuration hasn't been created by the build system, or we are in an
|
|
# out-of-tree build situation).
|
|
site_cfg = lit_config.params.get('libcxx_site_config',
|
|
os.environ.get('LIBCXX_SITE_CONFIG'))
|
|
if not site_cfg:
|
|
lit_config.warning('No site specific configuration file found!'
|
|
' Running the tests in the default configuration.')
|
|
# TODO: Set test_exec_root to a temporary directory where output files
|
|
# can be placed. This is needed for ShTest.
|
|
elif not os.path.isfile(site_cfg):
|
|
lit_config.fatal(
|
|
"Specified site configuration file does not exist: '%s'" %
|
|
site_cfg)
|
|
else:
|
|
lit_config.note('using site specific configuration at %s' % site_cfg)
|
|
lit_config.load_config(config, site_cfg)
|
|
raise SystemExit()
|
|
|
|
cfg_variant = getattr(config, 'configuration_variant', 'libcxx')
|
|
if cfg_variant:
|
|
lit_config.note('Using configuration variant: %s' % cfg_variant)
|
|
|
|
# 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)
|
|
configuration.configure()
|
|
config.test_format = configuration.get_test_format()
|