diff options
Diffstat (limited to 'lldb/test')
| -rw-r--r-- | lldb/test/array_types/TestArrayTypes.py | 8 | ||||
| -rw-r--r-- | lldb/test/class_types/TestClassTypes.py | 8 | ||||
| -rwxr-xr-x | lldb/test/dotest.py | 14 | ||||
| -rw-r--r-- | lldb/test/help/TestHelp.py | 8 |
4 files changed, 35 insertions, 3 deletions
diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py index b3659a56688..0afa058dcdb 100644 --- a/lldb/test/array_types/TestArrayTypes.py +++ b/lldb/test/array_types/TestArrayTypes.py @@ -4,15 +4,19 @@ import os, time import lldb import unittest +main = False + class TestArrayTypes(unittest.TestCase): def setUp(self): + global main + # Save old working directory. self.oldcwd = os.getcwd() # Change current working directory if ${LLDB_TEST} is defined. if ("LLDB_TEST" in os.environ): os.chdir(os.path.join(os.environ["LLDB_TEST"], "array_types")); - self.dbg = lldb.SBDebugger.Create() + self.dbg = lldb.SBDebugger.Create() if main else lldb.DBG if not self.dbg.IsValid(): raise Exception('Invalid debugger instance') self.dbg.SetAsync(False) @@ -23,6 +27,7 @@ class TestArrayTypes(unittest.TestCase): def tearDown(self): # Restore old working directory. os.chdir(self.oldcwd) + del self.dbg def test_array_types(self): """Test 'variable list var_name' on some variables with array types.""" @@ -87,5 +92,6 @@ class TestArrayTypes(unittest.TestCase): if __name__ == '__main__': lldb.SBDebugger.Initialize() + main = True unittest.main() lldb.SBDebugger.Terminate() diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py index bfb043cd43e..5953f2843f5 100644 --- a/lldb/test/class_types/TestClassTypes.py +++ b/lldb/test/class_types/TestClassTypes.py @@ -4,15 +4,19 @@ import os, time import lldb import unittest +main = False + class TestClassTypes(unittest.TestCase): def setUp(self): + global main + # Save old working directory. self.oldcwd = os.getcwd() # Change current working directory if ${LLDB_TEST} is defined. if ("LLDB_TEST" in os.environ): os.chdir(os.path.join(os.environ["LLDB_TEST"], "class_types")); - self.dbg = lldb.SBDebugger.Create() + self.dbg = lldb.SBDebugger.Create() if main else lldb.DBG if not self.dbg.IsValid(): raise Exception('Invalid debugger instance') self.dbg.SetAsync(False) @@ -23,6 +27,7 @@ class TestClassTypes(unittest.TestCase): def tearDown(self): # Restore old working directory. os.chdir(self.oldcwd) + del self.dbg def test_class_types(self): """Test 'variable list this' when stopped on a class constructor.""" @@ -64,5 +69,6 @@ class TestClassTypes(unittest.TestCase): if __name__ == '__main__': lldb.SBDebugger.Initialize() + main = True unittest.main() lldb.SBDebugger.Terminate() diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 08c143a6977..5625c796f13 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -141,6 +141,20 @@ for testdir in testdirs: import lldb lldb.SBDebugger.Initialize() +# Create a singleton SBDebugger in the lldb namespace. +lldb.DBG = lldb.SBDebugger.Create() + +# Turn on logging for debugging purposes if ${LLDB_LOG} environment variable is +# is defined. Use ${LLDB_LOG} to specify the log file. +ci = lldb.DBG.GetCommandInterpreter() +res = lldb.SBCommandReturnObject() +if ("LLDB_LOG" in os.environ): + ci.HandleCommand( + "log enable -f " + os.environ["LLDB_LOG"] + " lldb default", res) + pass +if not res.Succeeded(): + raise Exception('log enable failed (check your LLDB_LOG env variable...') + unittest.TextTestRunner(verbosity=verbose).run(suite) # Add some delay before calling SBDebugger.Terminate(). diff --git a/lldb/test/help/TestHelp.py b/lldb/test/help/TestHelp.py index fbfdc8ca25b..0cf7ddb2ba4 100644 --- a/lldb/test/help/TestHelp.py +++ b/lldb/test/help/TestHelp.py @@ -4,15 +4,19 @@ import os, time import lldb import unittest +main = False + class TestHelpCommand(unittest.TestCase): def setUp(self): + global main + # Save old working directory. self.oldcwd = os.getcwd() # Change current working directory if ${LLDB_TEST} is defined. if ("LLDB_TEST" in os.environ): os.chdir(os.path.join(os.environ["LLDB_TEST"], "help")); - self.dbg = lldb.SBDebugger.Create() + self.dbg = lldb.SBDebugger.Create() if main else lldb.DBG if not self.dbg.IsValid(): raise Exception('Invalid debugger instance') self.dbg.SetAsync(False) @@ -23,6 +27,7 @@ class TestHelpCommand(unittest.TestCase): def tearDown(self): # Restore old working directory. os.chdir(self.oldcwd) + del self.dbg def test_simplehelp(self): """A simple test of 'help' command and its output.""" @@ -48,5 +53,6 @@ class TestHelpCommand(unittest.TestCase): if __name__ == '__main__': lldb.SBDebugger.Initialize() + main = True unittest.main() lldb.SBDebugger.Terminate() |

