| 1 |
""" |
| 2 |
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 3 |
See https://llvm.org/LICENSE.txt for license information. |
| 4 |
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 |
|
| 6 |
Provides the configuration class, which holds all information related to |
| 7 |
how this invocation of the test suite should be run. |
| 8 |
""" |
| 9 |
|
| 10 |
# System modules |
| 11 |
import os |
| 12 |
|
| 13 |
|
| 14 |
# Third-party modules |
| 15 |
import unittest |
| 16 |
|
| 17 |
# LLDB Modules |
| 18 |
import lldbsuite |
| 19 |
|
| 20 |
|
| 21 |
# The test suite. |
| 22 |
suite = unittest.TestSuite() |
| 23 |
|
| 24 |
# The list of categories we said we care about |
| 25 |
categories_list = None |
| 26 |
# set to true if we are going to use categories for cherry-picking test cases |
| 27 |
use_categories = False |
| 28 |
# Categories we want to skip |
| 29 |
skip_categories = [] |
| 30 |
# Categories we expect to fail |
| 31 |
xfail_categories = [] |
| 32 |
# use this to track per-category failures |
| 33 |
failures_per_category = {} |
| 34 |
|
| 35 |
# The path to LLDB.framework is optional. |
| 36 |
lldb_framework_path = None |
| 37 |
|
| 38 |
# Test suite repeat count. Can be overwritten with '-# count'. |
| 39 |
count = 1 |
| 40 |
|
| 41 |
# The 'arch' and 'compiler' can be specified via command line. |
| 42 |
arch = None |
| 43 |
compiler = None |
| 44 |
dsymutil = None |
| 45 |
sdkroot = None |
| 46 |
make_path = None |
| 47 |
|
| 48 |
# The overriden dwarf verison. |
| 49 |
dwarf_version = 0 |
| 50 |
|
| 51 |
# Any overridden settings. |
| 52 |
settings = [] |
| 53 |
|
| 54 |
# Path to the FileCheck testing tool. Not optional. |
| 55 |
filecheck = None |
| 56 |
|
| 57 |
# Path to the yaml2obj tool. Not optional. |
| 58 |
yaml2obj = None |
| 59 |
|
| 60 |
# The arch might dictate some specific CFLAGS to be passed to the toolchain to build |
| 61 |
# the inferior programs. The global variable cflags_extras provides a hook to do |
| 62 |
# just that. |
| 63 |
cflags_extras = "" |
| 64 |
|
| 65 |
# The filters (testclass.testmethod) used to admit tests into our test suite. |
| 66 |
filters = [] |
| 67 |
|
| 68 |
# The regular expression pattern to match against eligible filenames as |
| 69 |
# our test cases. |
| 70 |
regexp = None |
| 71 |
|
| 72 |
# Sets of tests which are excluded at runtime |
| 73 |
skip_tests = None |
| 74 |
xfail_tests = None |
| 75 |
|
| 76 |
# Set this flag if there is any session info dumped during the test run. |
| 77 |
sdir_has_content = False |
| 78 |
# svn_info stores the output from 'svn info lldb.base.dir'. |
| 79 |
svn_info = "" |
| 80 |
|
| 81 |
# Default verbosity is 0. |
| 82 |
verbose = 0 |
| 83 |
|
| 84 |
# By default, search from the script directory. |
| 85 |
# We can't use sys.path[0] to determine the script directory |
| 86 |
# because it doesn't work under a debugger |
| 87 |
testdirs = [lldbsuite.lldb_test_root] |
| 88 |
|
| 89 |
# The root of the test case tree (where the actual tests reside, not the test |
| 90 |
# infrastructure). |
| 91 |
test_src_root = lldbsuite.lldb_test_root |
| 92 |
|
| 93 |
# Separator string. |
| 94 |
separator = "-" * 70 |
| 95 |
|
| 96 |
failed = False |
| 97 |
|
| 98 |
# LLDB Remote platform setting |
| 99 |
lldb_platform_name = None |
| 100 |
lldb_platform_url = None |
| 101 |
lldb_platform_working_dir = None |
| 102 |
|
| 103 |
# Apple SDK |
| 104 |
apple_sdk = None |
| 105 |
|
| 106 |
# The base directory in which the tests are being built. |
| 107 |
test_build_dir = None |
| 108 |
|
| 109 |
# The clang module cache directory used by lldb. |
| 110 |
lldb_module_cache_dir = None |
| 111 |
# The clang module cache directory used by clang. |
| 112 |
clang_module_cache_dir = None |
| 113 |
|
| 114 |
# Test results handling globals |
| 115 |
test_result = None |
| 116 |
|
| 117 |
# The names of all tests. Used to assert we don't have two tests with the |
| 118 |
# same base name. |
| 119 |
all_tests = set() |
| 120 |
|
| 121 |
# LLDB library directory. |
| 122 |
lldb_libs_dir = None |
| 123 |
lldb_obj_root = None |
| 124 |
|
| 125 |
libcxx_include_dir = None |
| 126 |
libcxx_include_target_dir = None |
| 127 |
libcxx_library_dir = None |
| 128 |
|
| 129 |
# A plugin whose tests will be enabled, like intel-pt. |
| 130 |
enabled_plugins = [] |
| 131 |
|
| 132 |
|
| 133 |
def shouldSkipBecauseOfCategories(test_categories): |
| 134 |
if use_categories: |
| 135 |
if ( |
| 136 |
len(test_categories) == 0 |
| 137 |
or len(categories_list & set(test_categories)) == 0 |
| 138 |
): |
| 139 |
return True |
| 140 |
|
| 141 |
for category in skip_categories: |
| 142 |
if category in test_categories: |
| 143 |
return True |
| 144 |
|
| 145 |
return False |
| 146 |
|
| 147 |
|
| 148 |
def get_filecheck_path(): |
| 149 |
""" |
| 150 |
Get the path to the FileCheck testing tool. |
| 151 |
""" |
| 152 |
if filecheck and os.path.lexists(filecheck): |
| 153 |
return filecheck |
| 154 |
|
| 155 |
|
| 156 |
def get_yaml2obj_path(): |
| 157 |
""" |
| 158 |
Get the path to the yaml2obj tool. |
| 159 |
""" |
| 160 |
if yaml2obj and os.path.lexists(yaml2obj): |
| 161 |
return yaml2obj |