[Lldb-commits] [lldb] r236800 - [TestEvents] Add a 'connected' state to include remote debugging.

Siva Chandra sivachandra at google.com
Thu May 7 17:43:28 PDT 2015


Author: sivachandra
Date: Thu May  7 19:43:28 2015
New Revision: 236800

URL: http://llvm.org/viewvc/llvm-project?rev=236800&view=rev
Log:
[TestEvents] Add a 'connected' state to include remote debugging.

Test Plan: dotest.py -p TestEvents

Reviewers: vharron, chaoren

Reviewed By: chaoren

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9581

Modified:
    lldb/trunk/test/python_api/event/TestEvents.py

Modified: lldb/trunk/test/python_api/event/TestEvents.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/event/TestEvents.py?rev=236800&r1=236799&r2=236800&view=diff
==============================================================================
--- lldb/trunk/test/python_api/event/TestEvents.py (original)
+++ lldb/trunk/test/python_api/event/TestEvents.py Thu May  7 19:43:28 2015
@@ -247,11 +247,13 @@ class EventAPITestCase(TestBase):
 
 
         # The finite state machine for our custom listening thread, with an
-        # initail state of 0, which means a "running" event is expected.
-        # It changes to 1 after "running" is received.
-        # It cahnges to 2 after "stopped" is received.
-        # 2 will be our final state and the test is complete.
-        self.state = 0 
+        # initail state of None, which means no event has been received.
+        # It changes to 'connected' after 'connected' event is received (for remote platforms)
+        # It changes to 'running' after 'running' event is received (should happen only if the
+        # currentstate is either 'None' or 'connected')
+        # It changes to 'stopped' if a 'stopped' event is received (should happen only if the
+        # current state is 'running'.)
+        self.state = None
 
         # Create MyListeningThread to wait for state changed events.
         # By design, a "running" event is expected following by a "stopped" event.
@@ -272,12 +274,20 @@ class EventAPITestCase(TestBase):
                         match = pattern.search(desc)
                         if not match:
                             break;
-                        if self.context.state == 0 and match.group(1) == 'running':
-                            self.context.state = 1
+                        if match.group(1) == 'connected':
+                            # When debugging remote targets with lldb-server, we
+                            # first get the 'connected' event.
+                            self.context.assertTrue(self.context.state == None)
+                            self.context.state = 'connected'
                             continue
-                        elif self.context.state == 1 and match.group(1) == 'stopped':
+                        elif match.group(1) == 'running':
+                            self.context.assertTrue(self.context.state == None or self.context.state == 'connected')
+                            self.context.state = 'running'
+                            continue
+                        elif match.group(1) == 'stopped':
+                            self.context.assertTrue(self.context.state == 'running')
                             # Whoopee, both events have been received!
-                            self.context.state = 2
+                            self.context.state = 'stopped'
                             break
                         else:
                             break
@@ -304,7 +314,7 @@ class EventAPITestCase(TestBase):
         my_thread.join()
 
         # The final judgement. :-)
-        self.assertTrue(self.state == 2,
+        self.assertTrue(self.state == 'stopped',
                         "Both expected state changed events received")
 
         





More information about the lldb-commits mailing list