]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / objc / modules-incomplete / TestIncompleteModules.py
1 """Test that DWARF types are trusted over module types"""
2
3 from __future__ import print_function
4
5
6 import unittest2
7 import platform
8 from distutils.version import StrictVersion
9
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14
15 class IncompleteModulesTestCase(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     def setUp(self):
20         # Call super's setUp().
21         TestBase.setUp(self)
22         # Find the line number to break inside main().
23         self.line = line_number('main.m', '// Set breakpoint 0 here.')
24
25     @skipUnlessDarwin
26     @unittest2.expectedFailure("rdar://20416388")
27     @skipIf(macos_version=["<", "10.12"])
28     def test_expr(self):
29         self.build()
30         exe = os.path.join(os.getcwd(), "a.out")
31         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
32
33         # Break inside the foo function which takes a bar_ptr argument.
34         lldbutil.run_break_set_by_file_and_line(
35             self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
36
37         self.runCmd("run", RUN_SUCCEEDED)
38
39         # The stop reason of the thread should be breakpoint.
40         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
41                     substrs=['stopped',
42                              'stop reason = breakpoint'])
43
44         # The breakpoint should have a hit count of 1.
45         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
46                     substrs=[' resolved, hit count = 1'])
47
48         self.runCmd(
49             "settings set target.clang-module-search-paths \"" +
50             os.getcwd() +
51             "\"")
52
53         self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
54                     substrs=["int", "3"])
55
56         self.expect(
57             "expr [myObject privateMethod]",
58             VARIABLES_DISPLAYED_CORRECTLY,
59             substrs=[
60                 "int",
61                 "5"])
62
63         self.expect("expr MIN(2,3)", "#defined macro was found",
64                     substrs=["int", "2"])
65
66         self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
67                     error=True)