]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
Vendor import of lldb trunk r256945:
[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.lldbtest import *
13 import lldbsuite.test.lldbutil as lldbutil
14
15 class PluginCommandTestCase(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     @skipIfNoSBHeaders
20     @skipIfHostIncompatibleWithRemote # Requires a compatible arch and platform to link against the host's built lldb lib.
21     @expectedFailureWindows("llvm.org/pr24778")
22     @no_debug_info_test
23     def test_load_plugin(self):
24         """Test that plugins that load commands work correctly."""
25
26         plugin_name = "plugin"
27         if sys.platform.startswith("darwin"):
28             plugin_lib_name = "lib%s.dylib" % plugin_name
29         else:
30             plugin_lib_name = "lib%s.so" % plugin_name
31
32         # Invoke the library build rule.
33         self.buildLibrary("plugin.cpp", plugin_name)
34
35         debugger = lldb.SBDebugger.Create()
36
37         retobj = lldb.SBCommandReturnObject()
38
39         retval = debugger.GetCommandInterpreter().HandleCommand("plugin load %s" % plugin_lib_name, retobj)
40
41         retobj.Clear()
42
43         retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_command child abc def ghi",retobj)
44
45         if self.TraceOn():
46             print(retobj.GetOutput())
47
48         self.expect(retobj,substrs = ['abc def ghi'], exe=False)
49
50         retobj.Clear()
51
52         # check that abbreviations work correctly in plugin commands.
53         retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_ ch abc def ghi",retobj)
54
55         if self.TraceOn():
56             print(retobj.GetOutput())
57
58         self.expect(retobj,substrs = ['abc def ghi'], exe=False)