summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/thread
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@intel.com>2013-09-19 22:00:07 +0000
committerDaniel Malea <daniel.malea@intel.com>2013-09-19 22:00:07 +0000
commit105b2a4bc3ab388211622d5d9f34db4b0d22b2f1 (patch)
treec1ea416591ad5eb08f18c4fa1bd8e5c90beece23 /lldb/test/functionalities/thread
parent64587097b6f998f72a5bb3b0254d3fd2a079485e (diff)
downloadbcm5719-llvm-105b2a4bc3ab388211622d5d9f34db4b0d22b2f1.tar.gz
bcm5719-llvm-105b2a4bc3ab388211622d5d9f34db4b0d22b2f1.zip
Make threading tests not depend on the currently selected thread
- tests are now anostic to the currently selected thread, as that is a frontend (i.e. driver) decision - this is in preparation to a fix to POSIXThread::BreakNotify that will be committed shortly Reviewed by: Matt Kopec llvm-svn: 191041
Diffstat (limited to 'lldb/test/functionalities/thread')
-rw-r--r--lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py19
-rw-r--r--lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py22
-rw-r--r--lldb/test/functionalities/thread/thread_exit/TestThreadExit.py6
3 files changed, 32 insertions, 15 deletions
diff --git a/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py b/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
index e1751a192ef..d5654fcdb43 100644
--- a/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
+++ b/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
@@ -85,7 +85,7 @@ class CreateDuringStepTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the stepping thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
@@ -117,17 +117,22 @@ class CreateDuringStepTestCase(TestBase):
self.assertTrue(thread1.IsStopped(), "Thread 1 didn't stop during breakpoint")
self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint")
- # Keep stepping until we've reached our designated continue point
- stepping_thread = process.GetSelectedThread()
+ # Find the thread that is stopped at the breakpoint
+ stepping_thread = None
+ for thread in process:
+ expected_bp_desc = "breakpoint %s." % self.bp_num
+ if expected_bp_desc in thread.GetStopDescription(100):
+ stepping_thread = thread
+ break
+ self.assertTrue(stepping_thread != None, "unable to find thread stopped at %s" % expected_bp_desc)
current_line = self.breakpoint
+ # Keep stepping until we've reached our designated continue point
while current_line != self.continuepoint:
- self.runCmd(step_cmd)
-
- # The thread creation may change the selected thread.
- # If it does, we just change it back here.
if stepping_thread != process.GetSelectedThread():
process.SetSelectedThread(stepping_thread)
+ self.runCmd(step_cmd)
+
frame = stepping_thread.GetFrameAtIndex(0)
current_line = frame.GetLineEntry().GetLine()
diff --git a/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py b/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
index 21d4d91eea3..84ffe192046 100644
--- a/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
+++ b/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
@@ -85,7 +85,7 @@ class ExitDuringStepTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
@@ -119,17 +119,29 @@ class ExitDuringStepTestCase(TestBase):
self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint")
self.assertTrue(thread3.IsStopped(), "Thread 3 didn't stop during breakpoint")
- # Keep stepping until we've reached our designated continue point
- stepping_thread = process.GetSelectedThread()
+ # Find the thread that is stopped at the breakpoint
+ stepping_thread = None
+ for thread in process:
+ expected_bp_desc = "breakpoint %s." % self.bp_num
+ if expected_bp_desc in thread.GetStopDescription(100):
+ stepping_thread = thread
+ break
+ self.assertTrue(stepping_thread != None, "unable to find thread stopped at %s" % expected_bp_desc)
+
current_line = self.breakpoint
stepping_frame = stepping_thread.GetFrameAtIndex(0)
self.assertTrue(current_line == stepping_frame.GetLineEntry().GetLine(), "Starting line for stepping doesn't match breakpoint line.")
- while current_line != self.continuepoint:
- self.runCmd(step_cmd)
+ # Keep stepping until we've reached our designated continue point
+ while current_line != self.continuepoint:
+ # Since we're using the command interpreter to issue the thread command
+ # (on the selected thread) we need to ensure the selected thread is the
+ # stepping thread.
if stepping_thread != process.GetSelectedThread():
process.SetSelectedThread(stepping_thread)
+ self.runCmd(step_cmd)
+
frame = stepping_thread.GetFrameAtIndex(0)
current_line = frame.GetLineEntry().GetLine()
diff --git a/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py b/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py
index 51719086ab7..46eee5feec6 100644
--- a/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py
+++ b/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py
@@ -81,7 +81,7 @@ class ThreadExitTestCase(TestBase):
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 2",
substrs = ['stopped',
'thread #1',
- '* thread #2',
+ 'thread #2',
'stop reason = breakpoint 2',
'thread #3'])
@@ -96,7 +96,7 @@ class ThreadExitTestCase(TestBase):
# The stop reason of the thread should be breakpoint 3.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 3",
substrs = ['stopped',
- '* thread #1',
+ 'thread #1',
'stop reason = breakpoint 3',
'thread #3',
])
@@ -112,7 +112,7 @@ class ThreadExitTestCase(TestBase):
# The stop reason of the thread should be breakpoint 4.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 4",
substrs = ['stopped',
- '* thread #1',
+ 'thread #1',
'stop reason = breakpoint 4'])
# Update the number of threads
OpenPOWER on IntegriCloud