summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-08-05 21:23:45 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-08-05 21:23:45 +0000
commita21249597e021c197b0e9e4a59490a4159e82f2e (patch)
tree90e76fc40d58ff6b3a26612012075ac3f6615129 /lldb/test
parentf03cdc5d278540a4407402d7cb784837727cf8a2 (diff)
downloadbcm5719-llvm-a21249597e021c197b0e9e4a59490a4159e82f2e.tar.gz
bcm5719-llvm-a21249597e021c197b0e9e4a59490a4159e82f2e.zip
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. llvm-svn: 110379
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/array_types/TestArrayTypes.py3
-rw-r--r--lldb/test/class_types/TestClassTypes.py3
-rw-r--r--lldb/test/command_source/TestCommandSource.py3
-rw-r--r--lldb/test/dead-strip/TestDeadStrip.py3
-rw-r--r--lldb/test/function_types/TestFunctionTypes.py3
-rw-r--r--lldb/test/global_variables/TestGlobalVariables.py3
-rw-r--r--lldb/test/help/TestHelp.py3
-rw-r--r--lldb/test/lldbtest.py3
-rw-r--r--lldb/test/load_unload/TestLoadUnload.py3
-rw-r--r--lldb/test/order/TestOrderFile.py3
-rw-r--r--lldb/test/set_values/TestSetValues.py3
-rw-r--r--lldb/test/stl/TestSTL.py9
-rw-r--r--lldb/test/struct_types/TestStructTypes.py3
-rw-r--r--lldb/test/unsigned_types/TestUnsignedTypes.py3
14 files changed, 33 insertions, 15 deletions
diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py
index 277da9a65c5..d3f516ea996 100644
--- a/lldb/test/array_types/TestArrayTypes.py
+++ b/lldb/test/array_types/TestArrayTypes.py
@@ -71,6 +71,7 @@ class TestArrayTypes(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py
index 689216c62b3..e88d8b591b4 100644
--- a/lldb/test/class_types/TestClassTypes.py
+++ b/lldb/test/class_types/TestClassTypes.py
@@ -48,6 +48,7 @@ class TestClassTypes(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/command_source/TestCommandSource.py b/lldb/test/command_source/TestCommandSource.py
index 59a97e55c21..23e5815db7c 100644
--- a/lldb/test/command_source/TestCommandSource.py
+++ b/lldb/test/command_source/TestCommandSource.py
@@ -30,6 +30,7 @@ class TestCommandSource(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/dead-strip/TestDeadStrip.py b/lldb/test/dead-strip/TestDeadStrip.py
index b87dd569b7b..314c600123e 100644
--- a/lldb/test/dead-strip/TestDeadStrip.py
+++ b/lldb/test/dead-strip/TestDeadStrip.py
@@ -79,6 +79,7 @@ class TestDeadStrip(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/function_types/TestFunctionTypes.py b/lldb/test/function_types/TestFunctionTypes.py
index 015feec8083..6d27697e9ac 100644
--- a/lldb/test/function_types/TestFunctionTypes.py
+++ b/lldb/test/function_types/TestFunctionTypes.py
@@ -64,6 +64,7 @@ class TestFunctionTypes(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/global_variables/TestGlobalVariables.py b/lldb/test/global_variables/TestGlobalVariables.py
index 2701df98f8d..36ddf652576 100644
--- a/lldb/test/global_variables/TestGlobalVariables.py
+++ b/lldb/test/global_variables/TestGlobalVariables.py
@@ -54,6 +54,7 @@ class TestGlobalVariables(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/help/TestHelp.py b/lldb/test/help/TestHelp.py
index d4947274830..6b2b7180986 100644
--- a/lldb/test/help/TestHelp.py
+++ b/lldb/test/help/TestHelp.py
@@ -36,6 +36,7 @@ class TestHelpCommand(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 8d20fff53ef..0a8846fc8f5 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -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 @@ class TestBase(unittest.TestCase):
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.")
diff --git a/lldb/test/load_unload/TestLoadUnload.py b/lldb/test/load_unload/TestLoadUnload.py
index 5547e9c8e2a..1e74174c78f 100644
--- a/lldb/test/load_unload/TestLoadUnload.py
+++ b/lldb/test/load_unload/TestLoadUnload.py
@@ -67,6 +67,7 @@ class TestLoadUnload(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/order/TestOrderFile.py b/lldb/test/order/TestOrderFile.py
index ab164c9bb09..c809f0b3809 100644
--- a/lldb/test/order/TestOrderFile.py
+++ b/lldb/test/order/TestOrderFile.py
@@ -34,6 +34,7 @@ class TestOrderFile(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/set_values/TestSetValues.py b/lldb/test/set_values/TestSetValues.py
index b17cf4a2512..d75087c5ff7 100644
--- a/lldb/test/set_values/TestSetValues.py
+++ b/lldb/test/set_values/TestSetValues.py
@@ -112,6 +112,7 @@ class TestSetValues(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/stl/TestSTL.py b/lldb/test/stl/TestSTL.py
index eb285f9787d..aaac22b2d05 100644
--- a/lldb/test/stl/TestSTL.py
+++ b/lldb/test/stl/TestSTL.py
@@ -53,7 +53,8 @@ class TestSTL(lldbtest.TestBase):
# 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 @@ class TestSTL(lldbtest.TestBase):
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()
diff --git a/lldb/test/struct_types/TestStructTypes.py b/lldb/test/struct_types/TestStructTypes.py
index 83508045c37..38bb22b8cba 100644
--- a/lldb/test/struct_types/TestStructTypes.py
+++ b/lldb/test/struct_types/TestStructTypes.py
@@ -49,6 +49,7 @@ class TestStructTypes(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
diff --git a/lldb/test/unsigned_types/TestUnsignedTypes.py b/lldb/test/unsigned_types/TestUnsignedTypes.py
index b79023dc530..f9abe573f06 100644
--- a/lldb/test/unsigned_types/TestUnsignedTypes.py
+++ b/lldb/test/unsigned_types/TestUnsignedTypes.py
@@ -67,6 +67,7 @@ class TestUnsignedTypes(lldbtest.TestBase):
if __name__ == '__main__':
+ import atexit
lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest.main()
- lldb.SBDebugger.Terminate()
OpenPOWER on IntegriCloud