[Lldb-commits] [lldb] r326847 - Add test for lldb-mi interpreter

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 6 15:25:04 PST 2018


Author: adrian
Date: Tue Mar  6 15:25:04 2018
New Revision: 326847

URL: http://llvm.org/viewvc/llvm-project?rev=326847&view=rev
Log:
Add test for lldb-mi interpreter

Test that "lldb-mi --interpreter" can interpret "target list" CLI command.

Patch by Alex Polyakov!

Differential Revision: https://reviews.llvm.org/D44040

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py?rev=326847&r1=326846&r2=326847&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py Tue Mar  6 15:25:04 2018
@@ -34,6 +34,26 @@ class MiCliSupportTestCase(lldbmi_testca
         self.expect("\^running")
         self.expect("\*stopped,reason=\"breakpoint-hit\"")
 
+    @skipIfRemote   # We do not currently support remote debugging via the MI.
+    @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows.
+    @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races.
+    def test_lldbmi_target_list(self):
+        """Test that 'lldb-mi --interpreter' can list targets by 'target list' command."""
+
+        self.spawnLldbMi(args=None)
+
+        # Test that initially there are no targets.
+        self.runCmd("target list")
+        self.expect(r"~\"No targets.\\n\"")
+        self.expect("\^done")
+
+        # Add target.
+        self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+
+        # Test that "target list" lists added target.
+        self.runCmd("target list")
+        self.expect(r"~\"Current targets:\\n\* target #0: %s" % self.myexe)
+
     @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
     @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
     @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=326847&r1=326846&r2=326847&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Tue Mar  6 15:25:04 2018
@@ -36,6 +36,25 @@ class MiInterpreterExecTestCase(lldbmi_t
         self.expect("\^running")
         self.expect("\*stopped,reason=\"breakpoint-hit\"")
 
+    @skipIfRemote   # We do not currently support remote debugging via the MI.
+    @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows.
+    @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races.
+    def test_lldbmi_target_list(self):
+        """Test that 'lldb-mi --interpreter' can list targets by 'target list' command."""
+
+        self.spawnLldbMi(args=None)
+
+        # Test that initially there are no targets.
+        self.runCmd("-interpreter-exec console \"target list\"")
+        self.expect(r"~\"No targets.\\n\"")
+
+        # Add target.
+        self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+
+        # Test that "target list" lists added target.
+        self.runCmd("-interpreter-exec console \"target list\"")
+        self.expect(r"~\"Current targets:\\n\* target #0: %s" % self.myexe)
+
     @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
     @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
     @skipIfRemote   # We do not currently support remote debugging via the MI.




More information about the lldb-commits mailing list