diff options
Diffstat (limited to 'lldb/test/expression_command')
23 files changed, 48 insertions, 171 deletions
diff --git a/lldb/test/expression_command/call-function/TestCallStdStringFunction.py b/lldb/test/expression_command/call-function/TestCallStdStringFunction.py index ca09285858e..736af5b6334 100644 --- a/lldb/test/expression_command/call-function/TestCallStdStringFunction.py +++ b/lldb/test/expression_command/call-function/TestCallStdStringFunction.py @@ -2,7 +2,8 @@ Test calling std::String member functions. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -38,9 +39,3 @@ class ExprCommandCallFunctionTestCase(TestBase): # const char *, and thus don't invoke the Summary formatter. self.expect("print str.c_str()", substrs = ['Hello world']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/call-function/TestCallStopAndContinue.py b/lldb/test/expression_command/call-function/TestCallStopAndContinue.py index 1f34ad3addc..10a4c21d0a8 100644 --- a/lldb/test/expression_command/call-function/TestCallStopAndContinue.py +++ b/lldb/test/expression_command/call-function/TestCallStopAndContinue.py @@ -2,7 +2,8 @@ Test calling a function, stopping in the call, continue and gather the result on stop. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -41,9 +42,3 @@ class ExprCommandCallStopContinueTestCase(TestBase): self.expect ("thread list", substrs = ['stop reason = User Expression thread plan', r'Completed expression: (Five) $0 = (number = 5, name = "five")']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py b/lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py index c71f901d69f..c9a1db2b427 100644 --- a/lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py +++ b/lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py @@ -7,7 +7,8 @@ Note: """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -47,10 +48,3 @@ class ExprCommandCallUserDefinedFunction(TestBase): # Test function with pointer paramter self.expect("exp stringCompare((const char*) \"Hello world\")", substrs = ['$4 = true']) self.expect("exp stringCompare((const char*) \"Hellworld\")", substrs = ['$5 = false']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/call-restarts/TestCallThatRestarts.py b/lldb/test/expression_command/call-restarts/TestCallThatRestarts.py index 289341e5df8..f5480c27407 100644 --- a/lldb/test/expression_command/call-restarts/TestCallThatRestarts.py +++ b/lldb/test/expression_command/call-restarts/TestCallThatRestarts.py @@ -2,7 +2,8 @@ Test calling a function that hits a signal set to auto-restart, make sure the call completes. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -134,9 +135,3 @@ class ExprCommandThatRestartsTestCase(TestBase): frame = self.thread.GetFrameAtIndex(0) self.assertTrue (frame.GetPC() == self.orig_frame_pc, "Continuing returned to the place we started.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/call-throws/TestCallThatThrows.py b/lldb/test/expression_command/call-throws/TestCallThatThrows.py index 7d99d052774..e5ac994d7b5 100644 --- a/lldb/test/expression_command/call-throws/TestCallThatThrows.py +++ b/lldb/test/expression_command/call-throws/TestCallThatThrows.py @@ -2,7 +2,8 @@ Test calling a function that throws an ObjC exception, make sure that it doesn't propagate the exception. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -107,9 +108,3 @@ class ExprCommandWithThrowTestCase(TestBase): self.assertTrue (value.IsValid() and value.GetError().Success() == False) self.check_after_call() - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/char/TestExprsChar.py b/lldb/test/expression_command/char/TestExprsChar.py index 0a8319f95cb..c5745189d56 100644 --- a/lldb/test/expression_command/char/TestExprsChar.py +++ b/lldb/test/expression_command/char/TestExprsChar.py @@ -1,4 +1,5 @@ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -64,9 +65,3 @@ class ExprCharTestCase(TestBase): @expectedFailureWindows("llvm.org/pr21765") def test_unsigned_char(self): self.do_test(dictionary={'CFLAGS_EXTRAS': '-funsigned-char'}) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py b/lldb/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py index c8a97c70b93..4d1ba4bec59 100644 --- a/lldb/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py +++ b/lldb/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py @@ -1,7 +1,8 @@ """Test that we are able to evaluate expressions when the inferior is blocked in a syscall""" +import lldb_shared + import os -import unittest2 import lldb from lldbtest import * import lldbutil @@ -77,9 +78,3 @@ class ExprSyscallTestCase(TestBase): self.assertEqual(process.GetState(), lldb.eStateExited) self.assertEqual(process.GetExitStatus(), 0) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/formatters/TestFormatters.py b/lldb/test/expression_command/formatters/TestFormatters.py index 12cf3e12871..a86961a32b8 100644 --- a/lldb/test/expression_command/formatters/TestFormatters.py +++ b/lldb/test/expression_command/formatters/TestFormatters.py @@ -2,7 +2,8 @@ Test using LLDB data formatters with frozen objects coming from the expression parser. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -162,9 +163,3 @@ class ExprFormattersTestCase(TestBase): self.assertTrue(a_data.GetUnsignedInt32(error, 8) == 3, 'numbers[2] == 3') self.assertTrue(a_data.GetUnsignedInt32(error, 12) == 4, 'numbers[3] == 4') self.assertTrue(a_data.GetUnsignedInt32(error, 16) == 5, 'numbers[4] == 5') - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/issue_11588/Test11588.py b/lldb/test/expression_command/issue_11588/Test11588.py index be631ed1d7d..d1793c3f96f 100644 --- a/lldb/test/expression_command/issue_11588/Test11588.py +++ b/lldb/test/expression_command/issue_11588/Test11588.py @@ -4,8 +4,9 @@ valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider """ +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -72,10 +73,3 @@ class Issue11581TestCase(TestBase): "load_address = ", hex(addr)[2:].rstrip("L"), str(addr)]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/options/TestExprOptions.py b/lldb/test/expression_command/options/TestExprOptions.py index ae9dcf64277..18394efc010 100644 --- a/lldb/test/expression_command/options/TestExprOptions.py +++ b/lldb/test/expression_command/options/TestExprOptions.py @@ -7,8 +7,9 @@ o test_expr_options: Test expression command options. """ +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -71,9 +72,3 @@ class ExprOptionsTestCase(TestBase): val = frame.EvaluateExpression('foo != nullptr', options) self.assertTrue(val.IsValid()) self.assertFalse(val.GetError().Success()) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py b/lldb/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py index f58ccc1706b..a179205a2d9 100644 --- a/lldb/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py +++ b/lldb/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py @@ -2,7 +2,8 @@ Test that we can p *objcObject """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -45,9 +46,3 @@ class PersistObjCPointeeType(TestBase): '_sc_name6 = nil', '_sc_name7 = nil', '_sc_name8 = nil']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py b/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py index 6ea706a0bcb..312d9de6d10 100644 --- a/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py +++ b/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py @@ -2,7 +2,8 @@ Test that we can have persistent pointer variables """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -36,9 +37,3 @@ class PersistentPtrUpdateTestCase(TestBase): self.runCmd("continue") self.expect("expr $foo", substrs=['$foo','0x0']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/persistent_types/TestNestedPersistentTypes.py b/lldb/test/expression_command/persistent_types/TestNestedPersistentTypes.py index b9269058f37..4fd34830a75 100644 --- a/lldb/test/expression_command/persistent_types/TestNestedPersistentTypes.py +++ b/lldb/test/expression_command/persistent_types/TestNestedPersistentTypes.py @@ -2,8 +2,9 @@ Test that nested persistent types work. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -36,9 +37,3 @@ class NestedPersistentTypesTestCase(TestBase): self.expect("expression $my_bar.end.b", substrs = ['(int)', '5']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/persistent_types/TestPersistentTypes.py b/lldb/test/expression_command/persistent_types/TestPersistentTypes.py index 7f0eb648bbd..0ced7700727 100644 --- a/lldb/test/expression_command/persistent_types/TestPersistentTypes.py +++ b/lldb/test/expression_command/persistent_types/TestPersistentTypes.py @@ -2,8 +2,9 @@ Test that lldb persistent types works correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -52,10 +53,3 @@ class PersistenttypesTestCase(TestBase): self.expect("expression struct A { int x; int y; }; struct { struct A a; int z; } object; object.a.y = 1; object.z = 3; object.a.x = 2; object", substrs = ['x = 2', 'y = 1', 'z = 3']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py b/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py index 77d1c251915..3a10a98475c 100644 --- a/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py +++ b/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py @@ -2,8 +2,9 @@ Test that lldb persistent variables works correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -49,9 +50,3 @@ class PersistentVariablesTestCase(TestBase): self.expect("expression (long)$4", startstr = "(long) $6 = -2") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/po_verbosity/TestPoVerbosity.py b/lldb/test/expression_command/po_verbosity/TestPoVerbosity.py index 2a9ed7c9779..829b35dd091 100644 --- a/lldb/test/expression_command/po_verbosity/TestPoVerbosity.py +++ b/lldb/test/expression_command/po_verbosity/TestPoVerbosity.py @@ -2,7 +2,8 @@ Test that the po command acts correctly. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -56,10 +57,3 @@ class PoVerbosityTestCase(TestBase): self.expect("expr -O -v -- 22", substrs = ['(int) $', ' = 22']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/radar_8638051/Test8638051.py b/lldb/test/expression_command/radar_8638051/Test8638051.py index fa1f1756dba..2cff7fe13fc 100644 --- a/lldb/test/expression_command/radar_8638051/Test8638051.py +++ b/lldb/test/expression_command/radar_8638051/Test8638051.py @@ -2,8 +2,9 @@ Test the robustness of lldb expression parser. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -34,10 +35,3 @@ class Radar8638051TestCase(TestBase): self.expect("expression &val", startstr = "(int *) $2 = ") # (int *) $2 = 0x.... - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py b/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py index 0a1a9b81ffe..31d120fccef 100644 --- a/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py +++ b/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py @@ -2,8 +2,9 @@ The evaluating printf(...) after break stop and then up a stack frame. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -37,10 +38,3 @@ class Radar9531204TestCase(TestBase): # This does not currently. self.runCmd('expression (int)printf("argc is: %d.\\n", argc)') - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py b/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py index 58f04554ed6..c412bce7c49 100644 --- a/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py +++ b/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py @@ -2,8 +2,9 @@ Test example snippets from the lldb 'help expression' output. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -36,10 +37,3 @@ class Radar9673644TestCase(TestBase): substrs = ["'f'"]) # runCmd: expr char c[] = "foo"; c[0] # output: (char) $0 = 'f' - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/test/TestExprs.py b/lldb/test/expression_command/test/TestExprs.py index 3545e34e74a..12bdfa24d6c 100644 --- a/lldb/test/expression_command/test/TestExprs.py +++ b/lldb/test/expression_command/test/TestExprs.py @@ -11,8 +11,11 @@ o test_expr_commands_can_handle_quotes: Throw some expression commands with quotes at lldb. """ -import os, time +import lldb_shared + import unittest2 + +import os, time import lldb import lldbutil from lldbtest import * @@ -243,9 +246,3 @@ class BasicExprCommandsTestCase(TestBase): self.expect('print_hi', substrs = ['(int) $', '6']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/test/TestExprs2.py b/lldb/test/expression_command/test/TestExprs2.py index 5e52c5e94de..a2dd98cfbce 100644 --- a/lldb/test/expression_command/test/TestExprs2.py +++ b/lldb/test/expression_command/test/TestExprs2.py @@ -2,8 +2,9 @@ Test some more expression commands. """ +import lldb_shared + import os -import unittest2 import lldb import lldbutil from lldbtest import * @@ -55,10 +56,3 @@ class ExprCommands2TestCase(TestBase): self.expect("expression $4 + 1", startstr = "(int) $5 = 24") # (int) $5 = 6 - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/timeout/TestCallWithTimeout.py b/lldb/test/expression_command/timeout/TestCallWithTimeout.py index f59cd7564dc..e63cebede52 100644 --- a/lldb/test/expression_command/timeout/TestCallWithTimeout.py +++ b/lldb/test/expression_command/timeout/TestCallWithTimeout.py @@ -2,7 +2,8 @@ Test calling a function that waits a while, and make sure the timeout option to expr works. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -87,10 +88,3 @@ class ExprCommandWithTimeoutsTestCase(TestBase): value = frame.EvaluateExpression ("wait_a_while (1000)", options) self.assertTrue(value.IsValid()) self.assertTrue (value.GetError().Success() == True) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py b/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py index 8279a75684e..93c8218c4b9 100644 --- a/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py +++ b/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py @@ -4,7 +4,8 @@ Regression test for <rdar://problem/8981098>: The expression parser's type search only looks in the current compilation unit for types. """ -import unittest2 +import lldb_shared + import lldb from lldbtest import * import lldbutil @@ -34,10 +35,3 @@ class ObjCTypeQueryTestCase(TestBase): self.expect("expression (NSArray*)array_token", substrs = ['(NSArray *) $0 = 0x']) # (NSArray *) $0 = 0x00007fff70118398 - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() |