AU: Split applied update verification into a separate step.
Use instances of FilesystemCopierAction to do applied update verification. This
speeds it up slightly because asynchronous reads happen in parallel with hash
calculation but, more importantly, makes update_engine be responsive to D-Bus
during that step.
BUG=9140
TEST=unit tests, tested on device
Change-Id: I3ec9445de5e8258a63433a61f1a476aef4434f6c
Review URL: http://codereview.chromium.org/5516009
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 42f237b..238731a 100755
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -315,11 +315,11 @@
OmahaHashCalculator::RawHashOfFile(a_img,
image_size,
&rootfs_hash));
- performer.set_current_rootfs_hash(&rootfs_hash);
+ performer.set_current_rootfs_hash(rootfs_hash);
vector<char> kernel_hash;
EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(old_kernel_data,
&kernel_hash));
- performer.set_current_kernel_hash(&kernel_hash);
+ performer.set_current_kernel_hash(kernel_hash);
EXPECT_EQ(0, performer.Open(a_img.c_str(), 0, 0));
EXPECT_TRUE(performer.OpenKernel(old_kernel.c_str()));
@@ -347,7 +347,27 @@
kUnittestPublicKeyPath,
OmahaHashCalculator::OmahaHashOfData(delta),
delta.size()));
- EXPECT_TRUE(performer.VerifyAppliedUpdate(a_img, old_kernel));
+
+ uint64_t new_kernel_size;
+ vector<char> new_kernel_hash;
+ uint64_t new_rootfs_size;
+ vector<char> new_rootfs_hash;
+ EXPECT_TRUE(performer.GetNewPartitionInfo(&new_kernel_size,
+ &new_kernel_hash,
+ &new_rootfs_size,
+ &new_rootfs_hash));
+ EXPECT_EQ(4096, new_kernel_size);
+ vector<char> expected_new_kernel_hash;
+ EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(new_kernel_data,
+ &expected_new_kernel_hash));
+ EXPECT_TRUE(expected_new_kernel_hash == new_kernel_hash);
+ EXPECT_EQ(image_size, new_rootfs_size);
+ vector<char> expected_new_rootfs_hash;
+ EXPECT_EQ(image_size,
+ OmahaHashCalculator::RawHashOfFile(b_img,
+ image_size,
+ &expected_new_rootfs_hash));
+ EXPECT_TRUE(expected_new_rootfs_hash == new_rootfs_hash);
}
}