Repository navigation
fix: compare u2.jar size instead of md5 when setting up the jar - #1205
Merged
Merged
Conversation
Checking the remote jar with `adb shell toybox md5sum` fails with AdbError: closed on some machines/devices, which aborts connect() before the jar is pushed. Use the sync channel (sync.stat) and compare file sizes instead, so no device-side shell is involved.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1205 +/- ##
==========================================
- Coverage 45.31% 45.26% -0.06%
==========================================
Files 29 29
Lines 4162 4158 -4
Branches 813 812 -1
==========================================
- Hits 1886 1882 -4
Misses 2164 2164
Partials 112 112 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 is by an automated agent, not a human.
变更
Replaced the md5-based u2.jar check in BasicUiautomatorServer with a file-size comparison over the adb sync channel.
_setup_jarnow calls_check_device_file_size, which gets the local size withos.path.getsizeand the remote size withDevice.sync.stat, returning False when the remote file is missing (mtime is None) or sizes differ. Since noadb shell toybox md5sumis executed anymore, theAdbError: closedthat abortedconnect()on affected machines can no longer break the jar setup step.改动
_check_device_file_hashto_check_device_file_sizeand implemented it withos.path.getsize+Device.sync.stat; removed the now-unusedhashlibimport and updated the_setup_jarcall site.Closes #1153
提交
检查
✅ 检查通过(2 项)
功能验证
AdbDevice.shellpatched to raiseadbutils.AdbError("closed")for any md5/md5sum command: firstu2.connect()succeeded and pushed the 3.7 MB u2.jar, second connect reused it (mtime unchanged), truncating the remote jar re-pushed it, and_check_device_file_sizereturned True/False for existing/missing files with zero md5 shell callsadb emu killafterwardsUI 验证
未涉及 UI 改动,无截图。