Skip to content

Commit

Permalink
pw_software_update: Fix build errors/warnings
Browse files Browse the repository at this point in the history
Fixes a number of compiler warnings and static analysis errors for
pw_software_update.

Change-Id: I31d145348f577dc1c55018d1378e7af02f136df0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/133570
Commit-Queue: Yecheng Zhao <[email protected]>
Reviewed-by: Ali Zhang <[email protected]>
  • Loading branch information
Yecheng Zhao authored and CQ Bot Account committed Mar 10, 2023
1 parent 87d408e commit c59e42b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pw_software_update/update_bundle_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TestBundledUpdateBackend final : public BundledUpdateBackend {

void SetManifestWriter(stream::Writer* writer) { manifest_writer_ = writer; }

virtual Result<stream::SeekableReader*> GetRootMetadataReader() override {
Result<stream::SeekableReader*> GetRootMetadataReader() override {
return &trusted_root_reader_;
}

Expand Down Expand Up @@ -105,7 +105,7 @@ class TestBundledUpdateBackend final : public BundledUpdateBackend {
return manifest_writer_;
}

virtual Status SafelyPersistRootMetadata(
Status SafelyPersistRootMetadata(
[[maybe_unused]] stream::IntervalReader root_metadata) override {
new_root_persisted_ = true;
trusted_root_reader_ = root_metadata;
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST_F(UpdateBundleTest, PersistManifestFailIfNotVerified) {
TEST_F(UpdateBundleTest, SelfVerificationWithIncomingRoot) {
StageTestBundle(kTestDevBundleWithRoot);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_OK(update_bundle.OpenAndVerify());
// Self verification must not persist anything.
Expand All @@ -293,39 +293,39 @@ TEST_F(UpdateBundleTest, SelfVerificationWithIncomingRoot) {
TEST_F(UpdateBundleTest, SelfVerificationWithoutIncomingRoot) {
StageTestBundle(kTestDevBundle);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_OK(update_bundle.OpenAndVerify());
}

TEST_F(UpdateBundleTest, SelfVerificationWithMessedUpRoot) {
StageTestBundle(kTestDevBundleWithProdRoot);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_FAIL(update_bundle.OpenAndVerify());
}

TEST_F(UpdateBundleTest, SelfVerificationChecksMissingHashes) {
StageTestBundle(kTestBundleMissingTargetHashFile0);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_FAIL(update_bundle.OpenAndVerify());
}

TEST_F(UpdateBundleTest, SelfVerificationChecksBadHashes) {
StageTestBundle(kTestBundleMismatchedTargetHashFile0);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_FAIL(update_bundle.OpenAndVerify());
}

TEST_F(UpdateBundleTest, SelfVerificationIgnoresUnsignedBundle) {
StageTestBundle(kTestUnsignedBundleWithRoot);
UpdateBundleAccessor update_bundle(
blob_reader(), backend(), /* disable_verification = */ true);
blob_reader(), backend(), /* self_verification = */ true);

ASSERT_OK(update_bundle.OpenAndVerify());
}
Expand Down

0 comments on commit c59e42b

Please sign in to comment.