Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.

llvm-svn: 130029
This commit is contained in:
Johnny Chen 2011-04-22 23:20:17 +00:00
parent 1d6bbd41aa
commit 787f71f269
1 changed files with 36 additions and 0 deletions

View File

@ -12,6 +12,19 @@ class TargetAPITestCase(TestBase):
mydir = os.path.join("python_api", "target")
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
def test_get_description_with_dsym(self):
"""Exercise SBTaget.GetDescription() API."""
self.buildDsym()
self.get_description()
@python_api_test
def test_get_description_with_dwarf(self):
"""Exercise SBTarget.GetDescription() API."""
self.buildDwarf()
self.get_description()
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
def test_launch_new_process_and_redirect_stdout_with_dsym(self):
@ -45,6 +58,29 @@ class TargetAPITestCase(TestBase):
self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
def get_description(self):
"""Exercise SBTaget.GetDescription() API."""
exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target.IsValid(), VALID_TARGET)
stream = lldb.SBStream()
if not target.GetDescription(stream, lldb.eDescriptionLevelBrief):
self.fail("SBTarget.GetDescription() failed")
self.expect(stream.GetData(), exe=False,
substrs = ['a.out'])
self.expect(stream.GetData(), exe=False, matching=False,
substrs = ['Target', 'Module', 'Breakpoint'])
stream.Clear()
if not target.GetDescription(stream, lldb.eDescriptionLevelFull):
self.fail("SBTarget.GetDescription() failed")
self.expect(stream.GetData(), exe=False,
substrs = ['a.out', 'Target', 'Module', 'Breakpoint'])
def launch_new_process_and_redirect_stdout(self):
"""Exercise SBTaget.Launch() API with redirected stdout."""
exe = os.path.join(os.getcwd(), "a.out")