]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-stl / libstdcpp / iterator / TestDataFormatterStdIterator.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 StdIteratorDataFormatterTestCase(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     @skipIfWindows # libstdcpp not ported to Windows
25     @expectedFailureIcc # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
26     def test_with_run_command(self):
27         """Test that libstdcpp 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         # The stop reason of the thread should be breakpoint.
36         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
37             substrs = ['stopped',
38                        'stop reason = breakpoint'])
39
40         # This is the function to remove the custom formats in order to have a
41         # clean slate for the next test case.
42         def cleanup():
43             self.runCmd('type format clear', check=False)
44             self.runCmd('type summary clear', check=False)
45             self.runCmd('type filter clear', check=False)
46             self.runCmd('type synth clear', check=False)
47             self.runCmd("settings set target.max-children-count 256", check=False)
48
49         # Execute the cleanup function during test case tear down.
50         self.addTearDownHook(cleanup)
51
52         self.expect('frame variable ivI', substrs = ['item = 3'])
53         self.expect('expr ivI', substrs = ['item = 3'])
54
55         self.expect('frame variable iimI', substrs = ['first = 0','second = 12'])
56         self.expect('expr iimI', substrs = ['first = 0','second = 12'])
57
58         self.expect('frame variable simI', substrs = ['first = "world"','second = 42'])
59         self.expect('expr simI', substrs = ['first = "world"','second = 42'])
60
61         self.expect('frame variable svI', substrs = ['item = "hello"'])
62         self.expect('expr svI', substrs = ['item = "hello"'])