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/benchmarks/continue/TestBenchmarkContinue.py b/lldb/test/benchmarks/continue/TestBenchmarkContinue.py
index c4d0de3..83674c6 100644
--- a/lldb/test/benchmarks/continue/TestBenchmarkContinue.py
+++ b/lldb/test/benchmarks/continue/TestBenchmarkContinue.py
@@ -2,8 +2,9 @@
 Test lldb data formatter subsystem.
 """
 
+import lldb_shared
+
 import os, time
-import unittest2
 import lldb
 from lldbbench import *
 import lldbutil
@@ -61,9 +62,3 @@
             lldbutil_sw.stop()
             
         print "runCmd: %s\nlldbutil: %s" % (runCmd_sw,lldbutil_sw)
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/disassembly/TestDisassembly.py b/lldb/test/benchmarks/disassembly/TestDisassembly.py
index 83ed72e..b514819 100644
--- a/lldb/test/benchmarks/disassembly/TestDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestDisassembly.py
@@ -1,7 +1,8 @@
 """Disassemble lldb's Driver::MainLoop() functions comparing lldb against gdb."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -151,10 +152,3 @@
         if self.TraceOn():
             print "gdb disassembly benchmark:", str(self.stopwatch)
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py b/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
index 0f06497..a93a406 100644
--- a/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
@@ -2,8 +2,9 @@
 inferior and traverses the stack for thread0 to arrive at frame with function
 'MainLoop'.  It is important to specify an lldb executable as the inferior."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -66,10 +67,3 @@
             with self.stopwatch:
                 # Disassemble the 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/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py b/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
index ff79866..393119e 100644
--- a/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
@@ -1,7 +1,8 @@
 """Disassemble lldb's Driver::MainLoop() functions comparing Xcode 4.1 vs. 4.2's gdb."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -90,10 +91,3 @@
         if self.TraceOn():
             print "gdb disassembly benchmark:", str(self.stopwatch)
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/expression/TestExpressionCmd.py b/lldb/test/benchmarks/expression/TestExpressionCmd.py
index a9d2649..aa7b03f 100644
--- a/lldb/test/benchmarks/expression/TestExpressionCmd.py
+++ b/lldb/test/benchmarks/expression/TestExpressionCmd.py
@@ -1,7 +1,8 @@
 """Test lldb's expression evaluations and collect statistics."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -68,10 +69,3 @@
                 pass
 
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/expression/TestRepeatedExprs.py b/lldb/test/benchmarks/expression/TestRepeatedExprs.py
index ad8f963..9efbec6 100644
--- a/lldb/test/benchmarks/expression/TestRepeatedExprs.py
+++ b/lldb/test/benchmarks/expression/TestRepeatedExprs.py
@@ -1,7 +1,8 @@
 """Test evaluating expressions repeatedly comparing lldb against gdb."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -126,10 +127,3 @@
         if self.TraceOn():
             print "gdb expression benchmark:", str(self.stopwatch)
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py b/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
index b3eb7b6..ff55ecd 100644
--- a/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
+++ b/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
@@ -1,7 +1,8 @@
 """Test lldb's response time for 'frame variable' command."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -72,10 +73,3 @@
         # The test is about to end and if we come to here, the child process has
         # been terminated.  Mark it so.
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/startup/TestStartupDelays.py b/lldb/test/benchmarks/startup/TestStartupDelays.py
index 802a885..b921906 100644
--- a/lldb/test/benchmarks/startup/TestStartupDelays.py
+++ b/lldb/test/benchmarks/startup/TestStartupDelays.py
@@ -1,7 +1,8 @@
 """Test lldb's startup delays creating a target, setting a breakpoint, and run to breakpoint stop."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -82,10 +83,3 @@
         # The test is about to end and if we come to here, the child process has
         # been terminated.  Mark it so.
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
index 623e2c0..71017eb 100644
--- a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
+++ b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
@@ -1,7 +1,8 @@
 """Test lldb's stepping speed."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -59,10 +60,3 @@
             pass
 
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/stepping/TestSteppingSpeed.py b/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
index 7aa84c6..553933f 100644
--- a/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
+++ b/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
@@ -1,7 +1,8 @@
 """Test lldb's stepping speed."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -71,10 +72,3 @@
             pass
 
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()
diff --git a/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py b/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
index ab57a70..c359ab2 100644
--- a/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
+++ b/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
@@ -1,7 +1,8 @@
 """Benchmark the turnaround time starting a debugger and run to the breakpont with lldb vs. gdb."""
 
+import lldb_shared
+
 import os, sys
-import unittest2
 import lldb
 from lldbbench import *
 
@@ -116,10 +117,3 @@
 
         self.gdb_avg = self.stopwatch.avg()
         self.child = None
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()