xref: /minix3/external/bsd/libc++/dist/libcxx/test/lit.cfg (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
24684ddb6SLionel Sambuc# Configuration file for the 'lit' test runner.
34684ddb6SLionel Sambucimport os
4*0a6a1f1dSLionel Sambucimport site
54684ddb6SLionel Sambuc
6*0a6a1f1dSLionel Sambucsite.addsitedir(os.path.dirname(__file__))
74684ddb6SLionel Sambuc
84684ddb6SLionel Sambuc
9*0a6a1f1dSLionel Sambuc# Tell pylint that we know config and lit_config exist somewhere.
10*0a6a1f1dSLionel Sambucif 'PYLINT_IMPORT' in os.environ:
11*0a6a1f1dSLionel Sambuc    config = object()
12*0a6a1f1dSLionel Sambuc    lit_config = object()
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc# name: The name of this test suite.
154684ddb6SLionel Sambucconfig.name = 'libc++'
164684ddb6SLionel Sambuc
174684ddb6SLionel Sambuc# suffixes: A list of file extensions to treat as test files.
18*0a6a1f1dSLionel Sambucconfig.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp']
194684ddb6SLionel Sambuc
204684ddb6SLionel Sambuc# test_source_root: The root path where tests are located.
214684ddb6SLionel Sambucconfig.test_source_root = os.path.dirname(__file__)
224684ddb6SLionel Sambuc
23*0a6a1f1dSLionel Sambuc# Infer the test_exec_root from the libcxx_object root.
24*0a6a1f1dSLionel Sambucobj_root = getattr(config, 'libcxx_obj_root', None)
254684ddb6SLionel Sambuc
26*0a6a1f1dSLionel Sambuc# Check that the test exec root is known.
27*0a6a1f1dSLionel Sambucif obj_root is None:
28*0a6a1f1dSLionel Sambuc    import libcxx.test.config
29*0a6a1f1dSLionel Sambuc    libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
30*0a6a1f1dSLionel Sambuc                                      'LIBCXX_SITE_CONFIG')
31*0a6a1f1dSLionel Sambuc    obj_root = getattr(config, 'libcxx_obj_root', None)
32*0a6a1f1dSLionel Sambuc    if obj_root is None:
33*0a6a1f1dSLionel Sambuc        import tempfile
34*0a6a1f1dSLionel Sambuc        obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-')
35*0a6a1f1dSLionel Sambuc        lit_config.warning('Creating temporary directory for object root: %s' %
36*0a6a1f1dSLionel Sambuc                           obj_root)
374684ddb6SLionel Sambuc
38*0a6a1f1dSLionel Sambucconfig.test_exec_root = os.path.join(obj_root, 'test')
394684ddb6SLionel Sambuc
40*0a6a1f1dSLionel Sambuccfg_variant = getattr(config, 'configuration_variant', 'libcxx')
41*0a6a1f1dSLionel Sambucif cfg_variant:
42*0a6a1f1dSLionel Sambuc    lit_config.note('Using configuration variant: %s' % cfg_variant)
434684ddb6SLionel Sambuc
44*0a6a1f1dSLionel Sambuc# Load the Configuration class from the module name <cfg_variant>.test.config.
45*0a6a1f1dSLionel Sambucconfig_module_name = '.'.join([cfg_variant, 'test', 'config'])
46*0a6a1f1dSLionel Sambucconfig_module = __import__(config_module_name, fromlist=['Configuration'])
474684ddb6SLionel Sambuc
48*0a6a1f1dSLionel Sambucconfiguration = config_module.Configuration(lit_config, config)
49*0a6a1f1dSLionel Sambucconfiguration.configure()
50*0a6a1f1dSLionel Sambucconfiguration.print_config_info()
51*0a6a1f1dSLionel Sambucconfig.test_format = configuration.get_test_format()
52