summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-04-27 19:04:03 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-04-27 19:04:03 +0200
commit1409bf79e377eb36b56c865a2996d034345dd87a (patch)
tree7c941af056eeb6ae1d44cefa0e49d0f41c152501
parentMerge "updater_sample: fix gen_update_config.py" am: 2573b6fa1c am: 811baa37d3 (diff)
parentMerge "Save the target file when applypatch tests fail" am: 957c1abfba (diff)
downloadandroid_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar.gz
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar.bz2
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar.lz
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar.xz
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.tar.zst
android_bootable_recovery-1409bf79e377eb36b56c865a2996d034345dd87a.zip
-rw-r--r--applypatch/applypatch.cpp8
-rw-r--r--applypatch/imgpatch.cpp24
2 files changed, 18 insertions, 14 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 39b8030d9..14137de96 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -672,6 +672,14 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
bonus_digest);
printf("bonus size %zu sha1 %s\n", bonus_data->data.size(), short_sha1(bonus_digest).c_str());
+ // TODO(b/67849209) Remove after debugging the unit test flakiness.
+ if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG) {
+ if (WriteToPartition(reinterpret_cast<const unsigned char*>(memory_sink_str.c_str()),
+ memory_sink_str.size(), target_filename) != 0) {
+ LOG(DEBUG) << "Failed to write patched data " << target_filename;
+ }
+ }
+
return 1;
} else {
printf("now %s\n", short_sha1(target_sha1).c_str());
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index b06a64f21..c4c2707fb 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -60,6 +60,11 @@ static bool ApplyBSDiffPatchAndStreamOutput(const uint8_t* src_data, size_t src_
int mem_level = Read4(deflate_header + 52);
int strategy = Read4(deflate_header + 56);
+ // TODO(b/67849209) Remove after debugging the unit test flakiness.
+ if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG) {
+ LOG(DEBUG) << "zlib version " << zlibVersion();
+ }
+
z_stream strm;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
@@ -101,26 +106,17 @@ static bool ApplyBSDiffPatchAndStreamOutput(const uint8_t* src_data, size_t src_
size_t have = buffer_size - strm.avail_out;
total_written += have;
-
- // TODO(b/67849209) Remove after debugging the unit test flakiness.
- if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG &&
- have != 0) {
- SHA1_Update(&sha_ctx, data, len - strm.avail_in);
- SHA_CTX temp_ctx;
- memcpy(&temp_ctx, &sha_ctx, sizeof(SHA_CTX));
- uint8_t digest_so_far[SHA_DIGEST_LENGTH];
- SHA1_Final(digest_so_far, &temp_ctx);
- LOG(DEBUG) << "Processed " << actual_target_length + len - strm.avail_in
- << " bytes input data in the sink function, sha1 so far: "
- << short_sha1(digest_so_far);
- }
-
if (sink(buffer.data(), have) != have) {
LOG(ERROR) << "Failed to write " << have << " compressed bytes to output.";
return 0;
}
} while ((strm.avail_in != 0 || strm.avail_out == 0) && ret != Z_STREAM_END);
+ // TODO(b/67849209) Remove after debugging the unit test flakiness.
+ if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG) {
+ SHA1_Update(&sha_ctx, data, len);
+ }
+
actual_target_length += len;
return len;
};