1""" 2Provides definitions for various lldb test categories 3""" 4 5from __future__ import absolute_import 6from __future__ import print_function 7 8# System modules 9import sys 10 11# Third-party modules 12 13# LLDB modules 14from lldbsuite.support import gmodules 15 16 17debug_info_categories = [ 18 'dwarf', 'dwo', 'dsym', 'gmodules' 19] 20 21all_categories = { 22 'basic_process': 'Basic process execution sniff tests.', 23 'cmdline': 'Tests related to the LLDB command-line interface', 24 'darwin-log': 'Darwin log tests', 25 'dataformatters': 'Tests related to the type command and the data formatters subsystem', 26 'debugserver': 'Debugserver tests', 27 'dsym': 'Tests that can be run with DSYM debug information', 28 'dwarf': 'Tests that can be run with DWARF debug information', 29 'dwo': 'Tests that can be run with DWO debug information', 30 'dyntype': 'Tests related to dynamic type support', 31 'expression': 'Tests related to the expression parser', 32 'flakey': 'Flakey test cases, i.e. tests that do not reliably pass at each execution', 33 'gmodules': 'Tests that can be run with -gmodules debug information', 34 'instrumentation-runtime': 'Tests for the instrumentation runtime plugins', 35 'libc++': 'Test for libc++ data formatters', 36 'libstdcxx': 'Test for libstdcxx data formatters', 37 'lldb-server': 'Tests related to lldb-server', 38 'lldb-vscode': 'Visual Studio Code debug adaptor tests', 39 'llgs': 'Tests for the gdb-server functionality of lldb-server', 40 'objc': 'Tests related to the Objective-C programming language support', 41 'pyapi': 'Tests related to the Python API', 42 'std-module': 'Tests related to importing the std module', 43 'stresstest': 'Tests related to stressing lldb limits', 44 'watchpoint': 'Watchpoint-related tests', 45} 46 47 48def unique_string_match(yourentry, list): 49 candidate = None 50 for item in list: 51 if not item.startswith(yourentry): 52 continue 53 if candidate: 54 return None 55 candidate = item 56 return candidate 57 58 59def is_supported_on_platform(category, platform, compiler_path): 60 if category == "dwo": 61 # -gsplit-dwarf is not implemented by clang on Windows. 62 return platform in ["linux", "freebsd"] 63 elif category == "dsym": 64 return platform in ["darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"] 65 elif category == "gmodules": 66 # First, check to see if the platform can even support gmodules. 67 if platform not in ["freebsd", "darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"]: 68 return False 69 return gmodules.is_compiler_clang_with_gmodules(compiler_path) 70 return True 71 72 73def validate(categories, exact_match): 74 """ 75 For each category in categories, ensure that it's a valid category (if exact_match is false, 76 unique prefixes are also accepted). If a category is invalid, print a message and quit. 77 If all categories are valid, return the list of categories. Prefixes are expanded in the 78 returned list. 79 """ 80 result = [] 81 for category in categories: 82 origCategory = category 83 if category not in all_categories and not exact_match: 84 category = unique_string_match(category, all_categories) 85 if (category not in all_categories) or category is None: 86 print( 87 "fatal error: category '" + 88 origCategory + 89 "' is not a valid category") 90 print("if you have added a new category, please edit test_categories.py, adding your new category to all_categories") 91 print("else, please specify one or more of the following: " + 92 str(list(all_categories.keys()))) 93 sys.exit(1) 94 result.append(category) 95 return result 96