summaryrefslogtreecommitdiffstats
path: root/lldb/test/lang/c
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/lang/c')
-rw-r--r--lldb/test/lang/c/anonymous/TestAnonymous.py9
-rw-r--r--lldb/test/lang/c/array_types/TestArrayTypes.py10
-rw-r--r--lldb/test/lang/c/bitfields/TestBitfields.py10
-rw-r--r--lldb/test/lang/c/blocks/TestBlocks.py10
-rw-r--r--lldb/test/lang/c/const_variables/TestConstVariables.py9
-rw-r--r--lldb/test/lang/c/enum_types/TestEnumTypes.py9
-rw-r--r--lldb/test/lang/c/forward/TestForwardDeclaration.py10
-rw-r--r--lldb/test/lang/c/function_types/TestFunctionTypes.py9
-rw-r--r--lldb/test/lang/c/global_variables/TestGlobalVariables.py10
-rw-r--r--lldb/test/lang/c/modules/TestCModules.py9
-rw-r--r--lldb/test/lang/c/register_variables/TestRegisterVariables.py9
-rw-r--r--lldb/test/lang/c/set_values/TestSetValues.py10
-rw-r--r--lldb/test/lang/c/shared_lib/TestSharedLib.py8
-rw-r--r--lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py8
-rw-r--r--lldb/test/lang/c/stepping/TestStepAndBreakpoints.py9
-rw-r--r--lldb/test/lang/c/stepping/TestThreadStepping.py10
-rw-r--r--lldb/test/lang/c/strings/TestCStrings.py6
-rw-r--r--lldb/test/lang/c/tls_globals/TestTlsGlobals.py10
-rw-r--r--lldb/test/lang/c/typedef/Testtypedef.py9
19 files changed, 38 insertions, 136 deletions
diff --git a/lldb/test/lang/c/anonymous/TestAnonymous.py b/lldb/test/lang/c/anonymous/TestAnonymous.py
index da0ef5b9f11..1899384c1cd 100644
--- a/lldb/test/lang/c/anonymous/TestAnonymous.py
+++ b/lldb/test/lang/c/anonymous/TestAnonymous.py
@@ -1,7 +1,8 @@
"""Test that anonymous structs/unions are transparent to member access"""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -142,9 +143,3 @@ class AnonymousTestCase(TestBase):
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs = [' resolved, hit count = 1'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py
index e159efc4382..98e839ca104 100644
--- a/lldb/test/lang/c/array_types/TestArrayTypes.py
+++ b/lldb/test/lang/c/array_types/TestArrayTypes.py
@@ -1,7 +1,8 @@
"""Test breakpoint by file/line number; and list variables with array types."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -193,10 +194,3 @@ class ArrayTypesTestCase(TestBase):
self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument,
"Variable 'argc' should have '%s' value type." %
value_type_to_str(lldb.eValueTypeVariableArgument))
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/bitfields/TestBitfields.py b/lldb/test/lang/c/bitfields/TestBitfields.py
index 090b31950e8..024af2d1c5c 100644
--- a/lldb/test/lang/c/bitfields/TestBitfields.py
+++ b/lldb/test/lang/c/bitfields/TestBitfields.py
@@ -1,7 +1,8 @@
"""Show bitfields and check that they display correctly."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -157,10 +158,3 @@ class BitfieldsTestCase(TestBase):
# Now kill the process, and we are done.
rc = target.GetProcess().Kill()
self.assertTrue(rc.Success())
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/blocks/TestBlocks.py b/lldb/test/lang/c/blocks/TestBlocks.py
index 6dd4bec46e4..783401e2e0f 100644
--- a/lldb/test/lang/c/blocks/TestBlocks.py
+++ b/lldb/test/lang/c/blocks/TestBlocks.py
@@ -1,7 +1,9 @@
"""Test that lldb can invoke blocks and access variables inside them"""
-import os, time
+import lldb_shared
+
import unittest2
+import os, time
import lldb
from lldbtest import *
import lldbutil
@@ -55,9 +57,3 @@ class BlocksTestCase(TestBase):
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs = ['stopped',
'stop reason = breakpoint'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/const_variables/TestConstVariables.py b/lldb/test/lang/c/const_variables/TestConstVariables.py
index 8954e49a189..30fc91adab4 100644
--- a/lldb/test/lang/c/const_variables/TestConstVariables.py
+++ b/lldb/test/lang/c/const_variables/TestConstVariables.py
@@ -1,7 +1,8 @@
"""Check that compiler-generated constant values work correctly"""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -57,9 +58,3 @@ class ConstVariableTestCase(TestBase):
substrs = ['(int) $1 = 256'])
self.runCmd("kill")
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/enum_types/TestEnumTypes.py b/lldb/test/lang/c/enum_types/TestEnumTypes.py
index 96d290739a8..6f1c52d2844 100644
--- a/lldb/test/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/lang/c/enum_types/TestEnumTypes.py
@@ -1,7 +1,8 @@
"""Look up enum type information and check for correct display."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -66,9 +67,3 @@ class EnumTypesTestCase(TestBase):
self.expect("frame variable day", 'check for valid enumeration value',
substrs = [enum_value])
lldbutil.continue_to_breakpoint (self.process(), bkpt)
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/forward/TestForwardDeclaration.py b/lldb/test/lang/c/forward/TestForwardDeclaration.py
index 9eb8ae6d245..6db0b30b567 100644
--- a/lldb/test/lang/c/forward/TestForwardDeclaration.py
+++ b/lldb/test/lang/c/forward/TestForwardDeclaration.py
@@ -1,7 +1,8 @@
"""Test that forward declaration of a data structure gets resolved correctly."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -42,10 +43,3 @@ class ForwardDeclarationTestCase(TestBase):
substrs = ['(bar)',
'(int) a = 1',
'(int) b = 2'])
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/function_types/TestFunctionTypes.py b/lldb/test/lang/c/function_types/TestFunctionTypes.py
index f8ac8a68207..fb46ea8be5e 100644
--- a/lldb/test/lang/c/function_types/TestFunctionTypes.py
+++ b/lldb/test/lang/c/function_types/TestFunctionTypes.py
@@ -1,7 +1,8 @@
"""Test variable with function ptr type and that break on the function works."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -71,9 +72,3 @@ class FunctionTypesTestCase(TestBase):
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs = [' resolved, hit count = 1'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/global_variables/TestGlobalVariables.py b/lldb/test/lang/c/global_variables/TestGlobalVariables.py
index 23005095f43..7d9c0ddaecd 100644
--- a/lldb/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/lldb/test/lang/c/global_variables/TestGlobalVariables.py
@@ -1,7 +1,8 @@
"""Show global variables and check that they do indeed have global scopes."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -72,10 +73,3 @@ class GlobalVariablesTestCase(TestBase):
substrs = ['g_marked_spot.y', '21'])
self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY, matching=False,
substrs = ["can't be resolved"])
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/modules/TestCModules.py b/lldb/test/lang/c/modules/TestCModules.py
index 1ac8484a5f5..5875c777329 100644
--- a/lldb/test/lang/c/modules/TestCModules.py
+++ b/lldb/test/lang/c/modules/TestCModules.py
@@ -1,7 +1,8 @@
"""Test that importing modules in C works as expected."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
import platform
import lldbutil
@@ -60,9 +61,3 @@ class CModulesTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set breakpoint 0 here.')
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/register_variables/TestRegisterVariables.py b/lldb/test/lang/c/register_variables/TestRegisterVariables.py
index 9274524c87a..a73bc26e7eb 100644
--- a/lldb/test/lang/c/register_variables/TestRegisterVariables.py
+++ b/lldb/test/lang/c/register_variables/TestRegisterVariables.py
@@ -1,7 +1,8 @@
"""Check that compiler-generated register values work correctly"""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -65,9 +66,3 @@ class RegisterVariableTestCase(TestBase):
substrs = ['(int) $3 = 5'])
self.runCmd("kill")
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/set_values/TestSetValues.py b/lldb/test/lang/c/set_values/TestSetValues.py
index 4e64a4100ca..ae70f77868e 100644
--- a/lldb/test/lang/c/set_values/TestSetValues.py
+++ b/lldb/test/lang/c/set_values/TestSetValues.py
@@ -1,7 +1,8 @@
"""Test settings and readings of program variables."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -106,10 +107,3 @@ class SetValuesTestCase(TestBase):
self.runCmd("expression i = 1.5")
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
startstr = "(long double) i = 1.5")
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/shared_lib/TestSharedLib.py b/lldb/test/lang/c/shared_lib/TestSharedLib.py
index f2a84af0161..dd095272d80 100644
--- a/lldb/test/lang/c/shared_lib/TestSharedLib.py
+++ b/lldb/test/lang/c/shared_lib/TestSharedLib.py
@@ -1,5 +1,7 @@
"""Test that types defined in shared libraries work correctly."""
+import lldb_shared
+
import unittest2
import lldb
from lldbtest import *
@@ -65,9 +67,3 @@ class SharedLibTestCase(TestBase):
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs = [' resolved, hit count = 1'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index c6cd427788c..611a3618a98 100644
--- a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -1,5 +1,7 @@
"""Test that types defined in shared libraries with stripped symbols work correctly."""
+import lldb_shared
+
import unittest2
import lldb
from lldbtest import *
@@ -67,9 +69,3 @@ class SharedLibStrippedTestCase(TestBase):
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs = [' resolved, hit count = 1'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py
index 11d639a8902..ed50926fa47 100644
--- a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -1,7 +1,8 @@
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
import lldbutil
from lldbtest import *
@@ -237,9 +238,3 @@ class TestCStepping(TestBase):
thread.StepInto("NoSuchFunction")
self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/stepping/TestThreadStepping.py b/lldb/test/lang/c/stepping/TestThreadStepping.py
index 50322b8287c..e02551b3ac6 100644
--- a/lldb/test/lang/c/stepping/TestThreadStepping.py
+++ b/lldb/test/lang/c/stepping/TestThreadStepping.py
@@ -2,9 +2,10 @@
Test thread stepping features in combination with frame select.
"""
+import lldb_shared
+
import os, time
import re
-import unittest2
import lldb, lldbutil
from lldbtest import *
import lldbutil
@@ -75,10 +76,3 @@ class ThreadSteppingTestCase(TestBase):
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
substrs = ["stop reason = step out"],
patterns = ["frame #0.*main.c:%d" % self.line4])
-
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/strings/TestCStrings.py b/lldb/test/lang/c/strings/TestCStrings.py
index a2752df7976..f1d9be2149f 100644
--- a/lldb/test/lang/c/strings/TestCStrings.py
+++ b/lldb/test/lang/c/strings/TestCStrings.py
@@ -52,9 +52,3 @@ class CStringsTestCase(TestBase):
self.expect("expression !z",
substrs = ['false'])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py
index 564f069f1b9..305ff3984de 100644
--- a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py
+++ b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py
@@ -1,7 +1,9 @@
"""Test that thread-local storage can be read correctly."""
-import os, time
+import lldb_shared
+
import unittest2
+import os, time
import lldb
from lldbtest import *
import lldbutil
@@ -69,9 +71,3 @@ class TlsGlobalTestCase(TestBase):
patterns = ["\(int\) \$.* = 44"])
self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY,
patterns = ["\(int\) \$.* = 33"])
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
diff --git a/lldb/test/lang/c/typedef/Testtypedef.py b/lldb/test/lang/c/typedef/Testtypedef.py
index c00bcd4e3c5..5c2882b715d 100644
--- a/lldb/test/lang/c/typedef/Testtypedef.py
+++ b/lldb/test/lang/c/typedef/Testtypedef.py
@@ -1,7 +1,8 @@
"""Look up type information for typedefs of same name at different lexical scope and check for correct display."""
+import lldb_shared
+
import os, time
-import unittest2
import lldb
from lldbtest import *
import lldbutil
@@ -43,9 +44,3 @@ class TypedefTestCase(TestBase):
self.expect("image lookup -t a", DATA_TYPES_DISPLAYED_CORRECTLY,
substrs = ['name = "' + t + '"'])
self.runCmd("continue")
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
OpenPOWER on IntegriCloud