From ec169b178a5ce09b726d015c7675a128a7bab1aa Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 5 Oct 2023 20:29:58 +0000 Subject: [PATCH] lmkd/tests: handle reordering of killing and reaping reports in the logs Since killing and reaping of a process is done in separate threads, it's possible that the reaping report will be ordered before the kill report. Adjust the test to handle this case by checking for the reaping report in the entire log output. Bug: 296555636 Change-Id: I5549b05392e08655655d4aecc4fadec281c489af Signed-off-by: Suren Baghdasaryan --- tests/lmkd_tests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lmkd_tests.cpp b/tests/lmkd_tests.cpp index 2537a9d..9ad3d3b 100644 --- a/tests/lmkd_tests.cpp +++ b/tests/lmkd_tests.cpp @@ -211,10 +211,10 @@ TEST_F(LmkdTest, TargetReaping) { ASSERT_TRUE(ParseProcSize(line, rss, swap)) << "Kill report format is invalid"; // find reap duration report - line_start = logcat_out.find(LMKD_REAP_LINE_START, line_end); + line_start = logcat_out.find(LMKD_REAP_LINE_START); if (line_start == std::string::npos) { // Target might have exited before reaping started - line_start = logcat_out.find(LMKD_REAP_MRELESE_ERR_MARKER, line_end); + line_start = logcat_out.find(LMKD_REAP_MRELESE_ERR_MARKER); ASSERT_TRUE(line_start != std::string::npos) << "Reaping time report is not found";