[Lldb-commits] [lldb] r369646 - [lldb][NFC] Add test for target stop-hook disable/enable/delete

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 06:09:02 PDT 2019


Author: teemperor
Date: Thu Aug 22 06:09:02 2019
New Revision: 369646

URL: http://llvm.org/viewvc/llvm-project?rev=369646&view=rev
Log:
[lldb][NFC] Add test for target stop-hook disable/enable/delete

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py?rev=369646&r1=369645&r2=369646&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py Thu Aug 22 06:09:02 2019
@@ -22,20 +22,25 @@ class targetCommandTestCase(TestBase):
         self.line_b = line_number('b.c', '// Set break point at this line.')
         self.line_c = line_number('c.c', '// Set break point at this line.')
 
-    def test_target_command(self):
-        """Test some target commands: create, list, select."""
+    def buildB(self):
+        db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')}
+        self.build(dictionary=db)
+        self.addTearDownCleanup(dictionary=db)
+
+    def buildAll(self):
         da = {'C_SOURCES': 'a.c', 'EXE': self.getBuildArtifact('a.out')}
         self.build(dictionary=da)
         self.addTearDownCleanup(dictionary=da)
 
-        db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')}
-        self.build(dictionary=db)
-        self.addTearDownCleanup(dictionary=db)
+        self.buildB()
 
         dc = {'C_SOURCES': 'c.c', 'EXE': self.getBuildArtifact('c.out')}
         self.build(dictionary=dc)
         self.addTearDownCleanup(dictionary=dc)
 
+    def test_target_command(self):
+        """Test some target commands: create, list, select."""
+        self.buildAll()
         self.do_target_command()
 
     def test_target_variable_command(self):
@@ -270,3 +275,21 @@ class targetCommandTestCase(TestBase):
             substrs=[
                 "my_global_char",
                 "'X'"])
+
+    @no_debug_info_test
+    def test_target_stop_hook_disable_enable(self):
+        self.buildB()
+        self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET)
+
+        self.expect("target stop-hook disable 1", error=True, substrs=['unknown stop hook id: "1"'])
+        self.expect("target stop-hook disable blub", error=True, substrs=['invalid stop hook id: "blub"'])
+        self.expect("target stop-hook enable 1", error=True, substrs=['unknown stop hook id: "1"'])
+        self.expect("target stop-hook enable blub", error=True, substrs=['invalid stop hook id: "blub"'])
+
+    @no_debug_info_test
+    def test_target_stop_hook_delete(self):
+        self.buildB()
+        self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET)
+
+        self.expect("target stop-hook delete 1", error=True, substrs=['unknown stop hook id: "1"'])
+        self.expect("target stop-hook delete blub", error=True, substrs=['invalid stop hook id: "blub"'])




More information about the lldb-commits mailing list