150
|
1 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
|
2
|
|
3 # Configuration file for the 'lit' test runner.
|
|
4
|
|
5
|
|
6 import os
|
|
7 import site
|
|
8
|
|
9 site.addsitedir(os.path.dirname(__file__))
|
|
10
|
|
11
|
|
12 # Tell pylint that we know config and lit_config exist somewhere.
|
|
13 if 'PYLINT_IMPORT' in os.environ:
|
|
14 config = object()
|
|
15 lit_config = object()
|
|
16
|
|
17 # name: The name of this test suite.
|
|
18 config.name = 'libc++abi'
|
|
19
|
|
20 # suffixes: A list of file extensions to treat as test files.
|
|
21 config.suffixes = ['.cpp', '.s']
|
|
22
|
|
23 # test_source_root: The root path where tests are located.
|
|
24 config.test_source_root = os.path.dirname(__file__)
|
|
25
|
|
26 # Infer the libcxx_test_source_root for configuration import.
|
|
27 # If libcxx_source_root isn't specified in the config, assume that the libcxx
|
|
28 # and libcxxabi source directories are sibling directories.
|
|
29 libcxx_src_root = getattr(config, 'libcxx_src_root', None)
|
|
30 if not libcxx_src_root:
|
|
31 libcxx_src_root = os.path.join(config.test_source_root, '../../libcxx')
|
|
32 libcxx_test_src_root = os.path.join(libcxx_src_root, 'utils')
|
|
33 if os.path.isfile(os.path.join(libcxx_test_src_root, 'libcxx', '__init__.py')):
|
|
34 site.addsitedir(libcxx_test_src_root)
|
|
35 else:
|
|
36 lit_config.fatal('Could not find libcxx test directory for test imports'
|
|
37 ' in: %s' % libcxx_test_src_root)
|
|
38
|
|
39 # Infer the test_exec_root from the libcxx_object root.
|
|
40 obj_root = getattr(config, 'libcxxabi_obj_root', None)
|
|
41
|
|
42 # Check that the test exec root is known.
|
|
43 if obj_root is None:
|
|
44 import libcxx.test.config
|
|
45 libcxx.test.config.loadSiteConfig(
|
|
46 lit_config, config, 'libcxxabi_site_config', 'LIBCXXABI_SITE_CONFIG')
|
|
47 obj_root = getattr(config, 'libcxxabi_obj_root', None)
|
|
48 if obj_root is None:
|
|
49 import tempfile
|
|
50 obj_root = tempfile.mkdtemp(prefix='libcxxabi-testsuite-')
|
|
51 lit_config.warning('Creating temporary directory for object root: %s' %
|
|
52 obj_root)
|
|
53
|
|
54 config.test_exec_root = os.path.join(obj_root, 'test')
|
|
55
|
|
56 cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
|
|
57 if cfg_variant:
|
|
58 lit_config.note('Using configuration variant: %s' % cfg_variant)
|
|
59
|
|
60 # Load the Configuration class from the module name <cfg_variant>.test.config.
|
|
61 config_module_name = '.'.join([cfg_variant, 'test', 'config'])
|
|
62 config_module = __import__(config_module_name, fromlist=['Configuration'])
|
|
63
|
|
64 configuration = config_module.Configuration(lit_config, config)
|
|
65 configuration.configure()
|
|
66 configuration.print_config_info()
|
|
67 config.test_format = configuration.get_test_format()
|