gh-116622: Android logging fixes#122698
Merged
gh-116622: Android logging fixes #122698
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes several issues with Android's redirection of stdout and stderr to the Logcat, which was added in #118063:
The buffering behavior of TextIOWrapper was changed in #119507, which broke the technique we were previously using to stay within Logcat's line length limit. Since this behavior is not part of TextIOWrapper's public API, it's safer to bypass it completely and do the buffering ourselves.
When running in
--verbose3mode, I noticed that failure logs of large test modules liketest_pathlibwere truncated because they were being written faster than the test script could consume them. Fixed by adding a rate limit using the token bucket algorithm.The Android stdout and stderr tests themselves failed in
--verbose3mode because stdout and stderr were captured by aStringIO. Fixed by detecting this mode and using some temporary streams with the same properties.