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 <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan 2023-10-05 20:29:58 +00:00
parent 90c4e26b9f
commit ec169b178a
1 changed files with 2 additions and 2 deletions

View File

@ -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";