annotate libcxx/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 # Configuration file for the 'lit' test runner.
anatofuz
parents:
diff changeset
3 import os
anatofuz
parents:
diff changeset
4 import site
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'utils'))
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 # Tell pylint that we know config and lit_config exist somewhere.
anatofuz
parents:
diff changeset
10 if 'PYLINT_IMPORT' in os.environ:
anatofuz
parents:
diff changeset
11 config = object()
anatofuz
parents:
diff changeset
12 lit_config = object()
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 # name: The name of this test suite.
anatofuz
parents:
diff changeset
15 config.name = 'libc++'
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 # suffixes: A list of file extensions to treat as test files.
anatofuz
parents:
diff changeset
18 config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp']
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 # test_source_root: The root path where tests are located.
anatofuz
parents:
diff changeset
21 config.test_source_root = os.path.dirname(__file__)
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 loaded_site_cfg = getattr(config, 'loaded_site_config', False)
anatofuz
parents:
diff changeset
24 if not loaded_site_cfg:
anatofuz
parents:
diff changeset
25 import libcxx.test.config
anatofuz
parents:
diff changeset
26 libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
anatofuz
parents:
diff changeset
27 'LIBCXX_SITE_CONFIG')
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 # Infer the test_exec_root from the libcxx_object root.
anatofuz
parents:
diff changeset
30 obj_root = getattr(config, 'libcxx_obj_root', None)
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 # Check that the test exec root is known.
anatofuz
parents:
diff changeset
33 if obj_root is None:
anatofuz
parents:
diff changeset
34 obj_root = getattr(config, 'libcxx_obj_root', None)
anatofuz
parents:
diff changeset
35 if obj_root is None:
anatofuz
parents:
diff changeset
36 import tempfile
anatofuz
parents:
diff changeset
37 obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-')
anatofuz
parents:
diff changeset
38 lit_config.warning('Creating temporary directory for object root: %s' %
anatofuz
parents:
diff changeset
39 obj_root)
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 config.test_exec_root = os.path.join(obj_root, 'test')
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 cfg_variant = getattr(config, 'configuration_variant', 'libcxx')
anatofuz
parents:
diff changeset
44 if cfg_variant:
anatofuz
parents:
diff changeset
45 lit_config.note('Using configuration variant: %s' % cfg_variant)
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 # Load the Configuration class from the module name <cfg_variant>.test.config.
anatofuz
parents:
diff changeset
48 config_module_name = '.'.join([cfg_variant, 'test', 'config'])
anatofuz
parents:
diff changeset
49 config_module = __import__(config_module_name, fromlist=['Configuration'])
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 configuration = config_module.Configuration(lit_config, config)
anatofuz
parents:
diff changeset
52 configuration.configure()
anatofuz
parents:
diff changeset
53 configuration.print_config_info()
anatofuz
parents:
diff changeset
54 config.test_format = configuration.get_test_format()