]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / plugins / commands / TestPluginCommands.py
1 """
2 Test that plugins that load commands work correctly.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import re
11 import lldb
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
15
16 class PluginCommandTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     @skipIfNoSBHeaders
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")
23     @no_debug_info_test
24     def test_load_plugin(self):
25         """Test that plugins that load commands work correctly."""
26
27         plugin_name = "plugin"
28         if sys.platform.startswith("darwin"):
29             plugin_lib_name = "lib%s.dylib" % plugin_name
30         else:
31             plugin_lib_name = "lib%s.so" % plugin_name
32
33         # Invoke the library build rule.
34         self.buildLibrary("plugin.cpp", plugin_name)
35
36         debugger = lldb.SBDebugger.Create()
37
38         retobj = lldb.SBCommandReturnObject()
39
40         retval = debugger.GetCommandInterpreter().HandleCommand("plugin load %s" % plugin_lib_name, retobj)
41
42         retobj.Clear()
43
44         retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_command child abc def ghi",retobj)
45
46         if self.TraceOn():
47             print(retobj.GetOutput())
48
49         self.expect(retobj,substrs = ['abc def ghi'], exe=False)
50
51         retobj.Clear()
52
53         # check that abbreviations work correctly in plugin commands.
54         retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_ ch abc def ghi",retobj)
55
56         if self.TraceOn():
57             print(retobj.GetOutput())
58
59         self.expect(retobj,substrs = ['abc def ghi'], exe=False)