Skip to content

Conversation

@xr-gh
Copy link

@xr-gh xr-gh commented Jan 13, 2026

Prior to this change the logcat collection would be missing logcat messages that got created while the logcat collection was suspended if the logcat collection got subsequently resumed.

This change stores the local time when the adb connection got suspended, so that we can use it to specify from which point in time we want to collect logcat messages again. This ensures that the final log file contains the log messages while the logcat collection was suspended once the logcat collection got resumed.

Fixes #1000

@xpconanfan xpconanfan self-requested a review January 14, 2026 20:32
@xpconanfan xpconanfan added the bug label Jan 14, 2026
@xpconanfan xpconanfan added this to the Mobly Release 1.13.1 milestone Jan 14, 2026
@xr-gh xr-gh force-pushed the adb_resume_logging branch from c5e6855 to 894493f Compare January 15, 2026 00:14
FastbootProxy,
MockAdbProxy,
):
DATE_COMMAND = ['date', '-Is', r'+%Y-%m-%d\ %H:%M:%S.%N']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't expect to see so much change in the existing test.
is it possible to simplify the logic here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments around the code, but I feel this is as simple as it gets, not sure how to simplify this any further.

clear_adb_mock.assert_called_once_with()
self.assertTrue(logcat_service.is_alive)

def pause_resume(date):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's difficult to understand the purpose of this from the name.
what are we doing here? could we make the test more readable and easier to understand? E.g. simplify the structure, change the name, add inline comments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have renamed the function to pause_logcat_service_resume_logcat_service and added comments into the code to explain what we are doing here. I hope that helps.

@xr-gh xr-gh force-pushed the adb_resume_logging branch from 894493f to 7846301 Compare January 26, 2026 19:46
Prior to this change the logcat collection would be missing logcat
messages that got created while the logcat collection was suspended if
the logcat collection got subsequently resumed.

This change stores the local time when the adb connection got suspended,
so that we can use it to specify from which point in time we want to
collect logcat messages again. This ensures that the final log file contains
the log messages while the logcat collection was suspended once the
logcat collection got resumed.
@xr-gh xr-gh force-pushed the adb_resume_logging branch from 7846301 to b6d3318 Compare January 26, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adb logcat collection skips over log messages while suspended

2 participants