lmkd/tests: add 200ms wait for reaper to output its logs

Occasionally the test reads logcat before lmkd reaper had a chance to
write into it, resulting in the expected report messages being missed.
Add a 200ms delay after lmkd kills the process to give lmkd reper thread
more time to write its reports.

Bug: 347296675
Bug: 358830454
Test: atest lmkd_tests
Change-Id: I2549e37f25c81c9add91f7ee450c4a96c8cf18e4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan 2024-06-15 19:20:52 -07:00
parent 13b5b0ce06
commit 753642e31a
1 changed files with 3 additions and 0 deletions

View File

@ -210,6 +210,9 @@ TEST_F(LmkdTest, TargetReaping) {
FAIL() << "Target process " << pid << " was not killed"; FAIL() << "Target process " << pid << " was not killed";
} }
// wait 200ms for the reaper thread to write its output in the logcat
usleep(200000);
std::string regex = StringPrintf("((" LMKD_KILL_TEMPLATE ")|(" LMKD_REAP_TEMPLATE std::string regex = StringPrintf("((" LMKD_KILL_TEMPLATE ")|(" LMKD_REAP_TEMPLATE
")|(" LMKD_REAP_FAIL_TEMPLATE "))", ")|(" LMKD_REAP_FAIL_TEMPLATE "))",
pid, pid, pid); pid, pid, pid);