[Lldb-commits] [lldb] r130029 - /lldb/trunk/test/python_api/target/TestTargetAPI.py

Johnny Chen johnny.chen at apple.com
Fri Apr 22 16:20:18 PDT 2011


Author: johnny
Date: Fri Apr 22 18:20:17 2011
New Revision: 130029

URL: http://llvm.org/viewvc/llvm-project?rev=130029&view=rev
Log:
Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.

Modified:
    lldb/trunk/test/python_api/target/TestTargetAPI.py

Modified: lldb/trunk/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/target/TestTargetAPI.py?rev=130029&r1=130028&r2=130029&view=diff
==============================================================================
--- lldb/trunk/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/trunk/test/python_api/target/TestTargetAPI.py Fri Apr 22 18:20:17 2011
@@ -14,6 +14,19 @@
 
     @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 @@
         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")





More information about the lldb-commits mailing list