CtsLogdTestCases: fix issue in LogBufferTest

Testcase:
LogBufferTests/LogBufferTest#tail100_blocking_1000total_then1000more/0

NE happened in line 416 in LogBufferTest.cpp, when read_log_messages
function is called.

As more logs are read in a reader thread, vector read_log_messages size
is constantly changng. read_log_messages function will construct a
new container, maybe after new read_log_messages size gets bigger.

Additionaly, simpleBuffer::flushto will release lock, that means vector
read_log_messages_ is not guarded by lock.

Factor out the "are we finished yet?" loop into TestReaderThread, so we
can add a mutex to that class to guard the read_log_messages_ vector.

Test: Run cts-on-gsi -m CtsLogdTestCases
Bug: 244816302
Signed-off-by: mtk27743 <jianming.liu@mediatek.com>
Change-Id: I7233c2e4c4a51e69ac096e5a0107a437be9ef072
2 files changed
tree: 38edd87d9f7dcea4ea67c337d5046ee2c6158c47
  1. liblog/
  2. logcat/
  3. logd/
  4. logwrapper/
  5. rust/
  6. OWNERS
  7. PREUPLOAD.cfg
  8. TEST_MAPPING