2 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class LibcxxUnorderedDataFormatterTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
19 ns = 'ndk' if lldbplatformutil.target_is_android() else ''
20 self.namespace = 'std::__' + ns + '1'
22 @add_test_categories(["libc++"])
23 def test_with_run_command(self):
25 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
27 lldbutil.run_break_set_by_source_regexp(
28 self, "Set break point at this line.")
30 self.runCmd("run", RUN_SUCCEEDED)
32 # The stop reason of the thread should be breakpoint.
33 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
35 'stop reason = breakpoint'])
37 # This is the function to remove the custom formats in order to have a
38 # clean slate for the next test case.
40 self.runCmd('type format clear', check=False)
41 self.runCmd('type summary clear', check=False)
42 self.runCmd('type filter clear', check=False)
43 self.runCmd('type synth clear', check=False)
45 "settings set target.max-children-count 256",
48 # Execute the cleanup function during test case tear down.
49 self.addTearDownHook(cleanup)
52 self.look_for_content_and_continue(
53 "map", ['%s::unordered_map' %
54 ns, 'size=5 {', 'hello', 'world', 'this', 'is', 'me'])
56 self.look_for_content_and_continue(
57 "mmap", ['%s::unordered_multimap' % ns, 'size=6 {', 'first = 3', 'second = "this"',
58 'first = 2', 'second = "hello"'])
60 self.look_for_content_and_continue(
61 "iset", ['%s::unordered_set' %
62 ns, 'size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2'])
64 self.look_for_content_and_continue(
65 "sset", ['%s::unordered_set' % ns, 'size=5 {', '\[\d\] = "is"', '\[\d\] = "world"',
68 self.look_for_content_and_continue(
69 "imset", ['%s::unordered_multiset' % ns, 'size=6 {', '(\[\d\] = 3(\\n|.)+){3}',
70 '\[\d\] = 2', '\[\d\] = 1'])
72 self.look_for_content_and_continue(
73 "smset", ['%s::unordered_multiset' % ns, 'size=5 {', '(\[\d\] = "is"(\\n|.)+){2}',
74 '(\[\d\] = "world"(\\n|.)+){2}'])
76 def look_for_content_and_continue(self, var_name, patterns):
77 self.expect(("frame variable %s" % var_name), patterns=patterns)
78 self.expect(("frame variable %s" % var_name), patterns=patterns)
79 self.runCmd("continue")