From 753642e31ae95818f6805b5b4eba3d080b918088 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Sat, 15 Jun 2024 19:20:52 -0700 Subject: [PATCH] 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 --- tests/lmkd_tests.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/lmkd_tests.cpp b/tests/lmkd_tests.cpp index 2d1b754..0c582b7 100644 --- a/tests/lmkd_tests.cpp +++ b/tests/lmkd_tests.cpp @@ -210,6 +210,9 @@ TEST_F(LmkdTest, TargetReaping) { 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 ")|(" LMKD_REAP_FAIL_TEMPLATE "))", pid, pid, pid);