Clean up this test.

I don't know what the intent of parts of this test were.  We set a
bunch of breakpoints and ran from one to the other, doing "self.runCmd("thread backtrace")"
then continuing to the next one.  We didn't actually verify the contents of the backtrace,
nor that we hit the breakpoints we set in any particular order.  The only actual test was
to run sel_getName at two of these stops.

So I reduced the test to just stopping at the places where we were actually going to run
an expression, and tested the expression.

llvm-svn: 372196
This commit is contained in:
Jim Ingham 2019-09-18 01:53:52 +00:00
parent ba2e752c52
commit d6cad39316
1 changed files with 11 additions and 46 deletions

View File

@ -16,61 +16,26 @@ class FoundationTestCase2(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
def test_expr_commands(self):
"""More expression commands for objective-c."""
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
lines = []
lines.append(
line_number(
'main.m',
'// Break here for selector: tests'))
lines.append(
line_number(
'main.m',
'// Break here for NSArray tests'))
lines.append(
line_number(
'main.m',
'// Break here for NSString tests'))
lines.append(
line_number(
'main.m',
'// Break here for description test'))
lines.append(
line_number(
'main.m',
'// Set break point at this line'))
# Create a bunch of breakpoints.
for line in lines:
lldbutil.run_break_set_by_file_and_line(
self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
main_spec = lldb.SBFileSpec("main.m")
(target, process, thread, bp) = lldbutil.run_to_source_breakpoint(
self, "Break here for selector: tests", main_spec)
# Test_Selector:
self.runCmd("thread backtrace")
self.expect("expression (char *)sel_getName(sel)",
substrs=["(char *)",
"length"])
self.runCmd("process continue")
# Test_NSArray:
self.runCmd("thread backtrace")
self.runCmd("process continue")
# Test_NSString:
self.runCmd("thread backtrace")
self.runCmd("process continue")
# Test_MyString:
self.runCmd("thread backtrace")
desc_bkpt = target.BreakpointCreateBySourceRegex("Break here for description test",
main_spec)
self.assertEqual(desc_bkpt.GetNumLocations(), 1, "description breakpoint has a location")
lldbutil.continue_to_breakpoint(process, desc_bkpt)
self.expect("expression (char *)sel_getName(_cmd)",
substrs=["(char *)",
"description"])
self.runCmd("process continue")