]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-stl / libstdcpp / tuple / TestDataFormatterStdTuple.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7 import os
8 import time
9 import lldb
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14
15 class StdTupleDataFormatterTestCase(TestBase):
16     mydir = TestBase.compute_mydir(__file__)
17
18     @skipIfFreeBSD
19     @skipIfWindows  # libstdcpp not ported to Windows
20     @skipIfDarwin  # doesn't compile on Darwin
21     def test_with_run_command(self):
22         self.build()
23         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
24
25         lldbutil.run_break_set_by_source_regexp(
26             self, "Set break point at this line.")
27         self.runCmd("run", RUN_SUCCEEDED)
28
29         # The stop reason of the thread should be breakpoint.
30         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
31                     substrs=['stopped', 'stop reason = breakpoint'])
32
33         frame = self.frame()
34         self.assertTrue(frame.IsValid())
35
36         self.expect("frame variable ti", substrs=['[0] = 1'])
37         self.expect("frame variable ts", substrs=['[0] = "foobar"'])
38         self.expect("frame variable tt", substrs=['[0] = 1', '[1] = "baz"', '[2] = 2'])
39
40         self.assertEqual(1, frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned())
41         self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid())
42
43         self.assertEqual('"foobar"', frame.GetValueForVariablePath("ts[0]").GetSummary())
44         self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid())
45         
46         self.assertEqual(1, frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned())
47         self.assertEqual('"baz"', frame.GetValueForVariablePath("tt[1]").GetSummary())
48         self.assertEqual(2, frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned())
49         self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid())