annotate libcxxabi/test/lit.cfg @ 150:1d019706d866

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