diff options
author | Tao Bao <tbao@google.com> | 2018-04-19 12:35:14 -0700 |
---|---|---|
committer | Tao Bao <tbao@google.com> | 2018-04-19 12:46:22 -0700 |
commit | 4f834304715229dc6a94060e6b2a146a329b1f1c (patch) | |
tree | c1ed50959c0f36e8c8218620becb106bfef2fd3c /applypatch | |
parent | 73e6644777a7ebf5211191d7f97e22ba1299da0f (diff) | |
download | android_bootable_recovery-4f834304715229dc6a94060e6b2a146a329b1f1c.tar.gz android_bootable_recovery-4f834304715229dc6a94060e6b2a146a329b1f1c.tar.bz2 android_bootable_recovery-4f834304715229dc6a94060e6b2a146a329b1f1c.zip |
applypatch: Dump patch info on mismatching patching result.
After splitting the previously flaky
ApplyPatchModesTest#PatchModeEmmcTarget tests,
PatchModeEmmcTargetWithMultiplePatches now becomes the sole victim. This
CL dumps additional info to narrow down the cause.
Bug: 67849209
Test: `recovery_component_test` on marlin.
Test: It dumps additional info after using corrupt bonus.file.
Change-Id: Ic5436de457cc882a51d03f49d5cee70077f7d3df
Diffstat (limited to 'applypatch')
-rw-r--r-- | applypatch/applypatch.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp index 6f6c187b..120add6d 100644 --- a/applypatch/applypatch.cpp +++ b/applypatch/applypatch.cpp @@ -652,7 +652,22 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr uint8_t current_target_sha1[SHA_DIGEST_LENGTH]; SHA1_Final(current_target_sha1, &ctx); if (memcmp(current_target_sha1, target_sha1, SHA_DIGEST_LENGTH) != 0) { - printf("patch did not produce expected sha1\n"); + printf("patch did not produce expected sha1 of %s\n", short_sha1(target_sha1).c_str()); + + printf("target size %zu sha1 %s\n", memory_sink_str.size(), + short_sha1(current_target_sha1).c_str()); + printf("source size %zu sha1 %s\n", source_file.data.size(), + short_sha1(source_file.sha1).c_str()); + + uint8_t patch_digest[SHA_DIGEST_LENGTH]; + SHA1(reinterpret_cast<const uint8_t*>(patch->data.data()), patch->data.size(), patch_digest); + printf("patch size %zu sha1 %s\n", patch->data.size(), short_sha1(patch_digest).c_str()); + + uint8_t bonus_digest[SHA_DIGEST_LENGTH]; + SHA1(reinterpret_cast<const uint8_t*>(bonus_data->data.data()), bonus_data->data.size(), + bonus_digest); + printf("bonus size %zu sha1 %s\n", bonus_data->data.size(), short_sha1(bonus_digest).c_str()); + return 1; } else { printf("now %s\n", short_sha1(target_sha1).c_str()); |