diff options
Diffstat (limited to 'lldb/test/lang')
92 files changed, 171 insertions, 657 deletions
diff --git a/lldb/test/lang/c/anonymous/TestAnonymous.py b/lldb/test/lang/c/anonymous/TestAnonymous.py index da0ef5b9f11..1899384c1cd 100644 --- a/lldb/test/lang/c/anonymous/TestAnonymous.py +++ b/lldb/test/lang/c/anonymous/TestAnonymous.py @@ -1,7 +1,8 @@ """Test that anonymous structs/unions are transparent to member access""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -142,9 +143,3 @@ class AnonymousTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py index e159efc4382..98e839ca104 100644 --- a/lldb/test/lang/c/array_types/TestArrayTypes.py +++ b/lldb/test/lang/c/array_types/TestArrayTypes.py @@ -1,7 +1,8 @@ """Test breakpoint by file/line number; and list variables with array types.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -193,10 +194,3 @@ class ArrayTypesTestCase(TestBase): self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument, "Variable 'argc' should have '%s' value type." % value_type_to_str(lldb.eValueTypeVariableArgument)) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/bitfields/TestBitfields.py b/lldb/test/lang/c/bitfields/TestBitfields.py index 090b31950e8..024af2d1c5c 100644 --- a/lldb/test/lang/c/bitfields/TestBitfields.py +++ b/lldb/test/lang/c/bitfields/TestBitfields.py @@ -1,7 +1,8 @@ """Show bitfields and check that they display correctly.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -157,10 +158,3 @@ class BitfieldsTestCase(TestBase): # Now kill the process, and we are done. rc = target.GetProcess().Kill() self.assertTrue(rc.Success()) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/blocks/TestBlocks.py b/lldb/test/lang/c/blocks/TestBlocks.py index 6dd4bec46e4..783401e2e0f 100644 --- a/lldb/test/lang/c/blocks/TestBlocks.py +++ b/lldb/test/lang/c/blocks/TestBlocks.py @@ -1,7 +1,9 @@ """Test that lldb can invoke blocks and access variables inside them""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -55,9 +57,3 @@ class BlocksTestCase(TestBase): self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs = ['stopped', 'stop reason = breakpoint']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/const_variables/TestConstVariables.py b/lldb/test/lang/c/const_variables/TestConstVariables.py index 8954e49a189..30fc91adab4 100644 --- a/lldb/test/lang/c/const_variables/TestConstVariables.py +++ b/lldb/test/lang/c/const_variables/TestConstVariables.py @@ -1,7 +1,8 @@ """Check that compiler-generated constant values work correctly""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -57,9 +58,3 @@ class ConstVariableTestCase(TestBase): substrs = ['(int) $1 = 256']) self.runCmd("kill") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/enum_types/TestEnumTypes.py b/lldb/test/lang/c/enum_types/TestEnumTypes.py index 96d290739a8..6f1c52d2844 100644 --- a/lldb/test/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/test/lang/c/enum_types/TestEnumTypes.py @@ -1,7 +1,8 @@ """Look up enum type information and check for correct display.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -66,9 +67,3 @@ class EnumTypesTestCase(TestBase): self.expect("frame variable day", 'check for valid enumeration value', substrs = [enum_value]) lldbutil.continue_to_breakpoint (self.process(), bkpt) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/forward/TestForwardDeclaration.py b/lldb/test/lang/c/forward/TestForwardDeclaration.py index 9eb8ae6d245..6db0b30b567 100644 --- a/lldb/test/lang/c/forward/TestForwardDeclaration.py +++ b/lldb/test/lang/c/forward/TestForwardDeclaration.py @@ -1,7 +1,8 @@ """Test that forward declaration of a data structure gets resolved correctly.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -42,10 +43,3 @@ class ForwardDeclarationTestCase(TestBase): substrs = ['(bar)', '(int) a = 1', '(int) b = 2']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/function_types/TestFunctionTypes.py b/lldb/test/lang/c/function_types/TestFunctionTypes.py index f8ac8a68207..fb46ea8be5e 100644 --- a/lldb/test/lang/c/function_types/TestFunctionTypes.py +++ b/lldb/test/lang/c/function_types/TestFunctionTypes.py @@ -1,7 +1,8 @@ """Test variable with function ptr type and that break on the function works.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -71,9 +72,3 @@ class FunctionTypesTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/global_variables/TestGlobalVariables.py b/lldb/test/lang/c/global_variables/TestGlobalVariables.py index 23005095f43..7d9c0ddaecd 100644 --- a/lldb/test/lang/c/global_variables/TestGlobalVariables.py +++ b/lldb/test/lang/c/global_variables/TestGlobalVariables.py @@ -1,7 +1,8 @@ """Show global variables and check that they do indeed have global scopes.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -72,10 +73,3 @@ class GlobalVariablesTestCase(TestBase): substrs = ['g_marked_spot.y', '21']) self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY, matching=False, substrs = ["can't be resolved"]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/modules/TestCModules.py b/lldb/test/lang/c/modules/TestCModules.py index 1ac8484a5f5..5875c777329 100644 --- a/lldb/test/lang/c/modules/TestCModules.py +++ b/lldb/test/lang/c/modules/TestCModules.py @@ -1,7 +1,8 @@ """Test that importing modules in C works as expected.""" +import lldb_shared + import os, time -import unittest2 import lldb import platform import lldbutil @@ -60,9 +61,3 @@ class CModulesTestCase(TestBase): TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.c', '// Set breakpoint 0 here.') - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/register_variables/TestRegisterVariables.py b/lldb/test/lang/c/register_variables/TestRegisterVariables.py index 9274524c87a..a73bc26e7eb 100644 --- a/lldb/test/lang/c/register_variables/TestRegisterVariables.py +++ b/lldb/test/lang/c/register_variables/TestRegisterVariables.py @@ -1,7 +1,8 @@ """Check that compiler-generated register values work correctly""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -65,9 +66,3 @@ class RegisterVariableTestCase(TestBase): substrs = ['(int) $3 = 5']) self.runCmd("kill") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/set_values/TestSetValues.py b/lldb/test/lang/c/set_values/TestSetValues.py index 4e64a4100ca..ae70f77868e 100644 --- a/lldb/test/lang/c/set_values/TestSetValues.py +++ b/lldb/test/lang/c/set_values/TestSetValues.py @@ -1,7 +1,8 @@ """Test settings and readings of program variables.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -106,10 +107,3 @@ class SetValuesTestCase(TestBase): self.runCmd("expression i = 1.5") self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY, startstr = "(long double) i = 1.5") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/shared_lib/TestSharedLib.py b/lldb/test/lang/c/shared_lib/TestSharedLib.py index f2a84af0161..dd095272d80 100644 --- a/lldb/test/lang/c/shared_lib/TestSharedLib.py +++ b/lldb/test/lang/c/shared_lib/TestSharedLib.py @@ -1,5 +1,7 @@ """Test that types defined in shared libraries work correctly.""" +import lldb_shared + import unittest2 import lldb from lldbtest import * @@ -65,9 +67,3 @@ class SharedLibTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py index c6cd427788c..611a3618a98 100644 --- a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py +++ b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py @@ -1,5 +1,7 @@ """Test that types defined in shared libraries with stripped symbols work correctly.""" +import lldb_shared + import unittest2 import lldb from lldbtest import * @@ -67,9 +69,3 @@ class SharedLibStrippedTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py index 11d639a8902..ed50926fa47 100644 --- a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py +++ b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py @@ -1,7 +1,8 @@ """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -237,9 +238,3 @@ class TestCStepping(TestBase): thread.StepInto("NoSuchFunction") self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/stepping/TestThreadStepping.py b/lldb/test/lang/c/stepping/TestThreadStepping.py index 50322b8287c..e02551b3ac6 100644 --- a/lldb/test/lang/c/stepping/TestThreadStepping.py +++ b/lldb/test/lang/c/stepping/TestThreadStepping.py @@ -2,9 +2,10 @@ Test thread stepping features in combination with frame select. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * import lldbutil @@ -75,10 +76,3 @@ class ThreadSteppingTestCase(TestBase): self.expect("thread backtrace", STEP_OUT_SUCCEEDED, substrs = ["stop reason = step out"], patterns = ["frame #0.*main.c:%d" % self.line4]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/strings/TestCStrings.py b/lldb/test/lang/c/strings/TestCStrings.py index a2752df7976..f1d9be2149f 100644 --- a/lldb/test/lang/c/strings/TestCStrings.py +++ b/lldb/test/lang/c/strings/TestCStrings.py @@ -52,9 +52,3 @@ class CStringsTestCase(TestBase): self.expect("expression !z", substrs = ['false']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py index 564f069f1b9..305ff3984de 100644 --- a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py +++ b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py @@ -1,7 +1,9 @@ """Test that thread-local storage can be read correctly.""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -69,9 +71,3 @@ class TlsGlobalTestCase(TestBase): patterns = ["\(int\) \$.* = 44"]) self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY, patterns = ["\(int\) \$.* = 33"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/c/typedef/Testtypedef.py b/lldb/test/lang/c/typedef/Testtypedef.py index c00bcd4e3c5..5c2882b715d 100644 --- a/lldb/test/lang/c/typedef/Testtypedef.py +++ b/lldb/test/lang/c/typedef/Testtypedef.py @@ -1,7 +1,8 @@ """Look up type information for typedefs of same name at different lexical scope and check for correct display.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -43,9 +44,3 @@ class TypedefTestCase(TestBase): self.expect("image lookup -t a", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['name = "' + t + '"']) self.runCmd("continue") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/bool/TestCPPBool.py b/lldb/test/lang/cpp/bool/TestCPPBool.py index 913821733c1..0724fc56251 100644 --- a/lldb/test/lang/cpp/bool/TestCPPBool.py +++ b/lldb/test/lang/cpp/bool/TestCPPBool.py @@ -24,9 +24,3 @@ class CPPBoolTestCase(TestBase): self.expect("expression -- my_bool = true", startstr = "(bool) $1 = true") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py b/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py index a8b69ded6d4..867bfed4d7f 100644 --- a/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py +++ b/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py @@ -2,8 +2,9 @@ Test lldb breakpoint command for CPP methods & functions in a namespace. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -79,11 +80,3 @@ class CPPBreakpointCommandsTestCase(TestBase): a_out_module, nested_comp_unit) self.assertTrue (plain_method_break.GetNumLocations() == 1) - - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py b/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py index 6adbcd6f790..bba23992c3c 100644 --- a/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py +++ b/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py @@ -31,9 +31,3 @@ class CallCPPFunctionTestCase(TestBase): self.expect("expression -- a_function_to_call()", startstr = "(int) $0 = 0") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py b/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py index a6cf56cd6f6..fa9338ab51b 100644 --- a/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py +++ b/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py @@ -71,9 +71,3 @@ class TestCppChainedCalls(TestBase): test_result = frame.EvaluateExpression("get(t) && get(t)") self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(t) && get(t) = true") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py index f604c34516d..7392f79bce7 100644 --- a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py +++ b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py @@ -3,8 +3,9 @@ Test that the C++11 support for char16_t and char32_t works correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -85,9 +86,3 @@ class Char1632TestCase(TestBase): # Check that we can run expressions that return charN_t self.expect("expression u'a'",substrs = ['(char16_t) $',"61 u'a'"]) self.expect("expression U'a'",substrs = ['(char32_t) $',"61 U'a'"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/lang/cpp/class_static/TestStaticVariables.py index 88aeb72a799..c9182fe69d7 100644 --- a/lldb/test/lang/cpp/class_static/TestStaticVariables.py +++ b/lldb/test/lang/cpp/class_static/TestStaticVariables.py @@ -2,8 +2,9 @@ Test display and Python APIs on file and class static variables. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -115,10 +116,3 @@ class StaticVariableTestCase(TestBase): val = frame.FindValue("hello_world", lldb.eValueTypeVariableLocal) self.DebugSBValue(val) self.assertTrue(val.GetName() == 'hello_world') - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/class_types/TestClassTypes.py b/lldb/test/lang/cpp/class_types/TestClassTypes.py index 2e9353b5b65..6d737e04c99 100644 --- a/lldb/test/lang/cpp/class_types/TestClassTypes.py +++ b/lldb/test/lang/cpp/class_types/TestClassTypes.py @@ -1,7 +1,8 @@ """Test breakpoint on a class constructor; and variable list the this object.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -210,9 +211,3 @@ class ClassTypesTestCase(TestBase): self.assertTrue (frame.IsValid(), "Got a valid frame.") self.assertTrue ("C::C" in frame.name, "Constructor name includes class name.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py index 866b100cbf5..031c2b352e9 100644 --- a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py +++ b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py @@ -2,8 +2,9 @@ Test the lldb disassemble command on each call frame when stopped on C's ctor. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -89,9 +90,3 @@ class IterateFrameAndDisassembleTestCase(TestBase): # We should be stopped on the ctor function of class C. # self.expect("thread backtrace", BACKTRACE_DISPLAYED_CORRECTLY, # substrs = ['C::C']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/diamond/TestDiamond.py b/lldb/test/lang/cpp/diamond/TestDiamond.py index 6c9f6e4a32a..f4222ebedfe 100644 --- a/lldb/test/lang/cpp/diamond/TestDiamond.py +++ b/lldb/test/lang/cpp/diamond/TestDiamond.py @@ -39,9 +39,3 @@ class CPPTestDiamondInheritance(TestBase): # Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary # operator in the test program, while others emit only 1. lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py b/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py index 431f19f7ae4..f46bad7dd9c 100644 --- a/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py +++ b/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py @@ -2,9 +2,11 @@ Test lldb Python API SBValue::Cast(SBType) for C++ types. """ +import lldb_shared + +import unittest2 import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -122,10 +124,3 @@ class CppValueCastTestCase(TestBase): b_member_val = instanceB.GetChildMemberWithName('m_b_val') self.DebugSBValue(b_member_val) self.assertTrue(b_member_val.GetValueAsUnsigned(error, 0) == 36) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py index f7f9e67a014..3ef4193a917 100644 --- a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py +++ b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py @@ -2,9 +2,10 @@ Use lldb Python API to test dynamic values in C++ """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -217,10 +218,3 @@ class DynamicValueTestCase(TestBase): contained_b_static_addr = int (contained_b_static.GetValue(), 16) self.assertTrue (contained_b_addr < contained_b_static_addr) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py index e8072efa8b2..c0fb3103892 100644 --- a/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py +++ b/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py @@ -1,7 +1,8 @@ """Look up enum type information and check for correct display.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -105,8 +106,3 @@ class CPP11EnumTypesTestCase(TestBase): self.expect("frame variable day", 'check for valid enumeration value', substrs = [enum_value]) lldbutil.continue_to_breakpoint (self.process(), bkpt) -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py b/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py index cc6805e8dc1..51135c7a0a1 100644 --- a/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py +++ b/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py @@ -2,8 +2,9 @@ Test lldb exception breakpoint command for CPP. """ +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -60,10 +61,3 @@ class CPPBreakpointTestCase(TestBase): self.assertTrue (frame_functions.count ("throws_exception_on_even(int)") == 0, "At catch our throw function is off the stack") self.assertTrue (frame_functions.count ("intervening_function(int)") == 0, "At catch our intervening function is off the stack") self.assertTrue (frame_functions.count ("catches_exception(int)") == 1, "At catch our catch function is on the stack") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py b/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py index 6299116d19a..68ff52eb4d1 100644 --- a/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py +++ b/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py @@ -52,10 +52,3 @@ class TestCppGlobalOperators(TestBase): test_result = frame.EvaluateExpression("operator==(s2, s3)") self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "operator==(s2, s3) = false") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py b/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py index 931f546c777..2764f311667 100644 --- a/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py +++ b/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py @@ -63,9 +63,3 @@ class TestCppIncompleteTypes(TestBase): # Get frame for current thread return thread.GetSelectedFrame() - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/namespace/TestNamespace.py b/lldb/test/lang/cpp/namespace/TestNamespace.py index fd598813e83..08825c41af5 100644 --- a/lldb/test/lang/cpp/namespace/TestNamespace.py +++ b/lldb/test/lang/cpp/namespace/TestNamespace.py @@ -2,8 +2,9 @@ Test the printing of anonymous and named namespace variables. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -106,9 +107,3 @@ class NamespaceTestCase(TestBase): self.expect("p variadic_sum", patterns = ['\(anonymous namespace\)::variadic_sum\(int, ...\)']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/nsimport/TestCppNsImport.py b/lldb/test/lang/cpp/nsimport/TestCppNsImport.py index 076356dd162..3411959aaa1 100644 --- a/lldb/test/lang/cpp/nsimport/TestCppNsImport.py +++ b/lldb/test/lang/cpp/nsimport/TestCppNsImport.py @@ -98,10 +98,3 @@ class TestCppNsImport(TestBase): # Test function inside namespace test_result = frame.EvaluateExpression("fun_var") self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 5, "fun_var = 5") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py b/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py index 38cec0f472e..7eff685abca 100644 --- a/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py +++ b/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py @@ -34,9 +34,3 @@ class CPPStaticMethodsTestCase(TestBase): self.expect("expression -- Static()", startstr = "(int) $1 = 1") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py b/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py index 23bf8a122c6..4ac48e1866b 100644 --- a/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py +++ b/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py @@ -3,8 +3,10 @@ Test that the expression parser returns proper Unicode strings. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -79,9 +81,3 @@ class Rdar12991846TestCase(TestBase): if expr == 2: self.expect('expression u"hello"', substrs = ['hello']) if expr == 3: self.expect('expression U"hello"', substrs = ['hello']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py index ea9d135a224..2f62be57910 100644 --- a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py +++ b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py @@ -47,9 +47,3 @@ class RvalueReferencesTestCase(TestBase): def set_breakpoint(self, line): lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/scope/TestCppScope.py b/lldb/test/lang/cpp/scope/TestCppScope.py index 4d5ea8bf62b..f984eed86e4 100644 --- a/lldb/test/lang/cpp/scope/TestCppScope.py +++ b/lldb/test/lang/cpp/scope/TestCppScope.py @@ -65,9 +65,3 @@ class TestCppScopes(TestBase): value = frame.EvaluateExpression(name) assert_value = global_variables_assert[name] self.assertTrue(value.IsValid() and value.GetValueAsSigned() == assert_value, name + " = " + str(assert_value)) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py index 9c1f6838efd..8ae2e22c52b 100644 --- a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py +++ b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py @@ -2,9 +2,10 @@ Test that variables with signed types display correctly. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * import lldbutil @@ -55,10 +56,3 @@ class UnsignedTypesTestCase(TestBase): substrs = ["(int) the_signed_int = 99", "(long) the_signed_long = 99", "(long long) the_signed_long_long = 99"]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py b/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py index de85a574899..f221a1a5bb1 100644 --- a/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py +++ b/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py @@ -1,6 +1,10 @@ """ Tests that C++ member and static variables have correct layout and scope. """ + +import lldb_shared + +import unittest2 import lldb from lldbtest import * import lldbutil @@ -51,10 +55,3 @@ class CPPStaticMembersTestCase(TestBase): def set_breakpoint(self, line): lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py index c44af758c72..4887a69788d 100644 --- a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py +++ b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py @@ -34,9 +34,3 @@ class CPPStaticMethodsTestCase(TestBase): self.expect("expression -- my_a.getMemberValue()", startstr = "(int) $1 = 3") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/stl/TestSTL.py b/lldb/test/lang/cpp/stl/TestSTL.py index b74009fbefd..e32652602f8 100644 --- a/lldb/test/lang/cpp/stl/TestSTL.py +++ b/lldb/test/lang/cpp/stl/TestSTL.py @@ -2,8 +2,10 @@ Test some expressions involving STL data types. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import lldbutil from lldbtest import * @@ -112,10 +114,3 @@ class STLTestCase(TestBase): # Check that both entries of the dictionary have 'True' as the value. self.assertTrue(all(expected_types.values())) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py index abcc3004a4a..dad5bf21eca 100644 --- a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py @@ -2,8 +2,10 @@ Test the lldb disassemble command on lib stdc++. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -104,10 +106,3 @@ class StdCXXDisassembleTestCase(TestBase): else: # This entry is not a Code entry. Reset SA = None. SA = None - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/this/TestCPPThis.py b/lldb/test/lang/cpp/this/TestCPPThis.py index e4b5d615121..4c99845b31a 100644 --- a/lldb/test/lang/cpp/this/TestCPPThis.py +++ b/lldb/test/lang/cpp/this/TestCPPThis.py @@ -51,9 +51,3 @@ class CPPThisTestCase(TestBase): def set_breakpoint(self, line): lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py index c251563228a..a1c9f25d31b 100644 --- a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py +++ b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py @@ -2,7 +2,8 @@ Test that template instaniations of std::vector<long> and <short> in the same module have the correct types. """ -import unittest2 +import lldb_shared + import lldb import lldbutil from lldbtest import * @@ -57,10 +58,3 @@ class UniqueTypesTestCase(TestBase): continue self.expect(x, "Expect type 'short'", exe=False, substrs = ['short']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py index d49d3b8f4df..a2c8ff75f04 100644 --- a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py +++ b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py @@ -2,9 +2,10 @@ Test that variables with unsigned types display correctly. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * import lldbutil @@ -49,10 +50,3 @@ class UnsignedTypesTestCase(TestBase): "(unsigned long) the_unsigned_long = 99", "(unsigned long long) the_unsigned_long_long = 99", "(uint32_t) the_uint32 = 99"]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py index 2438873b515..d2b3ab91ba3 100644 --- a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py +++ b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py @@ -3,8 +3,9 @@ Test that C++ supports wchar_t correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -69,9 +70,3 @@ class CxxWCharTTestCase(TestBase): self.expect('frame variable wchar_zero', substrs=["L'\\0'"]) self.expect('expression wchar_zero', substrs=["L'\\0'"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/go/goroutines/TestGoroutines.py b/lldb/test/lang/go/goroutines/TestGoroutines.py index 05f6aa8f0b0..6c26a3a1075 100644 --- a/lldb/test/lang/go/goroutines/TestGoroutines.py +++ b/lldb/test/lang/go/goroutines/TestGoroutines.py @@ -1,7 +1,8 @@ """Test the Go OS Plugin.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -80,10 +81,3 @@ class TestGoASTContext(TestBase): self.dbg.HandleCommand("settings set plugin.os.goroutines.enable false") self.thread().StepInstruction(False) self.assertLess(len(self.process().threads), 20) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/go/types/TestGoASTContext.py b/lldb/test/lang/go/types/TestGoASTContext.py index ccfca85a130..457b6d30639 100644 --- a/lldb/test/lang/go/types/TestGoASTContext.py +++ b/lldb/test/lang/go/types/TestGoASTContext.py @@ -1,7 +1,8 @@ """Test the go DWARF type parsing.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -128,10 +129,3 @@ class TestGoASTContext(TestBase): self.assertEqual(5, v.GetNumChildren()) for i in xrange(5): self.assertEqual(str(i + 1), v.GetChildAtIndex(i).value) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/mixed/TestMixedLanguages.py b/lldb/test/lang/mixed/TestMixedLanguages.py index 5d4e284d4fd..1fbf118838a 100644 --- a/lldb/test/lang/mixed/TestMixedLanguages.py +++ b/lldb/test/lang/mixed/TestMixedLanguages.py @@ -1,7 +1,8 @@ """Test that lldb works correctly on compile units form different languages.""" +import lldb_shared + import os, time, re -import unittest2 import lldb from lldbtest import * @@ -51,9 +52,3 @@ class MixedLanguagesTestCase(TestBase): # (note: C++11 is enabled by default for C++). self.expect("expr foo != nullptr", patterns = ["true"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/blocks/TestObjCIvarsInBlocks.py b/lldb/test/lang/objc/blocks/TestObjCIvarsInBlocks.py index 281c15505db..a629dcf38ea 100644 --- a/lldb/test/lang/objc/blocks/TestObjCIvarsInBlocks.py +++ b/lldb/test/lang/objc/blocks/TestObjCIvarsInBlocks.py @@ -1,7 +1,8 @@ """Test printing ivars and ObjC objects captured in blocks that are made in methods of an ObjC class.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -98,9 +99,3 @@ class TestObjCIvarsInBlocks(TestBase): ret_value_signed = expr.GetValueAsSigned (error) # print 'ret_value_signed = %i' % (ret_value_signed) self.assertTrue (ret_value_signed == 5, "The local variable in the block was what we expected.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/forward-decl/TestForwardDecl.py b/lldb/test/lang/objc/forward-decl/TestForwardDecl.py index 4b21e35e22d..6c2f109cb8e 100644 --- a/lldb/test/lang/objc/forward-decl/TestForwardDecl.py +++ b/lldb/test/lang/objc/forward-decl/TestForwardDecl.py @@ -1,7 +1,8 @@ """Test that a forward-declared class works when its complete definition is in a library""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -49,9 +50,3 @@ class ForwardDeclTestCase(TestBase): # This should display correctly. self.expect("expression [j getMember]", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["= 0x"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestConstStrings.py b/lldb/test/lang/objc/foundation/TestConstStrings.py index a3780e09a75..772f5d7ce01 100644 --- a/lldb/test/lang/objc/foundation/TestConstStrings.py +++ b/lldb/test/lang/objc/foundation/TestConstStrings.py @@ -3,8 +3,9 @@ Test that objective-c constant strings are generated correctly by the expression parser. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -48,10 +49,3 @@ class ConstStringTestCase(TestBase): self.expect('expression (int)[@"123" length]', startstr = "(int) $3 = 3") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py b/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py index 3fb67924f7d..cd03e76ad11 100644 --- a/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py +++ b/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py @@ -2,8 +2,10 @@ Test the lldb disassemble command on foundation framework. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -128,10 +130,3 @@ class FoundationDisassembleTestCase(TestBase): # Do the disassemble for the currently stopped function. self.runCmd("disassemble -f") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestObjCMethods.py b/lldb/test/lang/objc/foundation/TestObjCMethods.py index 5be2e3c441a..1417d017a69 100644 --- a/lldb/test/lang/objc/foundation/TestObjCMethods.py +++ b/lldb/test/lang/objc/foundation/TestObjCMethods.py @@ -3,8 +3,9 @@ Set breakpoints on objective-c class and instance methods in foundation. Also lookup objective-c data types and evaluate expressions. """ +import lldb_shared + import os, os.path, time -import unittest2 import lldb import string from lldbtest import * @@ -79,7 +80,6 @@ class FoundationTestCase(TestBase): self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]", substrs = ["Foundation`-[NSAutoreleasePool release]"]) - #@unittest2.expectedFailure # rdar://problem/8542091 # rdar://problem/8492646 def test_data_type_and_expr(self): @@ -258,9 +258,3 @@ class FoundationTestCase(TestBase): print line, self.assertTrue(num_errors == 0, "Spurious lookups detected") f.close() - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestObjCMethods2.py b/lldb/test/lang/objc/foundation/TestObjCMethods2.py index 59eb9955c3c..9c6ce04d05a 100644 --- a/lldb/test/lang/objc/foundation/TestObjCMethods2.py +++ b/lldb/test/lang/objc/foundation/TestObjCMethods2.py @@ -2,8 +2,9 @@ Test more expression command sequences with objective-c. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -164,9 +165,3 @@ class FoundationTestCase2(TestBase): error = True, patterns = ["no known method", "cast the message send to the method's return type"]) self.runCmd("process continue") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestObjectDescriptionAPI.py b/lldb/test/lang/objc/foundation/TestObjectDescriptionAPI.py index 08310329096..6dd9b90e201 100644 --- a/lldb/test/lang/objc/foundation/TestObjectDescriptionAPI.py +++ b/lldb/test/lang/objc/foundation/TestObjectDescriptionAPI.py @@ -2,9 +2,10 @@ Test SBValue.GetObjectDescription() with the value from SBTarget.FindGlobalVariables(). """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -65,10 +66,3 @@ class ObjectDescriptionAPITestCase(TestBase): print "object description:", v.GetObjectDescription() if v.GetName() == 'my_global_str': self.assertTrue(v.GetObjectDescription() == 'This is a global string') - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestRuntimeTypes.py b/lldb/test/lang/objc/foundation/TestRuntimeTypes.py index 55e9713462f..a302fcc16e0 100644 --- a/lldb/test/lang/objc/foundation/TestRuntimeTypes.py +++ b/lldb/test/lang/objc/foundation/TestRuntimeTypes.py @@ -2,8 +2,9 @@ Test that Objective-C methods from the runtime work correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -43,9 +44,3 @@ class RuntimeTypesTestCase(TestBase): self.expect("po $1", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["foo"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/foundation/TestSymbolTable.py b/lldb/test/lang/objc/foundation/TestSymbolTable.py index 0d238160214..3b1d820012d 100644 --- a/lldb/test/lang/objc/foundation/TestSymbolTable.py +++ b/lldb/test/lang/objc/foundation/TestSymbolTable.py @@ -2,8 +2,9 @@ Test symbol table access for main.m. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -63,10 +64,3 @@ class FoundationSymtabTestCase(TestBase): #print "symbols unaccounted for:", expected_symbols self.assertTrue(len(expected_symbols) == 0, "All the known symbols are accounted for") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py index 29426505914..a36ba61c402 100644 --- a/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py +++ b/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py @@ -1,7 +1,9 @@ """Test that hidden ivars in a shared library are visible from the main executable.""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -168,10 +170,3 @@ class HiddenIvarsTestCase(TestBase): else: self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', '"2 elements"']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py b/lldb/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py index b614d753b13..2ccd8bc1574 100644 --- a/lldb/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py +++ b/lldb/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py @@ -2,9 +2,10 @@ Test that dynamically discovered ivars of type IMP do not crash LLDB """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * import commands @@ -57,9 +58,3 @@ class ObjCiVarIMPTestCase(TestBase): self.expect('disassemble --start-address `((MyClass*)object)->myImp`', substrs=[ '-[MyClass init]' ]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/modules-auto-import/TestModulesAutoImport.py b/lldb/test/lang/objc/modules-auto-import/TestModulesAutoImport.py index 8a11c24e401..a836cdaf82c 100644 --- a/lldb/test/lang/objc/modules-auto-import/TestModulesAutoImport.py +++ b/lldb/test/lang/objc/modules-auto-import/TestModulesAutoImport.py @@ -1,7 +1,9 @@ """Test that importing modules in Objective-C works as expected.""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import platform import lldbutil @@ -47,9 +49,3 @@ class ObjCModulesAutoImportTestCase(TestBase): self.expect("p getpid()", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["pid_t"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/modules-incomplete/TestIncompleteModules.py b/lldb/test/lang/objc/modules-incomplete/TestIncompleteModules.py index 60bb82da2c6..0db2a114c6e 100644 --- a/lldb/test/lang/objc/modules-incomplete/TestIncompleteModules.py +++ b/lldb/test/lang/objc/modules-incomplete/TestIncompleteModules.py @@ -1,7 +1,9 @@ """Test that DWARF types are trusted over module types""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import platform import lldbutil @@ -55,9 +57,3 @@ class IncompleteModulesTestCase(TestBase): self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found", error=True) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py b/lldb/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py index 02ac9d79514..b322cf045ab 100644 --- a/lldb/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py +++ b/lldb/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py @@ -1,7 +1,9 @@ """Test that inline functions from modules are imported correctly""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import platform import lldbutil @@ -48,9 +50,3 @@ class ModulesInlineFunctionsTestCase(TestBase): self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["4"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/modules/TestObjCModules.py b/lldb/test/lang/objc/modules/TestObjCModules.py index b3a5d1395ae..aa3351af3f3 100644 --- a/lldb/test/lang/objc/modules/TestObjCModules.py +++ b/lldb/test/lang/objc/modules/TestObjCModules.py @@ -1,7 +1,9 @@ """Test that importing modules in Objective-C works as expected.""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import platform import lldbutil @@ -65,9 +67,3 @@ class ObjCModulesTestCase(TestBase): self.expect("p [NSURL URLWithString:@\"http://lldb.llvm.org\"].scheme", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["http"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc++/TestObjCXX.py b/lldb/test/lang/objc/objc++/TestObjCXX.py index 1ae73bd463c..2c5b32010f8 100644 --- a/lldb/test/lang/objc/objc++/TestObjCXX.py +++ b/lldb/test/lang/objc/objc++/TestObjCXX.py @@ -2,8 +2,9 @@ Make sure that ivars of Objective-C++ classes are visible in LLDB. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -28,9 +29,3 @@ class ObjCXXTestCase(TestBase): self.expect("expr f->f", "Found ivar in class", substrs = ["= 3"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py b/lldb/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py index f7d8d5b6d24..da4b146e381 100644 --- a/lldb/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py +++ b/lldb/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py @@ -2,9 +2,10 @@ Use lldb Python API to test base class resolution for ObjC classes """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -52,9 +53,3 @@ class ObjCDynamicValueTestCase(TestBase): self.assertTrue(var_pte_type.GetDirectBaseClassAtIndex(0).IsValid(), "Foo * has a valid base class") self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(0).GetName() == var_pte_type.GetDirectBaseClassAtIndex(0).GetName(), "Foo and its pointer type don't agree on their base class") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py b/lldb/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py index f07adb6ae3e..eeedc9b8117 100644 --- a/lldb/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py +++ b/lldb/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py @@ -1,7 +1,8 @@ """Test that the expression parser doesn't get confused by 'id' and 'Class'""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -50,9 +51,3 @@ class TestObjCBuiltinTypes(TestBase): self.expect("expr (foo)", patterns = ["\(ns::id\) \$.* = 0"]) self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = nil"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-checker/TestObjCCheckers.py b/lldb/test/lang/objc/objc-checker/TestObjCCheckers.py index 8f816c516f1..15820b68739 100644 --- a/lldb/test/lang/objc/objc-checker/TestObjCCheckers.py +++ b/lldb/test/lang/objc/objc-checker/TestObjCCheckers.py @@ -2,9 +2,10 @@ Use lldb Python API to make sure the dynamic checkers are doing their jobs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -69,9 +70,3 @@ class ObjCCheckerTestCase(TestBase): # Make sure the error is helpful: err_string = expr_error.GetCString() self.assertTrue ("selector" in err_string) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-class-method/TestObjCClassMethod.py b/lldb/test/lang/objc/objc-class-method/TestObjCClassMethod.py index 27b091563f1..70cb513f9b7 100644 --- a/lldb/test/lang/objc/objc-class-method/TestObjCClassMethod.py +++ b/lldb/test/lang/objc/objc-class-method/TestObjCClassMethod.py @@ -1,7 +1,8 @@ """Test calling functions in class methods.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -51,9 +52,3 @@ class TestObjCClassMethod(TestBase): cmd_value = frame.EvaluateExpression ("(int)[Foo doSomethingWithString:@\"Hello\"]") self.assertTrue (cmd_value.IsValid()) self.assertTrue (cmd_value.GetValueAsUnsigned() == 5) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py b/lldb/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py index 27f6da1bf9f..9e4a7e2a7df 100644 --- a/lldb/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py +++ b/lldb/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py @@ -2,8 +2,9 @@ Test that we are able to properly report a usable dynamic type """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -57,9 +58,3 @@ class ObjCDynamicSBTypeTestCase(TestBase): self.assertTrue(object_pointee_type.GetNumberOfFields() == 2, "The dynamic type for NSObject has 2 fields") self.assertTrue(base_pointee_type.GetNumberOfFields() == 2, "The dynamic type for Base has 2 fields") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py b/lldb/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py index 37a7b078cad..bd0bbeab4f6 100644 --- a/lldb/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py +++ b/lldb/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py @@ -2,9 +2,10 @@ Use lldb Python API to test dynamic values in ObjC """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -171,9 +172,3 @@ class ObjCDynamicValueTestCase(TestBase): derivedValue = object.GetChildMemberWithName ('_derivedValue') self.assertTrue (derivedValue) self.assertTrue (int (derivedValue.GetValue(), 0) == 30) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py b/lldb/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py index 98d6aa5a1a0..26e09da2ae3 100644 --- a/lldb/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py +++ b/lldb/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py @@ -1,7 +1,8 @@ """Test printing ObjC objects that use unbacked properties - so that the static ivar offsets are incorrect.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -69,9 +70,3 @@ class TestObjCIvarOffsets(TestBase): flag2_value = mine_flag2.GetValueAsUnsigned (error) self.assertTrue (error.Success()) self.assertTrue (flag2_value == 7) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py b/lldb/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py index 05cdc4d03dc..dd4620f4752 100644 --- a/lldb/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py +++ b/lldb/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py @@ -1,7 +1,8 @@ """Test printing ObjC objects that use unbacked properties - so that the static ivar offsets are incorrect.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -54,9 +55,3 @@ class TestObjCIvarStripped(TestBase): ivar_value = ivar.GetValueAsSigned (error) self.assertTrue (error.Success()) self.assertTrue (ivar_value == 3) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py b/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py index 97d8f92b33b..66dc4d5bdb8 100644 --- a/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py +++ b/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py @@ -1,7 +1,9 @@ """Test that the Objective-C syntax for dictionary/array literals and indexing works""" -import os, time +import lldb_shared + import unittest2 +import os, time import lldb import platform import lldbutil @@ -97,9 +99,3 @@ class ObjCNewSyntaxTestCase(TestBase): substrs = ["4"]) self.expect("expr -- @((char*)\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["NSString", "world"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py b/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py index e6a5958d2c1..a2769e244b5 100644 --- a/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py +++ b/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py @@ -7,8 +7,9 @@ or 'self' variable was not properly read if the compiler optimized it into a register. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -58,10 +59,3 @@ class ObjcOptimizedTestCase(TestBase): self.expect('expression self->non_member', error=True, substrs = ["does not have a member named 'non_member'"]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-property/TestObjCProperty.py b/lldb/test/lang/objc/objc-property/TestObjCProperty.py index 0ed08363163..f21ab349862 100644 --- a/lldb/test/lang/objc/objc-property/TestObjCProperty.py +++ b/lldb/test/lang/objc/objc-property/TestObjCProperty.py @@ -2,9 +2,10 @@ Use lldb Python API to verify that expression evaluation for property references uses the correct getters and setters """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -108,9 +109,3 @@ class ObjCPropertyTestCase(TestBase): idWithProtocol_error = idWithProtocol_value.GetError() self.assertTrue (idWithProtocol_error.Success()) self.assertTrue (idWithProtocol_value.GetTypeName() == "id") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py b/lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py index 6cc550aa10b..a0719871a13 100644 --- a/lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py +++ b/lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py @@ -1,7 +1,8 @@ """Test calling functions in static methods with a stripped binary.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -60,9 +61,3 @@ class TestObjCStaticMethodStripped(TestBase): self.assertTrue (cmd_value.IsValid()) string_length = cmd_value.GetValueAsUnsigned() self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-static-method/TestObjCStaticMethod.py b/lldb/test/lang/objc/objc-static-method/TestObjCStaticMethod.py index c54d23b6105..443c4c5af41 100644 --- a/lldb/test/lang/objc/objc-static-method/TestObjCStaticMethod.py +++ b/lldb/test/lang/objc/objc-static-method/TestObjCStaticMethod.py @@ -1,7 +1,8 @@ """Test calling functions in static methods.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -56,9 +57,3 @@ class TestObjCStaticMethod(TestBase): self.assertTrue (cmd_value.IsValid()) string_length = cmd_value.GetValueAsUnsigned() self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-stepping/TestObjCStepping.py b/lldb/test/lang/objc/objc-stepping/TestObjCStepping.py index 0fb8bcebe91..015992ccbf3 100644 --- a/lldb/test/lang/objc/objc-stepping/TestObjCStepping.py +++ b/lldb/test/lang/objc/objc-stepping/TestObjCStepping.py @@ -1,7 +1,8 @@ """Test stepping through ObjC method dispatch in various forms.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -167,9 +168,3 @@ class TestObjCStepping(TestBase): thread.StepInto() line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine() self.assertTrue (line_number == self.stepped_past_nil_line, "Step in over dispatch to nil stepped over.") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py b/lldb/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py index 47d1ea432b4..be6e87b939e 100644 --- a/lldb/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py +++ b/lldb/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py @@ -1,7 +1,8 @@ """Test passing structs to Objective-C methods.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -52,9 +53,3 @@ class TestObjCStructArgument(TestBase): # Now make sure we can call a method that returns a struct without crashing. cmd_value = frame.EvaluateExpression ("[provider getRange]") self.assertTrue (cmd_value.IsValid()) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-struct-return/TestObjCStructReturn.py b/lldb/test/lang/objc/objc-struct-return/TestObjCStructReturn.py index 27a3c3e509e..d6fafd7e348 100644 --- a/lldb/test/lang/objc/objc-struct-return/TestObjCStructReturn.py +++ b/lldb/test/lang/objc/objc-struct-return/TestObjCStructReturn.py @@ -1,7 +1,8 @@ """Test calling functions in class methods.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -48,9 +49,3 @@ class TestObjCClassMethod(TestBase): # Now make sure we can call a method that returns a struct without crashing. cmd_value = frame.EvaluateExpression ("[provider getRange]") self.assertTrue (cmd_value.IsValid()) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/objc-super/TestObjCSuper.py b/lldb/test/lang/objc/objc-super/TestObjCSuper.py index 1d1f43be37f..4aba9e9740b 100644 --- a/lldb/test/lang/objc/objc-super/TestObjCSuper.py +++ b/lldb/test/lang/objc/objc-super/TestObjCSuper.py @@ -1,7 +1,8 @@ """Test calling methods on super.""" +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -54,9 +55,3 @@ class TestObjCSuperMethod(TestBase): cmd_value = frame.EvaluateExpression ("[super get]") self.assertTrue (cmd_value.IsValid()) self.assertTrue (cmd_value.GetValueAsUnsigned() == 1) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/print-obj/TestPrintObj.py b/lldb/test/lang/objc/print-obj/TestPrintObj.py index f6143b04e8d..b1205cfa8b3 100644 --- a/lldb/test/lang/objc/print-obj/TestPrintObj.py +++ b/lldb/test/lang/objc/print-obj/TestPrintObj.py @@ -2,8 +2,9 @@ Test "print object" where another thread blocks the print object from making progress. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * @@ -82,10 +83,3 @@ class PrintObjTestCase(TestBase): self.expect("po lock_me", OBJECT_PRINTED_CORRECTLY, substrs = ['I am pretty special.']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py b/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py index b33741b4f46..726ec820bb5 100644 --- a/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py +++ b/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py @@ -2,8 +2,9 @@ Test that objective-c method returning BOOL works correctly. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -40,10 +41,3 @@ class MethodReturningBOOLTestCase(TestBase): # rdar://problem/9691614 self.runCmd('p (int)[my isValid]') - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py index 17d1015701a..be9b6cf043a 100644 --- a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py +++ b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py @@ -2,8 +2,9 @@ Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -39,9 +40,3 @@ class Rdar10967107TestCase(TestBase): self.expect("frame variable cf_range --raw", substrs = ['location','length']) # check that printing both does not somehow confuse LLDB self.expect("frame variable --raw", substrs = ['year','month','day','hour','minute','second','location','length']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py b/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py index 14f85c42b82..3523695de2c 100644 --- a/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py +++ b/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py @@ -2,8 +2,9 @@ Test that we do not attempt to make a dynamic type for a 'const char*' """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -60,9 +61,3 @@ class Rdar10967107TestCase(TestBase): # check that expr also gets it right self.expect("expr my_foolie", substrs = ['FoolMeOnce *']) self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/rdar-12408181/TestRdar12408181.py b/lldb/test/lang/objc/rdar-12408181/TestRdar12408181.py index d1d2292ac2e..54fa80c5596 100644 --- a/lldb/test/lang/objc/rdar-12408181/TestRdar12408181.py +++ b/lldb/test/lang/objc/rdar-12408181/TestRdar12408181.py @@ -2,8 +2,9 @@ Test that we are able to find out how many children NSWindow has """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -40,9 +41,3 @@ class Rdar12408181TestCase(TestBase): self.assertTrue(window_dynamic.GetNumChildren() > 1, "NSWindow (dynamic) only has 1 child!") self.assertTrue(window.GetChildAtIndex(0).IsValid(), "NSWindow (static) has an invalid child") self.assertTrue(window_dynamic.GetChildAtIndex(0).IsValid(), "NSWindow (dynamic) has an invalid child") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/real-definition/TestRealDefinition.py b/lldb/test/lang/objc/real-definition/TestRealDefinition.py index 8557423324d..04e49868710 100644 --- a/lldb/test/lang/objc/real-definition/TestRealDefinition.py +++ b/lldb/test/lang/objc/real-definition/TestRealDefinition.py @@ -1,7 +1,8 @@ """Test that types defined in shared libraries work correctly.""" +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -81,9 +82,3 @@ class TestRealDefinition(TestBase): # Break inside the foo function which takes a bar_ptr argument. line = line_number('main.m', '// Set breakpoint in main') lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/lang/objc/self/TestObjCSelf.py b/lldb/test/lang/objc/self/TestObjCSelf.py index 239e2de644f..44736feaba3 100644 --- a/lldb/test/lang/objc/self/TestObjCSelf.py +++ b/lldb/test/lang/objc/self/TestObjCSelf.py @@ -34,9 +34,3 @@ class ObjCSelfTestCase(TestBase): def set_breakpoint(self, line): lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() |