diff options
Diffstat (limited to 'lldb/test/python_api')
41 files changed, 81 insertions, 308 deletions
diff --git a/lldb/test/python_api/breakpoint/TestBreakpointAPI.py b/lldb/test/python_api/breakpoint/TestBreakpointAPI.py index 764fe22c190..9c29e6cd992 100644 --- a/lldb/test/python_api/breakpoint/TestBreakpointAPI.py +++ b/lldb/test/python_api/breakpoint/TestBreakpointAPI.py @@ -2,9 +2,10 @@ Test SBBreakpoint APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -39,10 +40,3 @@ class BreakpointAPITestCase(TestBase): # Finally make sure the original breakpoint is no longer valid. self.assertTrue (not breakpoint, "Breakpoint we deleted is no longer valid.") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/class_members/TestSBTypeClassMembers.py b/lldb/test/python_api/class_members/TestSBTypeClassMembers.py index 1361c787839..90e79dc1a7a 100644 --- a/lldb/test/python_api/class_members/TestSBTypeClassMembers.py +++ b/lldb/test/python_api/class_members/TestSBTypeClassMembers.py @@ -2,9 +2,10 @@ Test SBType APIs to fetch member function types. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -71,9 +72,3 @@ class SBTypeMemberFunctionsTest(TestBase): self.assertTrue(Thingy.GetMemberFunctionAtIndex(0).GetReturnType().GetName() == "id", "Thingy::init returns an id") self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments() == 2, "Thingy::foo takes two arguments") self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(0).GetName() == "int", "Thingy::foo takes an int") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index 147ad8a1a1f..e7b141ebaf5 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -11,9 +11,10 @@ SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects after default construction. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -387,10 +388,3 @@ class APIDefaultConstructorTestCase(TestBase): # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_watchpoint sb_watchpoint.fuzz_obj(obj) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py b/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py index 51da105ea7a..e16c6f09437 100644 --- a/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py +++ b/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py @@ -2,9 +2,10 @@ Use lldb Python API to disassemble raw machine code bytes """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -33,9 +34,3 @@ class DisassembleRawDataTestCase(TestBase): self.assertTrue (inst.GetMnemonic(target) == "movq") self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py index 4bd4367e096..d25dabc6e63 100644 --- a/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py +++ b/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py @@ -2,9 +2,10 @@ Use lldb Python API to disassemble raw machine code bytes """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -52,10 +53,3 @@ class Disassemble_VST1_64(TestBase): print "Disassembled%s" % str(inst) self.assertTrue (inst.GetMnemonic(target) == "vst1.64") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/event/TestEvents.py b/lldb/test/python_api/event/TestEvents.py index cc744081518..f2d52570d25 100644 --- a/lldb/test/python_api/event/TestEvents.py +++ b/lldb/test/python_api/event/TestEvents.py @@ -2,9 +2,10 @@ Test lldb Python event APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -280,9 +281,3 @@ class EventAPITestCase(TestBase): # The final judgement. :-) self.assertTrue(self.state == 'stopped', "Both expected state changed events received") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py b/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py index a2a433f44ea..c5bdcb89fec 100644 --- a/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py +++ b/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py @@ -1,7 +1,8 @@ """Test that SBFrame::FindValue finds things but does not duplicate the entire variables list""" +import lldb_shared + import os, sys, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -45,9 +46,3 @@ class SBFrameFindValueTestCase(TestBase): self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after failed FindValue()") self.assertTrue(self.frame.FindValue("a",lldb.eValueTypeVariableArgument,lldb.eDynamicCanRunTarget).IsValid(), "FindValue() didn't find an argument") self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after successful FindValue()") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/formatters/TestFormattersSBAPI.py b/lldb/test/python_api/formatters/TestFormattersSBAPI.py index 804f504b3da..b6d693ff1fd 100644 --- a/lldb/test/python_api/formatters/TestFormattersSBAPI.py +++ b/lldb/test/python_api/formatters/TestFormattersSBAPI.py @@ -1,7 +1,8 @@ """Test Python APIs for working with formatters""" +import lldb_shared + import os, sys, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -339,10 +340,3 @@ class SBFormattersAPITestCase(TestBase): if self.TraceOn(): print int_vector self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is still empty') - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/frame/TestFrames.py b/lldb/test/python_api/frame/TestFrames.py index 42fa8b9d1f4..b13edd09396 100644 --- a/lldb/test/python_api/frame/TestFrames.py +++ b/lldb/test/python_api/frame/TestFrames.py @@ -7,7 +7,6 @@ import lldb_shared import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -200,10 +199,3 @@ class FrameAPITestCase(TestBase): # The latest two frames should not be equal. self.assertFalse(frameOutOfC.IsEqual(frameNow)) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/frame/inlines/TestInlinedFrame.py b/lldb/test/python_api/frame/inlines/TestInlinedFrame.py index 98bd8e60109..e5e53918190 100644 --- a/lldb/test/python_api/frame/inlines/TestInlinedFrame.py +++ b/lldb/test/python_api/frame/inlines/TestInlinedFrame.py @@ -2,9 +2,10 @@ Testlldb Python SBFrame APIs IsInlined() and GetFunctionName(). """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -73,9 +74,3 @@ class InlinedFrameAPITestCase(TestBase): print stack_traces2 self.expect(stack_traces2, "Second stop at %s:%d" % (self.source, self.second_stop), exe=False, substrs = ['%s:%d' % (self.source, self.second_stop)]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/function_symbol/TestDisasmAPI.py b/lldb/test/python_api/function_symbol/TestDisasmAPI.py index c8e079fd299..4018b52ea73 100644 --- a/lldb/test/python_api/function_symbol/TestDisasmAPI.py +++ b/lldb/test/python_api/function_symbol/TestDisasmAPI.py @@ -2,9 +2,10 @@ Test retrieval of SBAddress from function/symbol, disassembly, and SBAddress APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -105,9 +106,3 @@ class DisasmAPITestCase(TestBase): desc2 = get_description(sa2) self.assertTrue(desc1 and desc2 and desc1 == desc2, "SBAddress.GetDescription() API of sa1 and sa2 should return the same string") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/python_api/function_symbol/TestSymbolAPI.py index b363c1aaaed..1d7a428ddf4 100644 --- a/lldb/test/python_api/function_symbol/TestSymbolAPI.py +++ b/lldb/test/python_api/function_symbol/TestSymbolAPI.py @@ -2,9 +2,10 @@ Test newly added SBSymbol and SBAddress APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -75,10 +76,3 @@ class SymbolAPITestCase(TestBase): if self.TraceOn(): print "UUID:", addr_line1.GetModule().GetUUIDString() self.assertTrue(addr_line1.GetModule().GetUUIDString() == addr_line2.GetModule().GetUUIDString()) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/hello_world/TestHelloWorld.py b/lldb/test/python_api/hello_world/TestHelloWorld.py index 8e586c8dcdf..1800dd0fb69 100644 --- a/lldb/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/test/python_api/hello_world/TestHelloWorld.py @@ -1,7 +1,8 @@ """Test Python APIs for target (launch and attach), breakpoint, and process.""" +import lldb_shared + import os, sys, time -import unittest2 import lldb import time from lldbtest import * @@ -139,9 +140,3 @@ class HelloWorldTestCase(TestBase): self.expect(stacktraces, exe=False, substrs = ['main.c:%d' % self.line2, '(int)argc=3']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py b/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py index b617a617e87..1f5171d1018 100644 --- a/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py +++ b/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py @@ -1,7 +1,8 @@ """Test the SBCommandInterpreter APIs.""" +import lldb_shared + import os -import unittest2 import lldb from lldbtest import * @@ -68,10 +69,3 @@ class CommandInterpreterAPICase(TestBase): if self.TraceOn(): lldbutil.print_stacktraces(process) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py b/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py index 4b0c460ad69..28121365b75 100644 --- a/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py +++ b/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py @@ -2,8 +2,9 @@ Test utility functions for the frame object. """ +import lldb_shared + import os -import unittest2 import lldb from lldbtest import * @@ -54,10 +55,3 @@ class FrameUtilsTestCase(TestBase): lldbutil.print_stacktrace(thread) print "Current frame: %s" % frame0_args print "Parent frame: %s" % parent_args - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py b/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py index 124f7031597..c8ee37c1661 100644 --- a/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py +++ b/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py @@ -2,9 +2,10 @@ Test the iteration protocol for some lldb container objects. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * @@ -117,9 +118,3 @@ class LLDBIteratorTestCase(TestBase): print frame self.assertTrue(stopped_due_to_breakpoint) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py b/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py index 32d660e5950..0a49bc2fe4a 100644 --- a/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py +++ b/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py @@ -2,9 +2,10 @@ Test the iteration protocol for frame registers. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * @@ -89,10 +90,3 @@ class RegistersIteratorTestCase(TestBase): # We've finished dumping the registers for frame #0. break - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py b/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py index 09945f5cbe5..7319ce39b48 100644 --- a/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py +++ b/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py @@ -2,9 +2,10 @@ Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * @@ -47,10 +48,3 @@ class ThreadsStackTracesTestCase(TestBase): stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) self.expect(stacktraces, exe=False, substrs = ['(int)argc=3']) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py index 78e4b229bf9..d1a69f934d6 100644 --- a/lldb/test/python_api/module_section/TestModuleAndSection.py +++ b/lldb/test/python_api/module_section/TestModuleAndSection.py @@ -2,9 +2,10 @@ Test some SBModule and SBSection APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb from lldbtest import * from lldbutil import symbol_type_to_str @@ -121,9 +122,3 @@ class ModuleAndSectionAPIsTestCase(TestBase): INDENT2 = INDENT * 2 for cu in exe_module.compile_unit_iter(): print cu - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/objc_type/TestObjCType.py b/lldb/test/python_api/objc_type/TestObjCType.py index 9b8e915dd44..ed34d43a295 100644 --- a/lldb/test/python_api/objc_type/TestObjCType.py +++ b/lldb/test/python_api/objc_type/TestObjCType.py @@ -2,9 +2,10 @@ Test SBType for ObjC classes. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -58,9 +59,3 @@ class ObjCSBTypeTestCase(TestBase): aBarField = aBarType.GetFieldAtIndex(0) self.assertTrue(aBarField.GetName() == "_iVar", "The field has the right name") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index 0aaeca6299e..15a70d12a08 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -2,8 +2,9 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbutil import get_stopped_thread, state_type_to_str from lldbtest import * @@ -283,10 +284,3 @@ class ProcessAPITestCase(TestBase): num = process.GetNumSupportedHardwareWatchpoints(error) if self.TraceOn() and error.Success(): print "Number of supported hardware watchpoints: %d" % num - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/process/io/TestProcessIO.py b/lldb/test/python_api/process/io/TestProcessIO.py index 9bd3b82a4f5..1fce478b4f2 100644 --- a/lldb/test/python_api/process/io/TestProcessIO.py +++ b/lldb/test/python_api/process/io/TestProcessIO.py @@ -1,7 +1,8 @@ """Test Python APIs for process IO.""" +import lldb_shared + import os, sys, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -201,9 +202,3 @@ class ProcessIOTestCase(TestBase): for line in self.lines: check_line = 'input line to stderr: %s' % (line) self.assertTrue(check_line in error, "verify stderr line shows up in STDERR") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py b/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py index 7f9fb1ca27c..1880dc25f99 100644 --- a/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py +++ b/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py @@ -2,8 +2,9 @@ Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -49,9 +50,3 @@ class Radar12481949DataFormatterTestCase(TestBase): self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1, "GetValueAsUnsigned() does not say -1") self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFFFFFFFFFF, "GetValueAsUnsigned() says 0xFFFFFFFFFFFFFFFF") self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF, "GetValueAsUnsigned() does not say 0xFFFFFFFF") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/sbdata/TestSBData.py b/lldb/test/python_api/sbdata/TestSBData.py index f3fd65b1884..beb9fd57c5c 100644 --- a/lldb/test/python_api/sbdata/TestSBData.py +++ b/lldb/test/python_api/sbdata/TestSBData.py @@ -1,7 +1,8 @@ """Test the SBData APIs.""" +import lldb_shared + import os -import unittest2 import lldb from lldbtest import * from math import fabs @@ -343,9 +344,3 @@ class SBDataAPICase(TestBase): arg, stream.GetData())) self.assertTrue(expected == result, "%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected)) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py b/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py index a5881db1877..eca6f41a13c 100644 --- a/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py +++ b/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py @@ -1,7 +1,8 @@ """Test SBValue::Persist""" +import lldb_shared + import os, sys, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -69,9 +70,3 @@ class SBValuePersistTestCase(TestBase): self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85") self.expect("expr *(%s)" % (barPersist.GetName()), substrs = ['= 4']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/section/TestSectionAPI.py b/lldb/test/python_api/section/TestSectionAPI.py index 10870a89f0a..7a6bc3ac812 100755 --- a/lldb/test/python_api/section/TestSectionAPI.py +++ b/lldb/test/python_api/section/TestSectionAPI.py @@ -2,7 +2,8 @@ Test SBSection APIs. """ -import unittest2 +import lldb_shared + from lldbtest import * class SectionAPITestCase(TestBase): @@ -36,9 +37,3 @@ class SectionAPITestCase(TestBase): self.assertIsNotNone(data_section) self.assertEquals(data_section.target_byte_size, 1) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/signals/TestSignalsAPI.py b/lldb/test/python_api/signals/TestSignalsAPI.py index f8c3db8e79b..7bea793c511 100644 --- a/lldb/test/python_api/signals/TestSignalsAPI.py +++ b/lldb/test/python_api/signals/TestSignalsAPI.py @@ -2,8 +2,9 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbutil import get_stopped_thread, state_type_to_str from lldbtest import * @@ -42,10 +43,3 @@ class SignalsAPITestCase(TestBase): process.Continue() self.assertTrue(process.state == lldb.eStateExited, "The process should have exited") self.assertTrue(process.GetExitStatus() == 0, "The process should have returned 0") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/symbol-context/TestSymbolContext.py b/lldb/test/python_api/symbol-context/TestSymbolContext.py index a92315e71c3..5bca394d3b1 100644 --- a/lldb/test/python_api/symbol-context/TestSymbolContext.py +++ b/lldb/test/python_api/symbol-context/TestSymbolContext.py @@ -2,9 +2,10 @@ Test SBSymbolContext APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -83,10 +84,3 @@ class SymbolContextAPITestCase(TestBase): symbol = context.GetSymbol() self.assertTrue(function.GetName() == symbol.GetName() and symbol.GetName() == 'c', "The symbol name should be 'c'") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py index a9f3590123a..e61d82d0e04 100644 --- a/lldb/test/python_api/target/TestTargetAPI.py +++ b/lldb/test/python_api/target/TestTargetAPI.py @@ -2,9 +2,11 @@ Test SBTarget APIs. """ +import lldb_shared + +import unittest2 import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -365,10 +367,3 @@ class TargetAPITestCase(TestBase): desc2 = get_description(symbol2) self.assertTrue(desc1 and desc2 and desc1 == desc2, "The two addresses should resolve to the same symbol") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/thread/TestThreadAPI.py b/lldb/test/python_api/thread/TestThreadAPI.py index 8ace950a46e..2fea893a1eb 100644 --- a/lldb/test/python_api/thread/TestThreadAPI.py +++ b/lldb/test/python_api/thread/TestThreadAPI.py @@ -2,8 +2,9 @@ Test SBThread APIs. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbutil import get_stopped_thread, get_caller_symbol from lldbtest import * @@ -240,10 +241,3 @@ class ThreadAPITestCase(TestBase): thread.RunToAddress(start_addr) self.runCmd("process status") #self.runCmd("thread backtrace") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/type/TestTypeList.py b/lldb/test/python_api/type/TestTypeList.py index f790f5f6eee..4be01a210bf 100644 --- a/lldb/test/python_api/type/TestTypeList.py +++ b/lldb/test/python_api/type/TestTypeList.py @@ -2,9 +2,10 @@ Test SBType and SBTypeList API. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -105,9 +106,3 @@ class TypeAndTypeListTestCase(TestBase): # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h). int_type = id_type.GetBasicType(lldb.eBasicTypeInt) self.assertTrue(id_type == int_type) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/value/TestValueAPI.py b/lldb/test/python_api/value/TestValueAPI.py index 3c67d69e225..e6d8825c530 100644 --- a/lldb/test/python_api/value/TestValueAPI.py +++ b/lldb/test/python_api/value/TestValueAPI.py @@ -2,9 +2,10 @@ Test some SBValue APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -129,9 +130,3 @@ class ValueAPITestCase(TestBase): val_a = target.EvaluateExpression('a') self.assertTrue(val_s.GetChildMemberWithName('a').AddressOf(), VALID_VARIABLE) self.assertTrue(val_a.Cast(val_i.GetType()).AddressOf(), VALID_VARIABLE) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py index dd30c9d4087..0b326b945e1 100644 --- a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py +++ b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py @@ -2,9 +2,10 @@ Test some SBValue APIs. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -142,9 +143,3 @@ class ChangeValueAPITestCase(TestBase): self.assertTrue(thread == None, "We should not have managed to hit our second breakpoint with sp == 1") process.Kill() - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py b/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py index 2329c96fe61..8270ed8fffe 100644 --- a/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py +++ b/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py @@ -3,9 +3,10 @@ Test SBValue API linked_list_iter which treats the SBValue as a linked list and supports iteration till the end of list is reached. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -127,9 +128,3 @@ class ValueAsLinkedListTestCase(TestBase): list.append(int(t.GetChildMemberWithName("id").GetValue())) self.assertTrue(len(list) == 3) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py index 76d4d64b542..9c0123ec2e1 100644 --- a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py +++ b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py @@ -1,7 +1,8 @@ """Test SBValue::GetValueDidChange""" +import lldb_shared + import os, sys, time -import unittest2 import lldb import time from lldbtest import * @@ -54,9 +55,3 @@ class HelloWorldTestCase(TestBase): # Check complex type self.assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange() and not c.GetChildAtIndex(1).GetValueDidChange(), "GetValueDidChange() is saying a lie") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/TestSetWatchpoint.py b/lldb/test/python_api/watchpoint/TestSetWatchpoint.py index 9e464ad363a..242b199db7d 100644 --- a/lldb/test/python_api/watchpoint/TestSetWatchpoint.py +++ b/lldb/test/python_api/watchpoint/TestSetWatchpoint.py @@ -2,9 +2,10 @@ Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -87,10 +88,3 @@ class SetWatchpointAPITestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py b/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py index 6b4197b3d48..f8ae2a23966 100644 --- a/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py +++ b/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py @@ -2,9 +2,10 @@ Use lldb Python SBWatchpoint API to set the ignore count. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -83,10 +84,3 @@ class WatchpointIgnoreCountTestCase(TestBase): self.assertTrue(watchpoint.GetWatchSize() == 4) self.assertTrue(watchpoint.GetHitCount() == 2) print watchpoint - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/TestWatchpointIter.py b/lldb/test/python_api/watchpoint/TestWatchpointIter.py index 8a6877930ee..0ba73c0500b 100644 --- a/lldb/test/python_api/watchpoint/TestWatchpointIter.py +++ b/lldb/test/python_api/watchpoint/TestWatchpointIter.py @@ -2,9 +2,10 @@ Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -108,10 +109,3 @@ class WatchpointIteratorTestCase(TestBase): self.assertTrue(watchpoint.GetWatchSize() == 4) self.assertTrue(watchpoint.GetHitCount() == 1) print watchpoint - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py index 041e185de54..dd7c79971e8 100644 --- a/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ b/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py @@ -2,8 +2,9 @@ Test watchpoint condition API. """ +import lldb_shared + import os, time -import unittest2 import lldb import lldbutil from lldbtest import * @@ -84,10 +85,3 @@ class WatchpointConditionAPITestCase(TestBase): # Verify that the condition is met. self.assertTrue(value.GetValueAsUnsigned() == 5) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py index 9830dd19777..51a8955b689 100644 --- a/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py +++ b/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py @@ -2,9 +2,10 @@ Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '*g_char_ptr'. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -84,10 +85,3 @@ class SetWatchlocationAPITestCase(TestBase): substrs = [self.violating_func]) # This finishes our test. - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index ebcb6ff12d9..d6a3ca60c87 100644 --- a/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -2,9 +2,10 @@ Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of '*g_char_ptr'. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -124,10 +125,3 @@ class TargetWatchAddressAPITestCase(TestBase): self.assertFalse(watchpoint) self.expect(error.GetCString(), exe=False, substrs = ['watch size of %d is not supported' % 365]) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() |