]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-synthtype / TestDataFormatterSynthType.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import time
10 import lldb
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
14
15
16 class DataFormatterSynthTypeTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     def setUp(self):
21         # Call super's setUp().
22         TestBase.setUp(self)
23         # Find the line number to break at.
24         self.line = line_number('main.cpp', 'break here')
25
26     @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
27     def test_with_run_command(self):
28         """Test using Python synthetic children provider to provide a typename."""
29         self.build()
30         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
31
32         lldbutil.run_break_set_by_file_and_line(
33             self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
34
35         self.runCmd("run", RUN_SUCCEEDED)
36
37         # The stop reason of the thread should be breakpoint.
38         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
39                     substrs=['stopped',
40                              'stop reason = breakpoint'])
41
42         # This is the function to remove the custom formats in order to have a
43         # clean slate for the next test case.
44         def cleanup():
45             self.runCmd('type format clear', check=False)
46             self.runCmd('type summary clear', check=False)
47             self.runCmd('type filter clear', check=False)
48             self.runCmd('type synth clear', check=False)
49
50         # Execute the cleanup function during test case tear down.
51         self.addTearDownHook(cleanup)
52
53         self.runCmd("script from myIntSynthProvider import *")
54         self.runCmd("type synth add -l myIntSynthProvider myInt")
55
56         self.expect('frame variable x', substrs=['ThisTestPasses'])
57         self.expect('frame variable y', substrs=['ThisTestPasses'])
58         self.expect('frame variable z', substrs=['ThisTestPasses'])