Move unittest constants to header
Allows unittests to easly access these constants w/o having to declare
extern const char* bla;
Test: th
Change-Id: I0bf6637430104c3d621277a725721ca61c6ac544
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 274465c..a383bf6 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -247,8 +247,8 @@
IsDynamicPartition(install_part.name, install_plan_->target_slot));
// Open source fds if we have a delta payload, or for partitions in the
// partial update.
- bool source_may_exist = manifest_.partial_update() ||
- payload_->type == InstallPayloadType::kDelta;
+ const bool source_may_exist = manifest_.partial_update() ||
+ payload_->type == InstallPayloadType::kDelta;
const size_t partition_operation_num = GetPartitionOperationNum();
TEST_AND_RETURN_FALSE(partition_writer_->Init(
@@ -1146,9 +1146,12 @@
// Verifies the payload hash.
TEST_AND_RETURN_VAL(ErrorCode::kDownloadPayloadVerificationError,
!payload_hash_calculator_.raw_hash().empty());
- TEST_AND_RETURN_VAL(
- ErrorCode::kPayloadHashMismatchError,
- payload_hash_calculator_.raw_hash() == update_check_response_hash);
+ if (payload_hash_calculator_.raw_hash() != update_check_response_hash) {
+ LOG(ERROR) << "Actual hash: "
+ << HexEncode(payload_hash_calculator_.raw_hash())
+ << ", expected hash: " << HexEncode(update_check_response_hash);
+ return ErrorCode::kPayloadHashMismatchError;
+ }
// NOLINTNEXTLINE(whitespace/braces)
auto [payload_verifier, perform_verification] = CreatePayloadVerifier();