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