2 Test lldb data formatter subsystem.
5 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
14 class LibcxxUnorderedDataFormatterTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
18 @skipIfWindows # libc++ not ported to Windows yet
20 def test_with_run_command(self):
21 """Test that that file and class static variables display correctly."""
23 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
25 lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
27 self.runCmd("run", RUN_SUCCEEDED)
29 lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
31 # The stop reason of the thread should be breakpoint.
32 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
34 'stop reason = breakpoint'])
36 # This is the function to remove the custom formats in order to have a
37 # clean slate for the next test case.
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)
45 # Execute the cleanup function during test case tear down.
46 self.addTearDownHook(cleanup)
48 self.expect('image list', substrs = self.getLibcPlusPlusLibs())
50 self.look_for_content_and_continue(
51 "map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me'])
53 self.look_for_content_and_continue(
54 "mmap", ['size=6 {', 'first = 3', 'second = "this"',
55 'first = 2', 'second = "hello"'])
57 self.look_for_content_and_continue(
58 "iset", ['size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2'])
60 self.look_for_content_and_continue(
61 "sset", ['size=5 {', '\[\d\] = "is"', '\[\d\] = "world"',
64 self.look_for_content_and_continue(
65 "imset", ['size=6 {', '(\[\d\] = 3(\\n|.)+){3}',
66 '\[\d\] = 2', '\[\d\] = 1'])
68 self.look_for_content_and_continue(
70 ['size=5 {', '(\[\d\] = "is"(\\n|.)+){2}',
71 '(\[\d\] = "world"(\\n|.)+){2}'])
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")