]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-disabling / TestDataFormatterDisabling.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import lldb
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
13
14 class DataFormatterDisablingTestCase(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     def setUp(self):
19         # Call super's setUp().
20         TestBase.setUp(self)
21         # Find the line number to break at.
22         self.line = line_number('main.cpp', '// Set break point at this line.')
23
24     @expectedFailureWindows("llvm.org/pr24462") # Data formatters have problems on Windows
25     def test_with_run_command(self):
26         """Check that we can properly disable all data formatter categories."""
27         self.build()
28         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
29
30         lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
31
32         self.runCmd("run", RUN_SUCCEEDED)
33
34         # The stop reason of the thread should be breakpoint.
35         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
36             substrs = ['stopped',
37                        'stop reason = breakpoint'])
38
39         # This is the function to remove the custom formats in order to have a
40         # clean slate for the next test case.
41         def cleanup():
42              self.runCmd('type category enable *', check=False)
43
44         # Execute the cleanup function during test case tear down.
45         self.addTearDownHook(cleanup)
46
47         #self.runCmd('type category enable system VectorTypes libcxx gnu-libstdc++ CoreGraphics CoreServices AppKit CoreFoundation objc default', check=False)
48
49         self.expect('type category list', substrs = ['system','enabled',])
50
51         self.expect("frame variable numbers",
52             substrs = ['[0] = 1', '[3] = 1234'])
53
54         self.expect('frame variable string1', substrs = ['hello world'])
55
56         # now disable them all and check that nothing is formatted
57         self.runCmd('type category disable *')
58
59         self.expect("frame variable numbers", matching=False,
60             substrs = ['[0] = 1', '[3] = 1234'])
61
62         self.expect('frame variable string1', matching=False, substrs = ['hello world'])
63
64         self.expect('type category list', substrs = ['system','disabled',])
65         
66         # now enable and check that we are back to normal
67         self.runCmd("type category enable *")
68
69         self.expect('type category list', substrs = ['system','enabled'])
70
71         self.expect("frame variable numbers",
72             substrs = ['[0] = 1', '[3] = 1234'])
73
74         self.expect('frame variable string1', substrs = ['hello world'])
75
76         self.expect('type category list', substrs = ['system','enabled'])
77
78         # last check - our cleanup will re-enable everything
79         self.runCmd('type category disable *')
80         self.expect('type category list', substrs = ['system','disabled'])