2 Test that plugins that load commands work correctly.
5 from __future__ import print_function
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
17 class PluginCommandTestCase(TestBase):
19 mydir = TestBase.compute_mydir(__file__)
23 self.generateSource('plugin.cpp')
26 # Requires a compatible arch and platform to link against the host's built
28 @skipIfHostIncompatibleWithRemote
29 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
31 def test_load_plugin(self):
32 """Test that plugins that load commands work correctly."""
34 plugin_name = "plugin"
35 if sys.platform.startswith("darwin"):
36 plugin_lib_name = "lib%s.dylib" % plugin_name
38 plugin_lib_name = "lib%s.so" % plugin_name
40 # Invoke the library build rule.
41 self.buildLibrary("plugin.cpp", plugin_name)
43 debugger = lldb.SBDebugger.Create()
45 retobj = lldb.SBCommandReturnObject()
47 retval = debugger.GetCommandInterpreter().HandleCommand(
48 "plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj)
52 retval = debugger.GetCommandInterpreter().HandleCommand(
53 "plugin_loaded_command child abc def ghi", retobj)
56 print(retobj.GetOutput())
58 self.expect(retobj, substrs=['abc def ghi'], exe=False)
62 # check that abbreviations work correctly in plugin commands.
63 retval = debugger.GetCommandInterpreter().HandleCommand(
64 "plugin_loaded_ ch abc def ghi", retobj)
67 print(retobj.GetOutput())
69 self.expect(retobj, substrs=['abc def ghi'], exe=False)