56 lines · python
1"""Test the integrity of the lldb public api directory containing SB*.h headers.2 3There should be nothing unwanted there and a simpe main.cpp which includes SB*.h4should compile and link with the LLDB framework."""5 6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11@skipIfNoSBHeaders12@skipIfRemote13@skipUnlessDarwin14class SBDirCheckerCase(TestBase):15 NO_DEBUG_INFO_TESTCASE = True16 17 def setUp(self):18 TestBase.setUp(self)19 self.source = "main.cpp"20 self.generateSource(self.source)21 22 def test_sb_api_directory(self):23 """Test the SB API directory and make sure there's no unwanted stuff."""24 25 if not self.isAArch64() and self.getArchitecture() != "x86_64":26 self.skipTest("This test is only for LLDB.framework built 64-bit")27 28 exe_name = self.getBuildArtifact("a.out")29 self.buildDriver(self.source, exe_name)30 self.sanity_check_executable(exe_name)31 32 def sanity_check_executable(self, exe_name):33 """Sanity check executable compiled from the auto-generated program."""34 exe = self.getBuildArtifact(exe_name)35 self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)36 37 # This test uses a generated source file, so it's in the build directory.38 self.line_to_break = line_number(39 self.getBuildArtifact(self.source), "// Set breakpoint here."40 )41 42 lldbutil.run_break_set_by_file_and_line(43 self, self.source, self.line_to_break, num_expected_locations=-144 )45 46 self.runCmd("run", RUN_SUCCEEDED)47 48 # The stop reason of the thread should be breakpoint.49 self.expect(50 "thread list",51 STOPPED_DUE_TO_BREAKPOINT,52 substrs=["stopped", "stop reason = breakpoint"],53 )54 55 self.runCmd("frame variable")56