[Lldb-commits] [lldb] r111188 - in /lldb/trunk/test: array_types/TestArrayTypes.py class_types/TestClassTypes.py dead-strip/TestDeadStrip.py function_types/TestFunctionTypes.py global_variables/TestGlobalVariables.py help/TestHelp.py lldbtest.py load_unload/TestLoadUnload.py order/TestOrderFile.py persistent_variables/TestPersistentVariables.py set_values/TestSetValues.py stl/TestSTL.py struct_types/TestStructTypes.py unsigned_types/TestUnsignedTypes.py

Johnny Chen johnny.chen at apple.com
Mon Aug 16 14:28:10 PDT 2010


Author: johnny
Date: Mon Aug 16 16:28:10 2010
New Revision: 111188

URL: http://llvm.org/viewvc/llvm-project?rev=111188&view=rev
Log:
Factored the "continue" command execution of the inferior process as part of the
cleanup before finish into the test fixture in lldbtest.TestBase.tearDown().

Derivatives of TestBase is responsible for setting self.runStarted to True if an
inferior process has been started.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/dead-strip/TestDeadStrip.py
    lldb/trunk/test/function_types/TestFunctionTypes.py
    lldb/trunk/test/global_variables/TestGlobalVariables.py
    lldb/trunk/test/help/TestHelp.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/load_unload/TestLoadUnload.py
    lldb/trunk/test/order/TestOrderFile.py
    lldb/trunk/test/persistent_variables/TestPersistentVariables.py
    lldb/trunk/test/set_values/TestSetValues.py
    lldb/trunk/test/stl/TestSTL.py
    lldb/trunk/test/struct_types/TestStructTypes.py
    lldb/trunk/test/unsigned_types/TestUnsignedTypes.py

Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Mon Aug 16 16:28:10 2010
@@ -24,7 +24,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -73,9 +73,6 @@
         self.assertTrue(res.GetOutput().startswith('(long [6])'),
                         VARIABLES_DISPLAYED_CORRECTLY)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Mon Aug 16 16:28:10 2010
@@ -24,7 +24,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -47,9 +47,6 @@
         self.assertTrue(res.GetOutput().startswith('(class C *const) this = '),
                         VARIABLES_DISPLAYED_CORRECTLY)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/dead-strip/TestDeadStrip.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/TestDeadStrip.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/dead-strip/TestDeadStrip.py (original)
+++ lldb/trunk/test/dead-strip/TestDeadStrip.py Mon Aug 16 16:28:10 2010
@@ -43,7 +43,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint (breakpoint #1).
@@ -81,9 +81,6 @@
         self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0,
                         BREAKPOINT_HIT_ONCE)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/TestFunctionTypes.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/function_types/TestFunctionTypes.py (original)
+++ lldb/trunk/test/function_types/TestFunctionTypes.py Mon Aug 16 16:28:10 2010
@@ -24,7 +24,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -64,9 +64,6 @@
                         output.find('stop reason = breakpoint') > 0,
                         STOPPED_DUE_TO_BREAKPOINT)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/TestGlobalVariables.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/global_variables/TestGlobalVariables.py Mon Aug 16 16:28:10 2010
@@ -24,7 +24,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -53,9 +53,6 @@
                         output.find('g_file_global_cstr') > 0,
                         VARIABLES_DISPLAYED_CORRECTLY)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/help/TestHelp.py (original)
+++ lldb/trunk/test/help/TestHelp.py Mon Aug 16 16:28:10 2010
@@ -17,7 +17,6 @@
         """A simple test of 'help' command and its output."""
         res = lldb.SBCommandReturnObject()
         self.ci.HandleCommand("help", res)
-        #time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             'The following is a list of built-in, permanent debugger commands'),
@@ -27,10 +26,8 @@
         """Command 'set term-width 0' should not hang the help command."""
         res = lldb.SBCommandReturnObject()
         self.ci.HandleCommand("set term-width 0", res)
-        #time.sleep(0.1)
         self.assertTrue(res.Succeeded(), CMD_MSG('set term-width 0'))
         self.ci.HandleCommand("help", res)
-        #time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             'The following is a list of built-in, permanent debugger commands'),

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Aug 16 16:28:10 2010
@@ -64,6 +64,9 @@
     # The concrete subclass should override this attribute.
     mydir = None
 
+    # State pertaining to the inferior process, if any.
+    runStarted = False
+
     def setUp(self):
         #import traceback
         #traceback.print_stack()
@@ -101,6 +104,10 @@
 
 
     def tearDown(self):
+        # Finish the inferior process, if it was "run" previously.
+        if self.runStarted:
+            self.ci.HandleCommand("continue", self.res)
+
         del self.dbg
 
         # Restore old working directory.

Modified: lldb/trunk/test/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/load_unload/TestLoadUnload.py Mon Aug 16 16:28:10 2010
@@ -28,7 +28,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint and at a_function.
@@ -47,9 +47,6 @@
         self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0,
                         BREAKPOINT_HIT_ONCE)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 #         # We should stop agaian at a_function.
 #         # The stop reason of the thread should be breakpoint and at a_function.
 #         self.ci.HandleCommand("thread list", res)

Modified: lldb/trunk/test/order/TestOrderFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/order/TestOrderFile.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/order/TestOrderFile.py (original)
+++ lldb/trunk/test/order/TestOrderFile.py Mon Aug 16 16:28:10 2010
@@ -31,6 +31,7 @@
                         "Symbols have correct order by the order file")
 
         self.ci.HandleCommand("run", res)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_COMPLETED)
 
 

Modified: lldb/trunk/test/persistent_variables/TestPersistentVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/persistent_variables/TestPersistentVariables.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/persistent_variables/TestPersistentVariables.py (original)
+++ lldb/trunk/test/persistent_variables/TestPersistentVariables.py Mon Aug 16 16:28:10 2010
@@ -22,6 +22,7 @@
         self.assertTrue(res.Succeeded())
 
         self.ci.HandleCommand("run", res)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         self.ci.HandleCommand("expr int $i = 5; $i + 1", res)
@@ -48,6 +49,7 @@
 
         self.ci.HandleCommand("continue", res)
         self.ci.HandleCommand("quit", res)
+        self.runStarted = False
 
 
 if __name__ == '__main__':

Modified: lldb/trunk/test/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/set_values/TestSetValues.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/set_values/TestSetValues.py (original)
+++ lldb/trunk/test/set_values/TestSetValues.py Mon Aug 16 16:28:10 2010
@@ -44,7 +44,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -119,9 +119,6 @@
         # TODO:
         # Now set variable 'i' and check that it is correctly displayed.
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/stl/TestSTL.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/stl/TestSTL.py (original)
+++ lldb/trunk/test/stl/TestSTL.py Mon Aug 16 16:28:10 2010
@@ -31,7 +31,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # Stop at 'std::string hello_world ("Hello World!");'.
@@ -70,9 +70,6 @@
                         output.find('stop reason = step in,') > 0,
                         "Command 'thread backtrace' shows we stepped in STL")
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/struct_types/TestStructTypes.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/struct_types/TestStructTypes.py (original)
+++ lldb/trunk/test/struct_types/TestStructTypes.py Mon Aug 16 16:28:10 2010
@@ -28,7 +28,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # We should be stopped on the first executable statement within the
@@ -47,9 +47,6 @@
         self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0,
                         BREAKPOINT_HIT_ONCE)
 
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
-
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/TestUnsignedTypes.py?rev=111188&r1=111187&r2=111188&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/trunk/test/unsigned_types/TestUnsignedTypes.py Mon Aug 16 16:28:10 2010
@@ -28,7 +28,7 @@
                         BREAKPOINT_CREATED)
 
         self.ci.HandleCommand("run", res)
-        #time.sleep(0.1)
+        self.runStarted = True
         self.assertTrue(res.Succeeded(), RUN_STOPPED)
 
         # The stop reason of the thread should be breakpoint.
@@ -66,9 +66,6 @@
 
             VARIABLES_DISPLAYED_CORRECTLY
             )
-        
-        self.ci.HandleCommand("continue", res)
-        self.assertTrue(res.Succeeded())
 
 
 if __name__ == '__main__':





More information about the lldb-commits mailing list