150
|
1 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
|
2 # Configuration file for the 'lit' test runner.
|
|
3 import os
|
|
4 import site
|
|
5
|
|
6 site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'utils'))
|
|
7
|
|
8
|
|
9 # Tell pylint that we know config and lit_config exist somewhere.
|
|
10 if 'PYLINT_IMPORT' in os.environ:
|
|
11 config = object()
|
|
12 lit_config = object()
|
|
13
|
|
14 # name: The name of this test suite.
|
|
15 config.name = 'libc++'
|
|
16
|
|
17 # suffixes: A list of file extensions to treat as test files.
|
173
|
18 config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp', '.pass.mm']
|
150
|
19
|
|
20 # test_source_root: The root path where tests are located.
|
|
21 config.test_source_root = os.path.dirname(__file__)
|
|
22
|
173
|
23 # Allow expanding substitutions that are based on other substitutions
|
|
24 config.recursiveExpansionLimit = 10
|
|
25
|
150
|
26 loaded_site_cfg = getattr(config, 'loaded_site_config', False)
|
|
27 if not loaded_site_cfg:
|
|
28 import libcxx.test.config
|
|
29 libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
|
|
30 'LIBCXX_SITE_CONFIG')
|
|
31
|
|
32 # Infer the test_exec_root from the libcxx_object root.
|
|
33 obj_root = getattr(config, 'libcxx_obj_root', None)
|
|
34
|
|
35 # Check that the test exec root is known.
|
|
36 if obj_root is None:
|
|
37 obj_root = getattr(config, 'libcxx_obj_root', None)
|
|
38 if obj_root is None:
|
|
39 import tempfile
|
|
40 obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-')
|
|
41 lit_config.warning('Creating temporary directory for object root: %s' %
|
|
42 obj_root)
|
|
43
|
173
|
44 if not config.test_exec_root:
|
|
45 config.test_exec_root = os.path.join(obj_root, 'test')
|
150
|
46
|
|
47 cfg_variant = getattr(config, 'configuration_variant', 'libcxx')
|
|
48 if cfg_variant:
|
|
49 lit_config.note('Using configuration variant: %s' % cfg_variant)
|
|
50
|
|
51 # Load the Configuration class from the module name <cfg_variant>.test.config.
|
|
52 config_module_name = '.'.join([cfg_variant, 'test', 'config'])
|
|
53 config_module = __import__(config_module_name, fromlist=['Configuration'])
|
|
54
|
|
55 configuration = config_module.Configuration(lit_config, config)
|
|
56 configuration.configure()
|
|
57 configuration.print_config_info()
|
173
|
58 if lit_config.params.get('use_old_format', False):
|
|
59 lit_config.note("Using the old libc++ testing format")
|
|
60 config.test_format = configuration.get_test_format()
|
|
61 else:
|
|
62 lit_config.note("Using the new libc++ testing format")
|
|
63 import libcxx.test.newformat
|
|
64 config.test_format = libcxx.test.newformat.CxxStandardLibraryTest()
|