[Lldb-commits] [lldb] a97dfdc - [lldb] Assert the process has exited before we gets its output.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 7 15:06:44 PDT 2020


Author: Jonas Devlieghere
Date: 2020-08-07T15:06:38-07:00
New Revision: a97dfdc30b5bdec7d6cdcb9f421ef5a288495420

URL: https://github.com/llvm/llvm-project/commit/a97dfdc30b5bdec7d6cdcb9f421ef5a288495420
DIFF: https://github.com/llvm/llvm-project/commit/a97dfdc30b5bdec7d6cdcb9f421ef5a288495420.diff

LOG: [lldb] Assert the process has exited before we gets its output.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index b97ae8175c05..de8bed08f5fa 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -162,9 +162,14 @@ def test_launch_simple(self):
         self.setTearDownCleanup(dictionary=d)
         target = self.create_simple_target('b.out')
 
+        # Set the debugger to synchronous mode so we only continue after the
+        # process has exited.
+        self.dbg.SetAsync(False)
+
         process = target.LaunchSimple(
             ['foo', 'bar'], ['baz'], self.get_process_working_directory())
         self.runCmd("run")
+        self.assertEqual(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertIn('arg: foo', output)
         self.assertIn('arg: bar', output)
@@ -175,6 +180,7 @@ def test_launch_simple(self):
         process = target.LaunchSimple(None, None,
                                       self.get_process_working_directory())
         self.runCmd("run")
+        self.assertEqual(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertIn('arg: foo', output)
         self.assertIn('env: bar=baz', output)
@@ -183,6 +189,7 @@ def test_launch_simple(self):
         process = target.LaunchSimple(
             None, None, self.get_process_working_directory())
         self.runCmd("run")
+        self.assertEqual(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertEqual(output, "")
 


        


More information about the lldb-commits mailing list