summaryrefslogtreecommitdiff
path: root/payload_consumer/file_writer_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>
2019-01-15update_engine: Run clang-format on payload_consumerAmin Hassani
We just did a AOSP merge, so it is a good time to clean things up. BUG=none TEST=unittest Change-Id: I4fe9cef5eb8709344d6b78bc298c0f1c03308ffc Reviewed-on: https://chromium-review.googlesource.com/1407540 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org> Reviewed-by: Xiaochu Liu <xiaochu@chromium.org>
2018-07-03Use ScopedTempFile in unit test.Sen Jiang
Replace these 3 lines of code: string path; ASSERT_TRUE(utils::MakeTempFile("name-XXXXXX", &path, nullptr)); ScopedPathUnlinker path_unlinker(path); with one liner: test_utils::ScopedTempFile file("name-XXXXXX"); Bug: None Test: unit test Change-Id: Ic5be7dc8339842270023055bcc3a97e526953f04
2017-09-21update_engine: Replace vector<Extent> with RepeatedPtrField<Extent>Amin Hassani
This patch removes references to vector<Extent> and replaces them with RepeatedPtrField in payload_consumer. Extent itself is a protobuf item and it makes sense to use google::protobuf::RepeatedPtrField instead of vector because then we won't have any extra copy to vector. We can directly use the list of extents given in the payload protobuf. Also removed references to vector in files which did not use vector. BUG=chromium:766397 TEST=FEATURES="test" emerge-amd64-generic update_engine Change-Id: I1f12332ff4d6303c1e4b7470bb87bf934acdf81a Reviewed-on: https://chromium-review.googlesource.com/672006 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
2015-11-12Split payload application code into a subdirectory.Alex Deymo
This patch splits from the main libupdate_engine code the part that is strictly used to download and apply a payload into a new static library, moving the code to subdirectories. The new library is divided in two subdirectories: common/ and payload_consumer/, and should not depend on other update_engine files outside those two subdirectories. The main difference between those two is that the common/ tools are more generic and not tied to the payload consumer process, but otherwise they are both compiled together. There are still dependencies from the new libpayload_consumer library into the main directory files and DBus generated files. Those will be addressed in follow up CLs. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; `mm` on Brillo. Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23