xref: /openbsd-src/gnu/llvm/lldb/packages/Python/lldbsuite/test/configuration.py (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1061da546Spatrick"""
2061da546SpatrickPart of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3061da546SpatrickSee https://llvm.org/LICENSE.txt for license information.
4061da546SpatrickSPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5061da546Spatrick
6061da546SpatrickProvides the configuration class, which holds all information related to
7061da546Spatrickhow this invocation of the test suite should be run.
8061da546Spatrick"""
9061da546Spatrick
10061da546Spatrickfrom __future__ import absolute_import
11061da546Spatrickfrom __future__ import print_function
12061da546Spatrick
13061da546Spatrick# System modules
14061da546Spatrickimport os
15061da546Spatrick
16061da546Spatrick
17061da546Spatrick# Third-party modules
18061da546Spatrickimport unittest2
19061da546Spatrick
20061da546Spatrick# LLDB Modules
21061da546Spatrickimport lldbsuite
22061da546Spatrick
23061da546Spatrick
24061da546Spatrick# The test suite.
25061da546Spatricksuite = unittest2.TestSuite()
26061da546Spatrick
27061da546Spatrick# The list of categories we said we care about
28061da546Spatrickcategories_list = None
29061da546Spatrick# set to true if we are going to use categories for cherry-picking test cases
30061da546Spatrickuse_categories = False
31061da546Spatrick# Categories we want to skip
32be691f3bSpatrickskip_categories = []
33061da546Spatrick# Categories we expect to fail
34061da546Spatrickxfail_categories = []
35061da546Spatrick# use this to track per-category failures
36061da546Spatrickfailures_per_category = {}
37061da546Spatrick
38061da546Spatrick# The path to LLDB.framework is optional.
39061da546Spatricklldb_framework_path = None
40061da546Spatrick
41061da546Spatrick# Test suite repeat count.  Can be overwritten with '-# count'.
42061da546Spatrickcount = 1
43061da546Spatrick
44061da546Spatrick# The 'arch' and 'compiler' can be specified via command line.
45dda28197Spatrickarch = None
46dda28197Spatrickcompiler = None
47dda28197Spatrickdsymutil = None
48dda28197Spatricksdkroot = None
49061da546Spatrick
50061da546Spatrick# The overriden dwarf verison.
51061da546Spatrickdwarf_version = 0
52061da546Spatrick
53061da546Spatrick# Any overridden settings.
54*f6aab3d8Srobertsettings = []
55061da546Spatrick
56061da546Spatrick# Path to the FileCheck testing tool. Not optional.
57061da546Spatrickfilecheck = None
58061da546Spatrick
59dda28197Spatrick# Path to the yaml2obj tool. Not optional.
60dda28197Spatrickyaml2obj = None
61dda28197Spatrick
62061da546Spatrick# The arch might dictate some specific CFLAGS to be passed to the toolchain to build
63061da546Spatrick# the inferior programs.  The global variable cflags_extras provides a hook to do
64061da546Spatrick# just that.
65061da546Spatrickcflags_extras = ''
66061da546Spatrick
67061da546Spatrick# The filters (testclass.testmethod) used to admit tests into our test suite.
68061da546Spatrickfilters = []
69061da546Spatrick
70061da546Spatrick# The regular expression pattern to match against eligible filenames as
71061da546Spatrick# our test cases.
72061da546Spatrickregexp = None
73061da546Spatrick
74061da546Spatrick# Sets of tests which are excluded at runtime
75061da546Spatrickskip_tests = None
76061da546Spatrickxfail_tests = None
77061da546Spatrick
78061da546Spatrick# Set this flag if there is any session info dumped during the test run.
79061da546Spatricksdir_has_content = False
80061da546Spatrick# svn_info stores the output from 'svn info lldb.base.dir'.
81061da546Spatricksvn_info = ''
82061da546Spatrick
83061da546Spatrick# Default verbosity is 0.
84061da546Spatrickverbose = 0
85061da546Spatrick
86061da546Spatrick# By default, search from the script directory.
87061da546Spatrick# We can't use sys.path[0] to determine the script directory
88061da546Spatrick# because it doesn't work under a debugger
89dda28197Spatricktestdirs = [lldbsuite.lldb_test_root]
90061da546Spatrick
91be691f3bSpatrick# The root of the test case tree (where the actual tests reside, not the test
92be691f3bSpatrick# infrastructure).
93be691f3bSpatricktest_src_root = lldbsuite.lldb_test_root
94be691f3bSpatrick
95061da546Spatrick# Separator string.
96061da546Spatrickseparator = '-' * 70
97061da546Spatrick
98061da546Spatrickfailed = False
99061da546Spatrick
100061da546Spatrick# LLDB Remote platform setting
101061da546Spatricklldb_platform_name = None
102061da546Spatricklldb_platform_url = None
103061da546Spatricklldb_platform_working_dir = None
104061da546Spatrick
105be691f3bSpatrick# Apple SDK
106be691f3bSpatrickapple_sdk = None
107be691f3bSpatrick
108061da546Spatrick# The base directory in which the tests are being built.
109061da546Spatricktest_build_dir = None
110061da546Spatrick
111061da546Spatrick# The clang module cache directory used by lldb.
112061da546Spatricklldb_module_cache_dir = None
113061da546Spatrick# The clang module cache directory used by clang.
114061da546Spatrickclang_module_cache_dir = None
115061da546Spatrick
116061da546Spatrick# Test results handling globals
117061da546Spatricktest_result = None
118061da546Spatrick
119061da546Spatrick# The names of all tests. Used to assert we don't have two tests with the
120061da546Spatrick# same base name.
121061da546Spatrickall_tests = set()
122061da546Spatrick
123dda28197Spatrick# LLDB library directory.
124dda28197Spatricklldb_libs_dir = None
125dda28197Spatrick
126*f6aab3d8Srobertlibcxx_include_dir = None
127*f6aab3d8Srobertlibcxx_include_target_dir = None
128*f6aab3d8Srobertlibcxx_library_dir = None
129*f6aab3d8Srobert
130dda28197Spatrick# A plugin whose tests will be enabled, like intel-pt.
131dda28197Spatrickenabled_plugins = []
132dda28197Spatrick
133dda28197Spatrick
134061da546Spatrickdef shouldSkipBecauseOfCategories(test_categories):
135061da546Spatrick    if use_categories:
136061da546Spatrick        if len(test_categories) == 0 or len(
137061da546Spatrick                categories_list & set(test_categories)) == 0:
138061da546Spatrick            return True
139061da546Spatrick
140061da546Spatrick    for category in skip_categories:
141061da546Spatrick        if category in test_categories:
142061da546Spatrick            return True
143061da546Spatrick
144061da546Spatrick    return False
145061da546Spatrick
146061da546Spatrick
147061da546Spatrickdef get_filecheck_path():
148061da546Spatrick    """
149061da546Spatrick    Get the path to the FileCheck testing tool.
150061da546Spatrick    """
151061da546Spatrick    if filecheck and os.path.lexists(filecheck):
152061da546Spatrick        return filecheck
153dda28197Spatrick
154dda28197Spatrickdef get_yaml2obj_path():
155dda28197Spatrick    """
156dda28197Spatrick    Get the path to the yaml2obj tool.
157dda28197Spatrick    """
158dda28197Spatrick    if yaml2obj and os.path.lexists(yaml2obj):
159dda28197Spatrick        return yaml2obj
160