forked from OSchip/llvm-project
[lldb/Test] Cleanup TestSymbolContext.py
Remove commented out code, fix the indentation and always use the full path to the executable. The latter is necessary for the test to pass from reproducer replay.
This commit is contained in:
parent
48acac3629
commit
9e391d4faa
|
@ -4,8 +4,6 @@ Test SBSymbolContext APIs.
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import lldb
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
|
@ -35,23 +33,20 @@ class SymbolContextAPITestCase(TestBase):
|
|||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
# Now create a breakpoint on main.c by name 'c'.
|
||||
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
||||
#print("breakpoint:", breakpoint)
|
||||
self.assertTrue(breakpoint and
|
||||
breakpoint.GetNumLocations() == 1,
|
||||
breakpoint = target.BreakpointCreateByName('c', exe)
|
||||
self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1,
|
||||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
process = target.LaunchSimple(
|
||||
None, None, self.get_process_working_directory())
|
||||
process = target.LaunchSimple(None, None,
|
||||
self.get_process_working_directory())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line.
|
||||
from lldbsuite.test.lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(
|
||||
thread.IsValid(),
|
||||
"There should be a thread stopped due to breakpoint")
|
||||
thread = lldbutil.get_stopped_thread(process,
|
||||
lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread.IsValid(),
|
||||
"There should be a thread stopped due to breakpoint")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
|
||||
|
||||
|
@ -62,36 +57,29 @@ class SymbolContextAPITestCase(TestBase):
|
|||
# Get the description of this module.
|
||||
module = context.GetModule()
|
||||
desc = lldbutil.get_description(module)
|
||||
self.expect(desc, "The module should match", exe=False,
|
||||
substrs=[self.getBuildArtifact("a.out")])
|
||||
self.expect(desc, "The module should match", exe=False, substrs=[exe])
|
||||
|
||||
compileUnit = context.GetCompileUnit()
|
||||
self.expect(
|
||||
str(compileUnit),
|
||||
"The compile unit should match",
|
||||
exe=False,
|
||||
substrs=[self.getSourcePath('main.c')])
|
||||
self.expect(str(compileUnit),
|
||||
"The compile unit should match",
|
||||
exe=False,
|
||||
substrs=[self.getSourcePath('main.c')])
|
||||
|
||||
function = context.GetFunction()
|
||||
self.assertTrue(function)
|
||||
#print("function:", function)
|
||||
|
||||
block = context.GetBlock()
|
||||
self.assertTrue(block)
|
||||
#print("block:", block)
|
||||
|
||||
lineEntry = context.GetLineEntry()
|
||||
#print("line entry:", lineEntry)
|
||||
self.expect(
|
||||
lineEntry.GetFileSpec().GetDirectory(),
|
||||
"The line entry should have the correct directory",
|
||||
exe=False,
|
||||
substrs=[self.mydir])
|
||||
self.expect(
|
||||
lineEntry.GetFileSpec().GetFilename(),
|
||||
"The line entry should have the correct filename",
|
||||
exe=False,
|
||||
substrs=['main.c'])
|
||||
self.expect(lineEntry.GetFileSpec().GetDirectory(),
|
||||
"The line entry should have the correct directory",
|
||||
exe=False,
|
||||
substrs=[self.mydir])
|
||||
self.expect(lineEntry.GetFileSpec().GetFilename(),
|
||||
"The line entry should have the correct filename",
|
||||
exe=False,
|
||||
substrs=['main.c'])
|
||||
self.assertTrue(lineEntry.GetLine() == self.line,
|
||||
"The line entry's line number should match ")
|
||||
|
||||
|
|
Loading…
Reference in New Issue