summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-08-16 21:28:10 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-08-16 21:28:10 +0000
commit6ca006c7c13da67cd3aa19c2067e6990ac97c8d8 (patch)
tree77f90da83646be67cd1fce51ba3622ad60587829
parentdf239670d403fb18a338f1a47ad1326e4a3b9a73 (diff)
downloadbcm5719-llvm-6ca006c7c13da67cd3aa19c2067e6990ac97c8d8.tar.gz
bcm5719-llvm-6ca006c7c13da67cd3aa19c2067e6990ac97c8d8.zip
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. llvm-svn: 111188
-rw-r--r--lldb/test/array_types/TestArrayTypes.py5
-rw-r--r--lldb/test/class_types/TestClassTypes.py5
-rw-r--r--lldb/test/dead-strip/TestDeadStrip.py5
-rw-r--r--lldb/test/function_types/TestFunctionTypes.py5
-rw-r--r--lldb/test/global_variables/TestGlobalVariables.py5
-rw-r--r--lldb/test/help/TestHelp.py3
-rw-r--r--lldb/test/lldbtest.py7
-rw-r--r--lldb/test/load_unload/TestLoadUnload.py5
-rw-r--r--lldb/test/order/TestOrderFile.py1
-rw-r--r--lldb/test/persistent_variables/TestPersistentVariables.py2
-rw-r--r--lldb/test/set_values/TestSetValues.py5
-rw-r--r--lldb/test/stl/TestSTL.py5
-rw-r--r--lldb/test/struct_types/TestStructTypes.py5
-rw-r--r--lldb/test/unsigned_types/TestUnsignedTypes.py5
14 files changed, 20 insertions, 43 deletions
diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py
index b3c8a5f4888..a51f2cdb4dd 100644
--- a/lldb/test/array_types/TestArrayTypes.py
+++ b/lldb/test/array_types/TestArrayTypes.py
@@ -24,7 +24,7 @@ class TestArrayTypes(TestBase):
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 @@ class TestArrayTypes(TestBase):
self.assertTrue(res.GetOutput().startswith('(long [6])'),
VARIABLES_DISPLAYED_CORRECTLY)
- self.ci.HandleCommand("continue", res)
- self.assertTrue(res.Succeeded())
-
if __name__ == '__main__':
import atexit
diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py
index 7ade9050e78..eff6ab35d43 100644
--- a/lldb/test/class_types/TestClassTypes.py
+++ b/lldb/test/class_types/TestClassTypes.py
@@ -24,7 +24,7 @@ class TestClassTypes(TestBase):
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 @@ class TestClassTypes(TestBase):
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
diff --git a/lldb/test/dead-strip/TestDeadStrip.py b/lldb/test/dead-strip/TestDeadStrip.py
index d49987b3812..d705bef9528 100644
--- a/lldb/test/dead-strip/TestDeadStrip.py
+++ b/lldb/test/dead-strip/TestDeadStrip.py
@@ -43,7 +43,7 @@ class TestDeadStrip(TestBase):
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 @@ class TestDeadStrip(TestBase):
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
diff --git a/lldb/test/function_types/TestFunctionTypes.py b/lldb/test/function_types/TestFunctionTypes.py
index 76d27d9c62f..eef4ede6990 100644
--- a/lldb/test/function_types/TestFunctionTypes.py
+++ b/lldb/test/function_types/TestFunctionTypes.py
@@ -24,7 +24,7 @@ class TestFunctionTypes(TestBase):
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 @@ class TestFunctionTypes(TestBase):
output.find('stop reason = breakpoint') > 0,
STOPPED_DUE_TO_BREAKPOINT)
- self.ci.HandleCommand("continue", res)
- self.assertTrue(res.Succeeded())
-
if __name__ == '__main__':
import atexit
diff --git a/lldb/test/global_variables/TestGlobalVariables.py b/lldb/test/global_variables/TestGlobalVariables.py
index 0cc557fe6d5..ceb7c4dfc34 100644
--- a/lldb/test/global_variables/TestGlobalVariables.py
+++ b/lldb/test/global_variables/TestGlobalVariables.py
@@ -24,7 +24,7 @@ class TestGlobalVariables(TestBase):
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 @@ class TestGlobalVariables(TestBase):
output.find('g_file_global_cstr') > 0,
VARIABLES_DISPLAYED_CORRECTLY)
- self.ci.HandleCommand("continue", res)
- self.assertTrue(res.Succeeded())
-
if __name__ == '__main__':
import atexit
diff --git a/lldb/test/help/TestHelp.py b/lldb/test/help/TestHelp.py
index e0782d667bb..1989eb57151 100644
--- a/lldb/test/help/TestHelp.py
+++ b/lldb/test/help/TestHelp.py
@@ -17,7 +17,6 @@ class TestHelpCommand(TestBase):
"""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 @@ class TestHelpCommand(TestBase):
"""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'),
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 1987faae971..75f7e518da4 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -64,6 +64,9 @@ class TestBase(unittest2.TestCase):
# 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 @@ class TestBase(unittest2.TestCase):
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.
diff --git a/lldb/test/load_unload/TestLoadUnload.py b/lldb/test/load_unload/TestLoadUnload.py
index 65da3012934..16629e50b82 100644
--- a/lldb/test/load_unload/TestLoadUnload.py
+++ b/lldb/test/load_unload/TestLoadUnload.py
@@ -28,7 +28,7 @@ class TestLoadUnload(TestBase):
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 @@ class TestLoadUnload(TestBase):
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)
diff --git a/lldb/test/order/TestOrderFile.py b/lldb/test/order/TestOrderFile.py
index 83c801ec301..031c2eeed38 100644
--- a/lldb/test/order/TestOrderFile.py
+++ b/lldb/test/order/TestOrderFile.py
@@ -31,6 +31,7 @@ class TestOrderFile(TestBase):
"Symbols have correct order by the order file")
self.ci.HandleCommand("run", res)
+ self.runStarted = True
self.assertTrue(res.Succeeded(), RUN_COMPLETED)
diff --git a/lldb/test/persistent_variables/TestPersistentVariables.py b/lldb/test/persistent_variables/TestPersistentVariables.py
index c09c8166f78..8aff13ad452 100644
--- a/lldb/test/persistent_variables/TestPersistentVariables.py
+++ b/lldb/test/persistent_variables/TestPersistentVariables.py
@@ -22,6 +22,7 @@ class TestPersistentVariables(TestBase):
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 @@ class TestPersistentVariables(TestBase):
self.ci.HandleCommand("continue", res)
self.ci.HandleCommand("quit", res)
+ self.runStarted = False
if __name__ == '__main__':
diff --git a/lldb/test/set_values/TestSetValues.py b/lldb/test/set_values/TestSetValues.py
index ec17d1da73c..ac8bd3cdbc9 100644
--- a/lldb/test/set_values/TestSetValues.py
+++ b/lldb/test/set_values/TestSetValues.py
@@ -44,7 +44,7 @@ class TestSetValues(TestBase):
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 @@ class TestSetValues(TestBase):
# 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
diff --git a/lldb/test/stl/TestSTL.py b/lldb/test/stl/TestSTL.py
index 15421a6b15c..e909e51898a 100644
--- a/lldb/test/stl/TestSTL.py
+++ b/lldb/test/stl/TestSTL.py
@@ -31,7 +31,7 @@ class TestSTL(TestBase):
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 @@ class TestSTL(TestBase):
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
diff --git a/lldb/test/struct_types/TestStructTypes.py b/lldb/test/struct_types/TestStructTypes.py
index f49d1173632..df83148e627 100644
--- a/lldb/test/struct_types/TestStructTypes.py
+++ b/lldb/test/struct_types/TestStructTypes.py
@@ -28,7 +28,7 @@ class TestStructTypes(TestBase):
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 @@ class TestStructTypes(TestBase):
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
diff --git a/lldb/test/unsigned_types/TestUnsignedTypes.py b/lldb/test/unsigned_types/TestUnsignedTypes.py
index e1e99ec98f9..91eb91ecddf 100644
--- a/lldb/test/unsigned_types/TestUnsignedTypes.py
+++ b/lldb/test/unsigned_types/TestUnsignedTypes.py
@@ -28,7 +28,7 @@ class TestUnsignedTypes(TestBase):
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 @@ class TestUnsignedTypes(TestBase):
VARIABLES_DISPLAYED_CORRECTLY
)
-
- self.ci.HandleCommand("continue", res)
- self.assertTrue(res.Succeeded())
if __name__ == '__main__':
OpenPOWER on IntegriCloud