lmkd/tests: handle kill reports being confused with reap reports am: 13b5b0ce06 am: 72c26015dd
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/3134320 Change-Id: I5db5a175f9fdec7c5b1d48c21148c7f7bf3fc7ce Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f7b4db5219
|
|
@ -42,6 +42,7 @@ using namespace android::base;
|
||||||
#define LMKD_REAP_FAIL_TEMPLATE "process_mrelease %d failed"
|
#define LMKD_REAP_FAIL_TEMPLATE "process_mrelease %d failed"
|
||||||
|
|
||||||
#define LMKD_KILL_LINE_START LMKD_LOGCAT_MARKER ": Kill"
|
#define LMKD_KILL_LINE_START LMKD_LOGCAT_MARKER ": Kill"
|
||||||
|
#define LMKD_KILLED_LINE_START LMKD_LOGCAT_MARKER ": Process got killed"
|
||||||
#define LMKD_REAP_LINE_START LMKD_LOGCAT_MARKER ": Process"
|
#define LMKD_REAP_LINE_START LMKD_LOGCAT_MARKER ": Process"
|
||||||
#define LMKD_REAP_TIME_TEMPLATE LMKD_LOGCAT_MARKER ": Process %d was reaped in %ldms"
|
#define LMKD_REAP_TIME_TEMPLATE LMKD_LOGCAT_MARKER ": Process %d was reaped in %ldms"
|
||||||
#define LMKD_REAP_MRELESE_ERR_MARKER ": process_mrelease"
|
#define LMKD_REAP_MRELESE_ERR_MARKER ": process_mrelease"
|
||||||
|
|
@ -223,8 +224,10 @@ TEST_F(LmkdTest, TargetReaping) {
|
||||||
long rss, swap;
|
long rss, swap;
|
||||||
ASSERT_TRUE(ParseProcSize(line, rss, swap)) << "Kill report format is invalid";
|
ASSERT_TRUE(ParseProcSize(line, rss, swap)) << "Kill report format is invalid";
|
||||||
|
|
||||||
|
line_start = 0;
|
||||||
|
retry:
|
||||||
// find reap duration report
|
// find reap duration report
|
||||||
line_start = logcat_out.find(LMKD_REAP_LINE_START);
|
line_start = logcat_out.find(LMKD_REAP_LINE_START, line_start);
|
||||||
if (line_start == std::string::npos) {
|
if (line_start == std::string::npos) {
|
||||||
// Target might have exited before reaping started
|
// Target might have exited before reaping started
|
||||||
line_start = logcat_out.find(LMKD_REAP_MRELESE_ERR_MARKER);
|
line_start = logcat_out.find(LMKD_REAP_MRELESE_ERR_MARKER);
|
||||||
|
|
@ -240,6 +243,11 @@ TEST_F(LmkdTest, TargetReaping) {
|
||||||
line_end = logcat_out.find('\n', line_start);
|
line_end = logcat_out.find('\n', line_start);
|
||||||
line = logcat_out.substr(
|
line = logcat_out.substr(
|
||||||
line_start, line_end == std::string::npos ? std::string::npos : line_end - line_start);
|
line_start, line_end == std::string::npos ? std::string::npos : line_end - line_start);
|
||||||
|
if (line.find(LMKD_KILLED_LINE_START) != std::string::npos) {
|
||||||
|
// we found process kill report, keep looking for reaping report
|
||||||
|
line_start = line_end;
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
long reap_time;
|
long reap_time;
|
||||||
ASSERT_TRUE(ParseReapTime(line, pid, reap_time) && reap_time >= 0)
|
ASSERT_TRUE(ParseReapTime(line, pid, reap_time) && reap_time >= 0)
|
||||||
<< "Reaping time report format is invalid";
|
<< "Reaping time report format is invalid";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue