brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · bd8ab96 Raw
109 lines · python
1"""2Make sure the plugin list, enable, and disable commands work.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7 8 9class TestFrameVar(TestBase):10    # If your test case doesn't stress debug info, then11    # set this to true.  That way it won't be run once for12    # each debug info format.13    NO_DEBUG_INFO_TESTCASE = True14 15    def test_plugin_list_enable_disable_commands(self):16        for plugin_namespace in [17            "abi",18            "architecture",19            "disassembler",20            "dynamic-loader",21            "emulate-instruction",22            "instrumentation-runtime",23            "jit-loader",24            "language",25            "language-runtime",26            "memory-history",27            "object-container",28            "object-file",29            "operating-system",30            "platform",31            "process",32            "repl",33            "register-type-builder",34            "script-interpreter",35            "scripted-interface",36            "structured-data",37            "symbol-file",38            "symbol-locator",39            "symbol-vendor",40            "system-runtime",41            # 'trace', # No trace plugin is registered by default.42            "trace-exporter",43            "type-system",44            "unwind-assembly",45        ]:46            self.do_list_disable_enable_test(plugin_namespace)47 48    def do_list_disable_enable_test(self, plugin_namespace):49        # Plugins are enabled by default.50        self.expect(51            f"plugin list {plugin_namespace}", substrs=[plugin_namespace, "[+]"]52        )53 54        # Plugins can be disabled.55        self.expect(56            f"plugin disable {plugin_namespace}", substrs=[plugin_namespace, "[-]"]57        )58 59        # Plugins can be enabled.60        self.expect(61            f"plugin enable {plugin_namespace}", substrs=[plugin_namespace, "[+]"]62        )63 64    def test_completions(self):65        # Make sure completions work for the plugin list, enable, and disable commands.66        # We just check a few of the expected plugins to make sure the completion works.67        self.completions_contain(68            "plugin list ", ["abi", "architecture", "disassembler"]69        )70        self.completions_contain(71            "plugin enable ", ["abi", "architecture", "disassembler"]72        )73        self.completions_contain(74            "plugin disable ", ["abi", "architecture", "disassembler"]75        )76 77        # A completion for a partial namespace should be the full namespace.78        # This allows the user to run the command on the full namespace.79        self.completions_match("plugin list ab", ["abi"])80        self.completions_contain(81            "plugin list object", ["object-container", "object-file"]82        )83 84        # A completion for a full namespace should contain the plugins in that namespace.85        self.completions_contain("plugin list object-file", ["object-file.JSON"])86        self.completions_contain("plugin list object-file.", ["object-file.JSON"])87        self.completions_contain("plugin list object-file.J", ["object-file.JSON"])88        self.completions_contain("plugin list object-file.JS", ["object-file.JSON"])89 90        # Check for a completion that is a both a complete namespace and a prefix of91        # another namespace. It should return the completions for the plugins in the completed92        # namespace as well as the completion for the partial namespace.93        self.completions_contain(94            "plugin list language", ["language.cplusplus", "language-runtime"]95        )96 97        # When the namespace is a prefix of another namespace and the user types a dot, the98        # completion should not include the match for the partial namespace.99        self.completions_contain(100            "plugin list language.", ["language.cplusplus"], match=True101        )102        self.completions_contain(103            "plugin list language.", ["language-runtime"], match=False104        )105 106        # Check for an empty completion list when the names is invalid.107        # See docs for `complete_from_to` for how this checks for an empty list.108        self.complete_from_to("plugin list abi.foo", ["plugin list abi.foo"])109