forked from OSchip/llvm-project
[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 llvm-svn: 236800
This commit is contained in:
parent
60310f2720
commit
8a1f76936c
|
@ -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")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue