Skip to content

Add utils.IncrementalFileCopier and decouple Logcat excerpt copying - #1079

Open
xpconanfan wants to merge 1 commit into
masterfrom
fix-logcat-excerpt-across-reboot
Open

xpconanfan wants to merge 1 commit into
masterfrom
fix-logcat-excerpt-across-reboot

Conversation

@xpconanfan

@xpconanfan xpconanfan commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add mobly.utils.IncrementalFileCopier (copier.copy_new(dest_path)) for incrementally copying newly appended data from a growing text or binary file into separate files (ignore_existing_content=False by default, optional raw binary mode via encoding=None, offset, advance_to_end(), and reset()), holding no open file descriptor between calls.
  • Cross-reference utils.IncrementalFileCopier in BaseService.create_output_excerpts for custom service authors.
  • Replace _adb_logcat_file_obj / _open_logcat_file / _close_logcat_file in Logcat with utils.IncrementalFileCopier (and _wait_for_logcat_file) so start() and stop() manage only the adb logcat subprocess and preserve per-test logcat excerpts and early startup/boot-dump lines across mid-test AndroidDevice.reboot().

@xpconanfan
xpconanfan force-pushed the fix-logcat-excerpt-across-reboot branch from 56ee706 to 283a4bf Compare November 11, 2026 22:06
@xpconanfan xpconanfan changed the title Preserve per-test logcat excerpts across stop/start and reboots Decouple Logcat excerpt clipping via utils.FileClipper Nov 11, 2026
@xpconanfan xpconanfan changed the title Decouple Logcat excerpt clipping via utils.FileClipper Add utils.FileClipper and decouple Logcat excerpt clipping Nov 11, 2026
@xpconanfan
xpconanfan force-pushed the fix-logcat-excerpt-across-reboot branch from 283a4bf to 7bc5091 Compare November 11, 2026 23:19
Add `mobly.utils.IncrementalFileCopier`, a general-purpose utility for incrementally copying newly appended data from a growing text or binary file into separate files without holding an open file descriptor between `copy_new` calls.

Use `utils.IncrementalFileCopier` in `Logcat` (removing `_adb_logcat_file_obj` and `_close_logcat_file`, and renaming `_open_logcat_file` to `_wait_for_logcat_file`) so `Logcat.start()` and `Logcat.stop()` manage only the `adb logcat` subprocess and preserve per-test logcat excerpts across mid-test `AndroidDevice.reboot()`.
@xpconanfan xpconanfan changed the title Add utils.FileClipper and decouple Logcat excerpt clipping Add utils.IncrementalFileCopier and decouple Logcat excerpt copying Nov 11, 2026
@xpconanfan
xpconanfan force-pushed the fix-logcat-excerpt-across-reboot branch from 7bc5091 to cba9bfb Compare November 11, 2026 23:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant