diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-04-22 23:20:17 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-04-22 23:20:17 +0000 |
commit | 787f71f2697e5e1b093a83cdcec6cf3008d3d2c8 (patch) | |
tree | 3e98fdef2644384c2010721c67a8dd18ccb2d506 /lldb/test/python_api/target | |
parent | 1d6bbd41aad452ae5dac37ed25959da2903ddf52 (diff) | |
download | bcm5719-llvm-787f71f2697e5e1b093a83cdcec6cf3008d3d2c8.tar.gz bcm5719-llvm-787f71f2697e5e1b093a83cdcec6cf3008d3d2c8.zip |
Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.
llvm-svn: 130029
Diffstat (limited to 'lldb/test/python_api/target')
-rw-r--r-- | lldb/test/python_api/target/TestTargetAPI.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py index a21fa47d0c9..c1257185c74 100644 --- a/lldb/test/python_api/target/TestTargetAPI.py +++ b/lldb/test/python_api/target/TestTargetAPI.py @@ -14,6 +14,19 @@ class TargetAPITestCase(TestBase): @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): """Exercise SBTaget.Launch() API.""" self.buildDsym() @@ -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") |