Remove the debug code for bspatch flakiness
We already know the flakiness happens in bspatch, and the issue is
tracked in b/80193170.
Bug: 67849209
Test: unit tests pass
Change-Id: Ib4772b8f2f0225125096fe7407d083b5bb542cfb
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index b1f5607..eb0a2a7 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -587,11 +587,6 @@
SHA_CTX ctx;
SHA1_Init(&ctx);
SinkFn sink = [&memory_sink_str, &ctx](const unsigned char* data, size_t len) {
- if (len != 0) {
- uint8_t digest[SHA_DIGEST_LENGTH];
- SHA1(data, len, digest);
- LOG(DEBUG) << "Appending " << len << " bytes data, SHA-1: " << short_sha1(digest);
- }
SHA1_Update(&ctx, data, len);
memory_sink_str.append(reinterpret_cast<const char*>(data), len);
return len;
@@ -632,14 +627,6 @@
<< short_sha1(bonus_digest);
}
- // 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 {
LOG(INFO) << " now " << short_sha1(target_sha1);
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index da75692..e6be39a 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -61,11 +61,6 @@
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;
@@ -83,10 +78,8 @@
size_t actual_target_length = 0;
size_t total_written = 0;
static constexpr size_t buffer_size = 32768;
- SHA_CTX sha_ctx;
- SHA1_Init(&sha_ctx);
auto compression_sink = [&strm, &actual_target_length, &expected_target_length, &total_written,
- &ret, &sink, &sha_ctx](const uint8_t* data, size_t len) -> size_t {
+ &ret, &sink](const uint8_t* data, size_t len) -> size_t {
// The input patch length for an update never exceeds INT_MAX.
strm.avail_in = len;
strm.next_in = data;
@@ -113,11 +106,6 @@
}
} 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;
};
@@ -125,11 +113,6 @@
int bspatch_result = ApplyBSDiffPatch(src_data, src_len, patch, patch_offset, compression_sink);
deflateEnd(&strm);
- if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG) {
- uint8_t digest[SHA_DIGEST_LENGTH];
- SHA1_Final(digest, &sha_ctx);
- LOG(DEBUG) << "sha1 of " << actual_target_length << " bytes input data: " << short_sha1(digest);
- }
if (bspatch_result != 0) {
return false;
}
@@ -144,7 +127,7 @@
<< actual_target_length;
return false;
}
- LOG(DEBUG) << "bspatch writes " << total_written << " bytes in total to streaming output.";
+ LOG(DEBUG) << "bspatch wrote " << total_written << " bytes in total to streaming output.";
return true;
}