llvm-project/lldb/test/python_api/process
Pavel Labath 3f5df53fde Fix ProcessIO test failures
Summary:
There was a race condition regarding the output of the inferior process. The reading of the
output is performed on a separate thread, and there was no guarantee that the output will get
eventually consumed. Because of that, it was happening that calling Process::GetSTDOUT was not
returning anything even though the process was terminated and would definitely not produce any
further output. This was usually happening only under very heavy system load, but it can be
reproduced by placing an usleep in the stdio thread (Process::STDIOReadThreadBytesReceived).

This patch addresses this by adding synchronization capabilities to the Communication thread.
After calling Communication::SynchronizeWithReadThread one can be sure that all pending input has
been processed by the read thread. This function is then called after every public event which
stops the process to obtain the entire process output.

Test Plan: TestProcessIO.py should now succeed every time instead of flaking in and out.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 232023
2015-03-12 10:12:41 +00:00
..
io Fix ProcessIO test failures 2015-03-12 10:12:41 +00:00
Makefile
TestProcessAPI.py Correctly set the working directory when launching processes for both local and remote targets. 2013-12-13 19:18:59 +00:00
main.cpp Add a test sequence of SBProcess.ReadCStringFromMemory() with (char *)my_char_ptr as the address to read from. 2011-12-16 00:25:30 +00:00