]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-stl / libcxx / iterator / TestDataFormatterLibccIterator.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 LibcxxIteratorDataFormatterTestCase(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     @skipIfGcc
25     @skipIfWindows # libc++ not ported to Windows yet
26     def test_with_run_command(self):
27         """Test that libc++ iterators format properly."""
28         self.build()
29         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
30
31         lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
32
33         self.runCmd("run", RUN_SUCCEEDED)
34
35         lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
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             self.runCmd("settings set target.max-children-count 256", check=False)
50
51         # Execute the cleanup function during test case tear down.
52         self.addTearDownHook(cleanup)
53
54         self.expect('image list', substrs = self.getLibcPlusPlusLibs())
55
56         self.expect('frame variable ivI', substrs = ['item = 3'])
57         self.expect('expr ivI', substrs = ['item = 3'])
58
59         self.expect('frame variable iimI', substrs = ['first = 0','second = 12'])
60         self.expect('expr iimI', substrs = ['first = 0','second = 12'])
61
62         self.expect('frame variable simI', substrs = ['first = "world"','second = 42'])
63         self.expect('expr simI', substrs = ['first = "world"','second = 42'])
64
65         self.expect('frame variable svI', substrs = ['item = "hello"'])
66         self.expect('expr svI', substrs = ['item = "hello"'])