summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py9
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py9
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py7
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py14
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py3
7 files changed, 18 insertions, 30 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
index e835fb09649..c8bc3f45f31 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
@@ -100,11 +100,8 @@ class ArrayTypesTestCase(TestBase):
"executable = a.out"])
# The stop reason of the thread should be breakpoint.
- thread = process.GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbsuite.test.lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
# Sanity check the print representation of thread.
thr = str(thread)
@@ -120,7 +117,7 @@ class ArrayTypesTestCase(TestBase):
substrs = [tidstr])
# The breakpoint should have a hit count of 1.
- self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
+ self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
# The breakpoint should be resolved by now.
bp = str(breakpoint)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
index de7a333a18f..30ed73b5205 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
@@ -112,14 +112,11 @@ class BitfieldsTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread = target.GetProcess().GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbsuite.test.lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
# The breakpoint should have a hit count of 1.
- self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
+ self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
# Lookup the "bits" variable which contains 8 bitfields.
frame = thread.GetFrameAtIndex(0)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
index d47d1b7dde4..9df6b123fce 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
@@ -69,11 +69,8 @@ class StaticVariableTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread = process.GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbsuite.test.lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
# Get the SBValue of 'A::g_points' and 'g_points'.
frame = thread.GetFrameAtIndex(0)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
index b67e53c3074..7b89a911e08 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
@@ -92,11 +92,8 @@ class ClassTypesTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
# The stop reason of the thread should be breakpoint.
- thread = process.GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbsuite.test.lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
# The filename of frame #0 should be 'main.cpp' and the line number
# should be 93.
@@ -203,11 +200,8 @@ class ClassTypesTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
# The stop reason of the thread should be breakpoint.
- thread = process.GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbsuite.test.lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
frame = thread.frames[0]
self.assertTrue (frame.IsValid(), "Got a valid frame.")
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
index 595d075d518..a423ed3b23a 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
@@ -46,7 +46,8 @@ class IterateFrameAndDisassembleTestCase(TestBase):
# disassemble it.
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = process.GetThreadAtIndex(0)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
depth = thread.GetNumFrames()
for i in range(depth - 1):
frame = thread.GetFrameAtIndex(i)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
index 67de03b54b2..d525e12b31e 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
@@ -20,7 +20,8 @@ class CPPTestDiamondInheritance(TestBase):
self.set_breakpoint(line_number('main.cpp', '// breakpoint 2'))
process = target.LaunchSimple (None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- thread = process.GetThreadAtIndex(0)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
frame = thread.GetFrameAtIndex(0)
j1 = frame.FindVariable("j1")
j1_Derived1 = j1.GetChildAtIndex(0)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
index d7435c46727..865516de4ed 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
@@ -51,7 +51,8 @@ class StdCXXDisassembleTestCase(TestBase):
# Disassemble the functions on the call stack.
self.runCmd("thread backtrace")
- thread = process.GetThreadAtIndex(0)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
depth = thread.GetNumFrames()
for i in range(depth - 1):
frame = thread.GetFrameAtIndex(i)
OpenPOWER on IntegriCloud