47 lines · python
1"""Test that importing modules in Objective-C works as expected."""2 3 4import lldb5 6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class ObjCModulesAutoImportTestCase(TestBase):12 def setUp(self):13 # Call super's setUp().14 TestBase.setUp(self)15 # Find the line number to break inside main().16 self.line = line_number("main.m", "// Set breakpoint 0 here.")17 18 @skipIf(macos_version=["<", "10.12"])19 @skipIf(compiler="clang", compiler_version=["<", "19.0"])20 def test_expr(self):21 self.build()22 exe = self.getBuildArtifact("a.out")23 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)24 25 # Break inside the foo function which takes a bar_ptr argument.26 lldbutil.run_break_set_by_file_and_line(27 self, "main.m", self.line, num_expected_locations=1, loc_exact=True28 )29 30 self.runCmd("run", RUN_SUCCEEDED)31 32 # The stop reason of the thread should be breakpoint.33 self.expect(34 "thread list",35 STOPPED_DUE_TO_BREAKPOINT,36 substrs=["stopped", "stop reason = breakpoint"],37 )38 39 # The breakpoint should have a hit count of 1.40 lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)41 42 self.runCmd("settings set target.auto-import-clang-modules true")43 44 self.expect(45 "expression getpid()", VARIABLES_DISPLAYED_CORRECTLY, substrs=["pid_t"]46 )47