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
16 class PluginCommandTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 @skipIfHostIncompatibleWithRemote # Requires a compatible arch and platform to link against the host's built lldb lib.
22 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
24 def test_load_plugin(self):
25 """Test that plugins that load commands work correctly."""
27 plugin_name = "plugin"
28 if sys.platform.startswith("darwin"):
29 plugin_lib_name = "lib%s.dylib" % plugin_name
31 plugin_lib_name = "lib%s.so" % plugin_name
33 # Invoke the library build rule.
34 self.buildLibrary("plugin.cpp", plugin_name)
36 debugger = lldb.SBDebugger.Create()
38 retobj = lldb.SBCommandReturnObject()
40 retval = debugger.GetCommandInterpreter().HandleCommand("plugin load %s" % plugin_lib_name, retobj)
44 retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_command child abc def ghi",retobj)
47 print(retobj.GetOutput())
49 self.expect(retobj,substrs = ['abc def ghi'], exe=False)
53 # check that abbreviations work correctly in plugin commands.
54 retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_ ch abc def ghi",retobj)
57 print(retobj.GetOutput())
59 self.expect(retobj,substrs = ['abc def ghi'], exe=False)