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 14 15debug_info_categories = [ 16 'dwarf', 'dwo', 'dsym' 17] 18 19all_categories = { 20 'dataformatters': 'Tests related to the type command and the data formatters subsystem', 21 'dwarf' : 'Tests that can be run with DWARF debug information', 22 'dwo' : 'Tests that can be run with DWO debug information', 23 'dsym' : 'Tests that can be run with DSYM debug information', 24 'expression' : 'Tests related to the expression parser', 25 'objc' : 'Tests related to the Objective-C programming language support', 26 'pyapi' : 'Tests related to the Python API', 27 'basic_process' : 'Basic process execution sniff tests.', 28 'cmdline' : 'Tests related to the LLDB command-line interface', 29 'dyntype' : 'Tests related to dynamic type support', 30 'stresstest' : 'Tests related to stressing lldb limits', 31 'flakey' : 'Flakey test cases, i.e. tests that do not reliably pass at each execution', 32 'lldb-mi' : 'lldb-mi tests' 33} 34 35def unique_string_match(yourentry, list): 36 candidate = None 37 for item in list: 38 if not item.startswith(yourentry): 39 continue 40 if candidate: 41 return None 42 candidate = item 43 return candidate 44 45def is_supported_on_platform(category, platform): 46 if category == "dwo": 47 # -gsplit-dwarf is not implemented by clang on Windows. 48 return platform in ["linux", "freebsd"] 49 elif category == "dsym": 50 return platform in ["darwin", "macosx", "ios"] 51 return True 52 53def validate(categories, exact_match): 54 """ 55 For each category in categories, ensure that it's a valid category (if exact_match is false, 56 unique prefixes are also accepted). If a category is invalid, print a message and quit. 57 If all categories are valid, return the list of categories. Prefixes are expanded in the 58 returned list. 59 """ 60 result = [] 61 for category in categories: 62 origCategory = category 63 if category not in all_categories and not exact_match: 64 category = unique_string_match(category, all_categories) 65 if (category not in all_categories) or category == None: 66 print("fatal error: category '" + origCategory + "' is not a valid category") 67 print("if you have added a new category, please edit test_categories.py, adding your new category to all_categories") 68 print("else, please specify one or more of the following: " + str(list(all_categories.keys()))) 69 sys.exit(1) 70 result.append(category) 71 return result 72