188 lines · python
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-exception5 6Provides the configuration class, which holds all information related to7how this invocation of the test suite should be run.8"""9 10# System modules11import os12 13 14# Third-party modules15import unittest16 17# LLDB Modules18import lldbsuite19 20 21# The test suite.22suite = unittest.TestSuite()23 24# The list of categories we said we care about25categories_list = None26# set to true if we are going to use categories for cherry-picking test cases27use_categories = False28# Categories we want to skip29skip_categories = []30# Categories we expect to fail31xfail_categories = []32# use this to track per-category failures33failures_per_category = {}34 35# The path to LLDB.framework is optional.36lldb_framework_path = None37 38# Test suite repeat count. Can be overwritten with '-# count'.39count = 140 41# The 'arch' and 'compiler' can be specified via command line.42arch = None43compiler = None44dsymutil = None45sdkroot = None46make_path = None47 48# Allow specifying a triple for cross compilation.49triple = None50 51# The overriden dwarf verison.52# Don't use this to test the current compiler's53# DWARF version, as this won't be set if the54# version isn't overridden.55# Use lldbplatformutils.getDwarfVersion() instead.56dwarf_version = 057 58# Any overridden settings.59settings = []60 61# Path to the FileCheck testing tool. Not optional.62filecheck = None63 64# Path to the yaml2obj tool. Not optional.65yaml2obj = None66 67# Path to the yaml2macho-core tool. Not optional.68yaml2macho_core = None69 70# The arch might dictate some specific CFLAGS to be passed to the toolchain to build71# the inferior programs. The global variable cflags_extras provides a hook to do72# just that.73cflags_extras = ""74 75# The filters (testclass.testmethod) used to admit tests into our test suite.76filters = []77 78# The regular expression pattern to match against eligible filenames as79# our test cases.80regexp = None81 82# Sets of tests which are excluded at runtime83skip_tests = None84xfail_tests = None85 86# Set this flag if there is any session info dumped during the test run.87sdir_has_content = False88# svn_info stores the output from 'svn info lldb.base.dir'.89svn_info = ""90 91# Default verbosity is 0.92verbose = 093 94# By default, search from the script directory.95# We can't use sys.path[0] to determine the script directory96# because it doesn't work under a debugger97testdirs = [lldbsuite.lldb_test_root]98 99# The root of the test case tree (where the actual tests reside, not the test100# infrastructure).101test_src_root = lldbsuite.lldb_test_root102 103# Separator string.104separator = "-" * 70105 106failed = False107 108# LLDB Remote platform setting109lldb_platform_name = None110lldb_platform_url = None111lldb_platform_working_dir = None112lldb_platform_available_ports = None113 114# Apple SDK115apple_sdk = None116 117# The base directory in which the tests are being built.118test_build_dir = None119 120# The clang module cache directory used by lldb.121lldb_module_cache_dir = None122# The clang module cache directory used by clang.123clang_module_cache_dir = None124 125# Test results handling globals126test_result = None127 128# The names of all tests. Used to assert we don't have two tests with the129# same base name.130all_tests = set()131 132# Path to LLVM tools to be used by tests.133llvm_tools_dir = None134 135# LLDB library directory.136lldb_libs_dir = None137lldb_obj_root = None138 139libcxx_include_dir = None140libcxx_include_target_dir = None141libcxx_library_dir = None142 143# A plugin whose tests will be enabled, like intel-pt.144enabled_plugins = []145 146# the build type of lldb147# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel148cmake_build_type = None149 150 151def shouldSkipBecauseOfCategories(test_categories):152 if use_categories:153 if (154 len(test_categories) == 0155 or len(categories_list & set(test_categories)) == 0156 ):157 return True158 159 for category in skip_categories:160 if category in test_categories:161 return True162 163 return False164 165 166def get_filecheck_path():167 """168 Get the path to the FileCheck testing tool.169 """170 if filecheck and os.path.lexists(filecheck):171 return filecheck172 173 174def get_yaml2obj_path():175 """176 Get the path to the yaml2obj tool.177 """178 if yaml2obj and os.path.lexists(yaml2obj):179 return yaml2obj180 181 182def get_yaml2macho_core_path():183 """184 Get the path to the yaml2macho-core tool.185 """186 if yaml2macho_core and os.path.lexists(yaml2macho_core):187 return yaml2macho_core188