summaryrefslogtreecommitdiff
path: root/payload_consumer/file_descriptor_utils_unittest.cc
AgeCommit message (Collapse)Author
2020-10-29update_engine: Fix leaking unit testsAmin Hassani
Some of the unit tests have been leaking temp files because they don't properly unlink them. In this CL, we did some rearrangement of the ScopedTempFile class and moved it into the utils.h (instead of testing only location) so it can be used everywhere and more efficiently. Also added functionality to open an file descriptor too so users don't have to keep a different object for the file descriptor. BUG=b:162766400 TEST=cros_workon_make --board reef --test; Then looked at the /build/reef/tmp directory and no files were leaked. Change-Id: Id64a2923d30f27628120497fdefe16bf65fa3fb0 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2500772 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2018-05-30Recover source hash failures on other source operations.Sen Jiang
In addition to SOURCE_COPY, now SOURCE_BSDIFF, BROTLI_BSDIFF and PUFFDIFF will also recover source hash failures using error correction data. Bug: 34284069 Test: update_engine_unittests Change-Id: I536d0675e3550aa142b77b4c8bf0a9f70a789652
2018-02-05Restructure hash calculation in delta_performerAmin Hassani
This patch moves DeltaPerformer::CalculateAndValidateHash to fd_utils::ReadAndHashExtents and cleans up the code. It also adds unittests for ReadAndHashExtents. Bug: None Test: unittest pass Change-Id: I297cf79ef38a7495d5bcc0e6516a1ca783e505ea Signed-off-by: Amin Hassani <ahassani@google.com>
2017-09-25update_engine: Use ExtentReaderAmin Hassani
Updates CopyAndHashExtents to use the new ExtentReader. Adds CalculateAndValidatffeSourceHash() to DeltaPerformer to be used in both SOURCE_BSDIFF and PUFFDIFF. BUG=chromium:761138 TEST=FEATURES="test" emerge-amd64-generic update_engine; brillo_update_payload verify Change-Id: I2e0c10fe0078c5a1ab4cd646a91d42893b6b691b Reviewed-on: https://chromium-review.googlesource.com/653478 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2017-08-31update_engine: Fixes issues introduced in a previous AOSP CL.Amin Hassani
Adds fcntl.h for using O_RDWR in file_descriptor_utils_unittest.cc. Reorders includes in file_descriptor_utils_unittest.cc to the proper code style. Fixed some nits. BUG=b:34284069 TEST=FEATURES="test" emerge-amd64-generic update_engine Change-Id: Ib79b6cfd5ef0c0393373a017b6fb05b3c1b958ef Reviewed-on: https://chromium-review.googlesource.com/641959 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
2017-08-31Move extent copy and hash logic to a new file.Alex Deymo
The SOURCE_COPY operation used to copy the source blocks one by one to the target partition. This process is sub-optimal if there are several consecutive blocks. This patch moves this copy and hash logic to a new file and adds several unittests for it. The new logic copies in chunks of up to 1MiB when the source and target data is contiguous. BUG=b:34284069 TEST=Added unittests. Change-Id: I9ed52b429a54a2b4d6edaba051284b7dcd8a9525 (cherry picked from commit a48f630400429ca010c5462967607985f2ffa7e4) Reviewed-on: https://chromium-review.googlesource.com/641958 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>