aboutsummaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-04-26 17:23:23 -0700
committerTianjie Xu <xunchang@google.com>2018-04-26 19:46:39 -0700
commit3f638ee8340dec0e95ecdaca7b3f6b3440f85e50 (patch)
treedb27f36a23d1bf981f7e87bafaaf5547f567be7c /applypatch/applypatch.cpp
parent220b531e3d6caf328eb628ded75987f8055dd942 (diff)
downloadandroid_bootable_recovery-3f638ee8340dec0e95ecdaca7b3f6b3440f85e50.tar.gz
android_bootable_recovery-3f638ee8340dec0e95ecdaca7b3f6b3440f85e50.tar.bz2
android_bootable_recovery-3f638ee8340dec0e95ecdaca7b3f6b3440f85e50.zip
Save the target file when applypatch tests fail
Save the target file to tempfile upon unittest failures so that we can try to decompress the deflate chunks in the flaky unittests. And print the zlib version in case that gets changed. Also the SHA1 of the uncompressed data seems correct; so only keep the final SHA1 to double confirm. Bug: 67849209 Test: recovery_component_test Change-Id: Ic6447c2b75c29379d6844cd23a0ff1c4305694a0
Diffstat (limited to 'applypatch/applypatch.cpp')
-rw-r--r--applypatch/applypatch.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 39b8030d..14137de9 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());