Update every test to import `lldb_shared`.
This is necessary in order to allow third party modules to be
located under lldb/third_party rather than under the test
folder directly.
Since we're already touching every test file anyway, we also
go ahead and delete the unittest2 import and main block wherever
possible. The ability to run a test as a standalone file has
already been broken for some time, and if we decide we want this
back, we should use unittest instead of unittest2.
A few places could not have the import of unittest2 removed,because
they depend on the unittest2.expectedFailure or skip decorators.
Removing all those was orthogonal in spirit to the purpose of this
CL, so the import of unittest2 remains in those files that were
using it for its test decorators. Those can be addressed
separately.
llvm-svn: 251055
diff --git a/lldb/test/lang/cpp/bool/TestCPPBool.py b/lldb/test/lang/cpp/bool/TestCPPBool.py
index 9138217..0724fc5 100644
--- a/lldb/test/lang/cpp/bool/TestCPPBool.py
+++ b/lldb/test/lang/cpp/bool/TestCPPBool.py
@@ -24,9 +24,3 @@
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 a8b69de..867bfed 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 @@
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 6adbcd6..bba2399 100644
--- a/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py
+++ b/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py
@@ -31,9 +31,3 @@
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 a6cf56c..fa9338a 100644
--- a/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py
+++ b/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py
@@ -71,9 +71,3 @@
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 f604c34..7392f79 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 @@
# 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 88aeb72..c9182fe 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 @@
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 2e9353b..6d737e0 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 @@
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 866b100..031c2b3 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 @@
# 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 6c9f6e4..f4222eb 100644
--- a/lldb/test/lang/cpp/diamond/TestDiamond.py
+++ b/lldb/test/lang/cpp/diamond/TestDiamond.py
@@ -39,9 +39,3 @@
# 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 431f19f..f46bad7 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 @@
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 f7f9e67..3ef4193 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 @@
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 e8072ef..c0fb310 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 @@
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 cc6805e..51135c7 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 @@
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 6299116..68ff52e 100644
--- a/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py
+++ b/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py
@@ -52,10 +52,3 @@
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 931f546..2764f31 100644
--- a/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
+++ b/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
@@ -63,9 +63,3 @@
# 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 fd59881..08825c4 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 @@
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 076356d..3411959 100644
--- a/lldb/test/lang/cpp/nsimport/TestCppNsImport.py
+++ b/lldb/test/lang/cpp/nsimport/TestCppNsImport.py
@@ -98,10 +98,3 @@
# 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 38cec0f..7eff685 100644
--- a/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
+++ b/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
@@ -34,9 +34,3 @@
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 23bf8a1..4ac48e1 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 @@
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 ea9d135..2f62be5 100644
--- a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py
+++ b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py
@@ -47,9 +47,3 @@
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 4d5ea8b..f984eed 100644
--- a/lldb/test/lang/cpp/scope/TestCppScope.py
+++ b/lldb/test/lang/cpp/scope/TestCppScope.py
@@ -65,9 +65,3 @@
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 9c1f683..8ae2e22 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 @@
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 de85a57..f221a1a 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 @@
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 c44af75..4887a69 100644
--- a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py
+++ b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py
@@ -34,9 +34,3 @@
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 b74009f..e326526 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 @@
# 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 abcc300..dad5bf2 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 @@
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 e4b5d61..4c99845 100644
--- a/lldb/test/lang/cpp/this/TestCPPThis.py
+++ b/lldb/test/lang/cpp/this/TestCPPThis.py
@@ -51,9 +51,3 @@
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 c251563..a1c9f25 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 @@
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 d49d3b8..a2c8ff7 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 @@
"(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 2438873..d2b3ab9 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 @@
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()