]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / nssetsynth / TestNSSetSynthetic.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7
8
9 import datetime
10 import os, time
11 import lldb
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
15
16 class NSSetSyntheticTestCase(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.m', '// Set break point at this line.')
25
26     @skipUnlessDarwin
27     def test_rdar12529957_with_run_command(self):
28         """Test that NSSet reports its synthetic children properly."""
29         self.build()
30         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
31
32         lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
33
34         self.runCmd("run", RUN_SUCCEEDED)
35
36         # The stop reason of the thread should be breakpoint.
37         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
38             substrs = ['stopped',
39                        'stop reason = breakpoint'])
40
41         # This is the function to remove the custom formats in order to have a
42         # clean slate for the next test case.
43         def cleanup():
44             self.runCmd('type format clear', check=False)
45             self.runCmd('type summary clear', check=False)
46             self.runCmd('type synth clear', check=False)
47
48         # Execute the cleanup function during test case tear down.
49         self.addTearDownHook(cleanup)
50
51         # Now check that we are displaying Cocoa classes correctly
52         self.expect('frame variable set',
53                     substrs = ['4 elements'])
54         self.expect('frame variable mutable',
55                     substrs = ['9 elements'])
56         self.expect('frame variable set --ptr-depth 1 -d run -T',
57                     substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])
58         self.expect('frame variable mutable --ptr-depth 1 -d run -T',
59                     substrs = ['9 elements','(int)5','@"3 elements"','@"www.apple.com"','(int)3','@"world"','(int)4'])
60
61         self.runCmd("next")
62         self.expect('frame variable mutable',
63                     substrs = ['0 elements'])
64
65         self.runCmd("next")
66         self.expect('frame variable mutable',
67                     substrs = ['4 elements'])
68         self.expect('frame variable mutable --ptr-depth 1 -d run -T',
69                     substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])
70
71         self.runCmd("next")
72         self.expect('frame variable mutable',
73                     substrs = ['4 elements'])
74         self.expect('frame variable mutable --ptr-depth 1 -d run -T',
75                     substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])