Skip to content

Commit a97dfdc

Browse files
committed
[lldb] Assert the process has exited before we gets its output.
1 parent 7abef41 commit a97dfdc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lldb/test/API/python_api/target/TestTargetAPI.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,14 @@ def test_launch_simple(self):
162162
self.setTearDownCleanup(dictionary=d)
163163
target = self.create_simple_target('b.out')
164164

165+
# Set the debugger to synchronous mode so we only continue after the
166+
# process has exited.
167+
self.dbg.SetAsync(False)
168+
165169
process = target.LaunchSimple(
166170
['foo', 'bar'], ['baz'], self.get_process_working_directory())
167171
self.runCmd("run")
172+
self.assertEqual(process.GetState(), lldb.eStateExited)
168173
output = process.GetSTDOUT(9999)
169174
self.assertIn('arg: foo', output)
170175
self.assertIn('arg: bar', output)
@@ -175,6 +180,7 @@ def test_launch_simple(self):
175180
process = target.LaunchSimple(None, None,
176181
self.get_process_working_directory())
177182
self.runCmd("run")
183+
self.assertEqual(process.GetState(), lldb.eStateExited)
178184
output = process.GetSTDOUT(9999)
179185
self.assertIn('arg: foo', output)
180186
self.assertIn('env: bar=baz', output)
@@ -183,6 +189,7 @@ def test_launch_simple(self):
183189
process = target.LaunchSimple(
184190
None, None, self.get_process_working_directory())
185191
self.runCmd("run")
192+
self.assertEqual(process.GetState(), lldb.eStateExited)
186193
output = process.GetSTDOUT(9999)
187194
self.assertEqual(output, "")
188195

0 commit comments

Comments
 (0)