[Lldb-commits] [lldb] r110379 - in /lldb/trunk/test: array_types/TestArrayTypes.py class_types/TestClassTypes.py command_source/TestCommandSource.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 set_values/TestSetValues.py stl/TestSTL.py struct_types/TestStructTypes.py unsigned_types/TestUnsignedTypes.py

Johnny Chen johnny.chen at apple.com
Thu Aug 5 14:23:45 PDT 2010


Author: johnny
Date: Thu Aug  5 16:23:45 2010
New Revision: 110379

URL: http://llvm.org/viewvc/llvm-project?rev=110379&view=rev
Log:
When running a single test case, lldb.SBDebugger.Terminate() is not being called
because unittest.main() calls sys.exit() before returning.  Fixed by registering
an exit handler for this situation.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/command_source/TestCommandSource.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/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=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Thu Aug  5 16:23:45 2010
@@ -71,6 +71,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Thu Aug  5 16:23:45 2010
@@ -48,6 +48,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/command_source/TestCommandSource.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/TestCommandSource.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/command_source/TestCommandSource.py (original)
+++ lldb/trunk/test/command_source/TestCommandSource.py Thu Aug  5 16:23:45 2010
@@ -30,6 +30,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/dead-strip/TestDeadStrip.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/TestDeadStrip.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/dead-strip/TestDeadStrip.py (original)
+++ lldb/trunk/test/dead-strip/TestDeadStrip.py Thu Aug  5 16:23:45 2010
@@ -79,6 +79,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/TestFunctionTypes.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/function_types/TestFunctionTypes.py (original)
+++ lldb/trunk/test/function_types/TestFunctionTypes.py Thu Aug  5 16:23:45 2010
@@ -64,6 +64,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/TestGlobalVariables.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/global_variables/TestGlobalVariables.py Thu Aug  5 16:23:45 2010
@@ -54,6 +54,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/help/TestHelp.py (original)
+++ lldb/trunk/test/help/TestHelp.py Thu Aug  5 16:23:45 2010
@@ -36,6 +36,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Aug  5 16:23:45 2010
@@ -30,6 +30,7 @@
 import os
 import unittest
 import lldb
+import traceback
 
 class TestBase(unittest.TestCase):
     """This LLDB abstract base class is meant to be subclassed."""
@@ -38,6 +39,8 @@
     mydir = None
 
     def setUp(self):
+        #traceback.print_stack()
+
         # Fail fast if 'mydir' attribute is not overridden.
         if not self.mydir or len(self.mydir) == 0:
             raise Exception("Subclasses must override the 'mydir' attribute.")

Modified: lldb/trunk/test/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/load_unload/TestLoadUnload.py Thu Aug  5 16:23:45 2010
@@ -67,6 +67,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/order/TestOrderFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/order/TestOrderFile.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/order/TestOrderFile.py (original)
+++ lldb/trunk/test/order/TestOrderFile.py Thu Aug  5 16:23:45 2010
@@ -34,6 +34,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/set_values/TestSetValues.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/set_values/TestSetValues.py (original)
+++ lldb/trunk/test/set_values/TestSetValues.py Thu Aug  5 16:23:45 2010
@@ -112,6 +112,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/stl/TestSTL.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/stl/TestSTL.py (original)
+++ lldb/trunk/test/stl/TestSTL.py Thu Aug  5 16:23:45 2010
@@ -53,7 +53,8 @@
         # This assertion currently always fails.
         # This might be related: rdar://problem/8247112.
         #
-        self.assertTrue(res.Succeeded())
+        self.assertTrue(res.Succeeded(),
+                        'Command "thread step-in" returns successfully')
 
         #self.ci.HandleCommand("process status", res)
         #print "process status:", res.GetOutput()
@@ -63,13 +64,15 @@
         output = res.GetOutput()
         self.assertTrue(output.find('[inlined]') > 0 and
                         output.find('basic_string.h') and
-                        output.find('stop reason = step in,') > 0)
+                        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
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/struct_types/TestStructTypes.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/struct_types/TestStructTypes.py (original)
+++ lldb/trunk/test/struct_types/TestStructTypes.py Thu Aug  5 16:23:45 2010
@@ -49,6 +49,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()

Modified: lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/TestUnsignedTypes.py?rev=110379&r1=110378&r2=110379&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/trunk/test/unsigned_types/TestUnsignedTypes.py Thu Aug  5 16:23:45 2010
@@ -67,6 +67,7 @@
 
 
 if __name__ == '__main__':
+    import atexit
     lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
     unittest.main()
-    lldb.SBDebugger.Terminate()





More information about the lldb-commits mailing list