2 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class TypeSummaryListScriptTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 def test_typesummarylist_script(self):
18 """Test data formatter commands."""
20 self.data_formatter_commands()
23 # Call super's setUp().
25 # Find the line number to break at.
26 self.line = line_number('main.cpp', 'Break here')
28 def data_formatter_commands(self):
29 """Test printing out Python summary formatters."""
30 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
32 lldbutil.run_break_set_by_file_and_line(
33 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
35 self.runCmd("run", RUN_SUCCEEDED)
37 # The stop reason of the thread should be breakpoint.
38 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
40 'stop reason = breakpoint'])
42 # This is the function to remove the custom formats in order to have a
43 # clean slate for the next test case.
45 self.runCmd('type category delete TSLSFormatters', check=False)
46 self.runCmd('type format clear', check=False)
47 self.runCmd('type summary clear', check=False)
48 self.runCmd('type filter clear', check=False)
49 self.runCmd('type synth clear', check=False)
51 self.addTearDownHook(cleanup)
53 self.runCmd("command script import tslsformatters.py")
56 "frame variable myStruct",
57 substrs=['A data formatter at work'])
59 self.expect('type summary list', substrs=['Struct_SummaryFormatter'])
61 'type summary list Struct',
62 substrs=['Struct_SummaryFormatter'])