]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-stl / libcxx / unordered / TestDataFormatterUnordered.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 LibcxxUnorderedDataFormatterTestCase(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     @skipIfWindows # libc++ not ported to Windows yet
19     @skipIfGcc
20     def test_with_run_command(self):
21         """Test that that file and class static variables display correctly."""
22         self.build()
23         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
24
25         lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
26
27         self.runCmd("run", RUN_SUCCEEDED)
28
29         lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
30
31         # The stop reason of the thread should be breakpoint.
32         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
33             substrs = ['stopped',
34                        'stop reason = breakpoint'])
35
36         # This is the function to remove the custom formats in order to have a
37         # clean slate for the next test case.
38         def cleanup():
39             self.runCmd('type format clear', check=False)
40             self.runCmd('type summary clear', check=False)
41             self.runCmd('type filter clear', check=False)
42             self.runCmd('type synth clear', check=False)
43             self.runCmd("settings set target.max-children-count 256", check=False)
44
45         # Execute the cleanup function during test case tear down.
46         self.addTearDownHook(cleanup)
47
48         self.expect('image list', substrs = self.getLibcPlusPlusLibs())
49
50         self.look_for_content_and_continue(
51             "map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me'])
52
53         self.look_for_content_and_continue(
54             "mmap", ['size=6 {', 'first = 3', 'second = "this"',
55                                  'first = 2', 'second = "hello"'])
56
57         self.look_for_content_and_continue(
58             "iset", ['size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2'])
59
60         self.look_for_content_and_continue(
61             "sset", ['size=5 {', '\[\d\] = "is"', '\[\d\] = "world"',
62                                  '\[\d\] = "hello"'])
63
64         self.look_for_content_and_continue(
65             "imset", ['size=6 {', '(\[\d\] = 3(\\n|.)+){3}',
66                                   '\[\d\] = 2', '\[\d\] = 1'])
67
68         self.look_for_content_and_continue(
69             "smset",
70             ['size=5 {', '(\[\d\] = "is"(\\n|.)+){2}',
71                          '(\[\d\] = "world"(\\n|.)+){2}'])
72
73     def look_for_content_and_continue(self, var_name, patterns):
74         self.expect( ("frame variable %s" % var_name), patterns=patterns)
75         self.runCmd("continue")