1 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
3 # Configuration file for the 'lit' test runner.
9 site.addsitedir(os.path.dirname(__file__))
12 # Tell pylint that we know config and lit_config exist somewhere.
13 if 'PYLINT_IMPORT' in os.environ:
17 # name: The name of this test suite.
18 config.name = 'libc++abi'
20 # suffixes: A list of file extensions to treat as test files.
21 config.suffixes = ['.cpp', '.s']
23 # Allow expanding substitutions that are based on other substitutions
24 config.recursiveExpansionLimit = 10
26 # test_source_root: The root path where tests are located.
27 config.test_source_root = os.path.dirname(__file__)
29 # Allow expanding substitutions that are based on other substitutions
30 config.recursiveExpansionLimit = 10
32 # Infer the libcxx_test_source_root for configuration import.
33 # If libcxx_source_root isn't specified in the config, assume that the libcxx
34 # and libcxxabi source directories are sibling directories.
35 libcxx_src_root = getattr(config, 'libcxx_src_root', None)
36 if not libcxx_src_root:
37 libcxx_src_root = os.path.join(config.test_source_root, '../../libcxx')
38 libcxx_test_src_root = os.path.join(libcxx_src_root, 'utils')
39 if os.path.isfile(os.path.join(libcxx_test_src_root, 'libcxx', '__init__.py')):
40 site.addsitedir(libcxx_test_src_root)
42 lit_config.fatal('Could not find libcxx test directory for test imports'
43 ' in: %s' % libcxx_test_src_root)
45 # Infer the test_exec_root from the libcxx_object root.
46 obj_root = getattr(config, 'libcxxabi_obj_root', None)
48 # Check that the test exec root is known.
50 import libcxx.test.config
51 libcxx.test.config.loadSiteConfig(
52 lit_config, config, 'libcxxabi_site_config', 'LIBCXXABI_SITE_CONFIG')
53 obj_root = getattr(config, 'libcxxabi_obj_root', None)
56 obj_root = tempfile.mkdtemp(prefix='libcxxabi-testsuite-')
57 lit_config.warning('Creating temporary directory for object root: %s' %
60 config.test_exec_root = os.path.join(obj_root, 'test')
62 cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
64 lit_config.note('Using configuration variant: %s' % cfg_variant)
66 # Load the Configuration class from the module name <cfg_variant>.test.config.
67 config_module_name = '.'.join([cfg_variant, 'test', 'config'])
68 config_module = __import__(config_module_name, fromlist=['Configuration'])
70 configuration = config_module.Configuration(lit_config, config)
71 configuration.configure()
72 configuration.print_config_info()
73 if lit_config.params.get('use_old_format', False):
74 lit_config.note("Using the old libc++ testing format")
75 config.test_format = configuration.get_test_format()
77 lit_config.note("Using the new libc++ testing format")
78 import libcxx.test.newformat
79 config.test_format = libcxx.test.newformat.CxxStandardLibraryTest()