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