[Lldb-commits] [lldb] r258764 - Fix TestRerun.py on Windows.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 25 17:19:51 PST 2016


Author: zturner
Date: Mon Jan 25 19:19:50 2016
New Revision: 258764

URL: http://llvm.org/viewvc/llvm-project?rev=258764&view=rev
Log:
Fix TestRerun.py on Windows.

This is another example of a test that was looking for the thread
at index 0 instead of requesting the thread that was stopped at
the created breakpoint.  This assumption isn't true on Windows 10.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py?rev=258764&r1=258763&r2=258764&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py Mon Jan 25 19:19:50 2016
@@ -31,19 +31,9 @@ class TestRerun(TestBase):
         self.runCmd("process launch 1 2 3")
 
         process = self.process()
-
-        self.assertTrue(process.GetState() == lldb.eStateStopped,
-                        STOPPED_DUE_TO_BREAKPOINT)
-
-        thread = process.GetThreadAtIndex (0)
-
-        self.assertTrue (thread.IsValid(),
-                         "Process stopped at 'main' should have a valid thread");
-
-        stop_reason = thread.GetStopReason()
-        
-        self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
-                         "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
+        thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
+        self.assertIsNotNone(thread, "Process should be stopped at a breakpoint in main")
+        self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
 
         self.expect("frame variable argv[1]", substrs=['1'])
         self.expect("frame variable argv[2]", substrs=['2'])
@@ -57,19 +47,10 @@ class TestRerun(TestBase):
         self.runCmd("process launch")
 
         process = self.process()
-        
-        self.assertTrue(process.GetState() == lldb.eStateStopped,
-                        STOPPED_DUE_TO_BREAKPOINT)
-
-        thread = process.GetThreadAtIndex (0)
+        thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
 
-        self.assertTrue (thread.IsValid(),
-                         "Process stopped at 'main' should have a valid thread");
-
-        stop_reason = thread.GetStopReason()
-        
-        self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
-                         "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
+        self.assertIsNotNone(thread, "Process should be stopped at a breakpoint in main");
+        self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
 
         self.expect("frame variable argv[1]", substrs=['1'])
         self.expect("frame variable argv[2]", substrs=['2'])




More information about the lldb-commits mailing list