summaryrefslogtreecommitdiffstats
path: root/lldb/test/lang/objc
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-22 20:06:20 +0000
committerZachary Turner <zturner@google.com>2015-10-22 20:06:20 +0000
commit77db4a855239049488e09f28c6665fdb3b51ef90 (patch)
tree11f22a87f27e28b3a71914ee3d80a039a79d2c9a /lldb/test/lang/objc
parentbd832d513156cea8645f1c3da1296f791edfbbab (diff)
downloadbcm5719-llvm-77db4a855239049488e09f28c6665fdb3b51ef90.tar.gz
bcm5719-llvm-77db4a855239049488e09f28c6665fdb3b51ef90.zip
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
Diffstat (limited to 'lldb/test/lang/objc')
-rw-r--r--lldb/test/lang/objc/blocks/TestObjCIvarsInBlocks.py9
-rw-r--r--lldb/test/lang/objc/forward-decl/TestForwardDecl.py9
-rw-r--r--lldb/test/lang/objc/foundation/TestConstStrings.py10
-rw-r--r--lldb/test/lang/objc/foundation/TestFoundationDisassembly.py11
-rw-r--r--lldb/test/lang/objc/foundation/TestObjCMethods.py10
-rw-r--r--lldb/test/lang/objc/foundation/TestObjCMethods2.py9
-rw-r--r--lldb/test/lang/objc/foundation/TestObjectDescriptionAPI.py10
-rw-r--r--lldb/test/lang/objc/foundation/TestRuntimeTypes.py9
-rw-r--r--lldb/test/lang/objc/foundation/TestSymbolTable.py10
-rw-r--r--lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py11
-rw-r--r--lldb/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py9
-rw-r--r--lldb/test/lang/objc/modules-auto-import/TestModulesAutoImport.py10
-rw-r--r--lldb/test/lang/objc/modules-incomplete/TestIncompleteModules.py10
-rw-r--r--lldb/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py10
-rw-r--r--lldb/test/lang/objc/modules/TestObjCModules.py10
-rw-r--r--lldb/test/lang/objc/objc++/TestObjCXX.py9
-rw-r--r--lldb/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py9
-rw-r--r--lldb/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py9
-rw-r--r--lldb/test/lang/objc/objc-checker/TestObjCCheckers.py9
-rw-r--r--lldb/test/lang/objc/objc-class-method/TestObjCClassMethod.py9
-rw-r--r--lldb/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py9
-rw-r--r--lldb/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py9
-rw-r--r--lldb/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py9
-rw-r--r--lldb/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py9
-rw-r--r--lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py10
-rw-r--r--lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py10
-rw-r--r--lldb/test/lang/objc/objc-property/TestObjCProperty.py9
-rw-r--r--lldb/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py9
-rw-r--r--lldb/test/lang/objc/objc-static-method/TestObjCStaticMethod.py9
-rw-r--r--lldb/test/lang/objc/objc-stepping/TestObjCStepping.py9
-rw-r--r--lldb/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py9
-rw-r--r--lldb/test/lang/objc/objc-struct-return/TestObjCStructReturn.py9
-rw-r--r--lldb/test/lang/objc/objc-super/TestObjCSuper.py9
-rw-r--r--lldb/test/lang/objc/print-obj/TestPrintObj.py10
-rw-r--r--lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py10
-rw-r--r--lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py9
-rw-r--r--lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py9
-rw-r--r--lldb/test/lang/objc/rdar-12408181/TestRdar12408181.py9
-rw-r--r--lldb/test/lang/objc/real-definition/TestRealDefinition.py9
-rw-r--r--lldb/test/lang/objc/self/TestObjCSelf.py6
40 files changed, 85 insertions, 288 deletions
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()
OpenPOWER on IntegriCloud