summaryrefslogtreecommitdiff
path: root/payload_generator/ext2_filesystem_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-16update_engine: Run clang-format on payload_generator/Amin Hassani
BUG=none TEST=unittest Change-Id: I00cafb1fc709d8f02119cb0058cfcb0b573ef25d Reviewed-on: https://chromium-review.googlesource.com/1409927 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2017-12-12update_engine: Remove the duplicate BlocksInExtentsAmin Hassani
This patch removes the duplicate BlocksInExtents from extent_utils.h and fixes the remainder of the code to reflect this change. BUG=none TEST=unittests pass; Change-Id: I76f5106f75072b20cd8f41f081b2f2b07aeac9a8 Reviewed-on: https://chromium-review.googlesource.com/812009 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Alex Deymo <deymo@google.com> Reviewed-by: Sen Jiang <senj@chromium.org>
2016-03-23Fix unittest key path in Brillo.Sen Jiang
The unittests weren't able to find the keys if it's not run from the update_engine_unittests directory. Test: /data/nativetest/update_engine_unittests/update_engine_unittests Bug: 26955860 Change-Id: I4c189cca2714986d3d2b2669b54a5dff9a488964
2016-03-17Use pre-generated ext image instead of create it on the fly.Sen Jiang
mkfs.ext3 is not available in target device, so we don't use it. Also removed all usage of dd. This fixes a UtilsTest and the first step of integration test, the rest is still failing because bsdiff is missing. Test: ./update_engine_unittests Test: cros_workon_make update_engine --test Bug: 26955860 Change-Id: Ic600bd6fab1d6839f38d5ef767fbffc5a35571a4
2016-03-12Implement susped, resume and cancel for the Postinstall action.Alex Deymo
This patch sends SIGSTOP/SIGCONT to the running postinstall program to suspend/resume the child process, and SIGKILL when cancelling it. Bug: 27272144 TEST=Added unittest to check the signal being sent. Change-Id: Iebe9bd34448ad1d0a5340c82e1fd839ff8c69dd2
2016-02-19Fix Ext2FilesystemTest unittests on Brillo.Alex Deymo
The Ext2FilesystemTest tests use a set of pre-generated filesystems stored in sample_images.tar.bz2 and attempt to parse those. This patch installs the used filesystems in the same directory as the Chrome OS test environment would generate those files, relative to the unittest program executed: in a gen/ subdirectory. Also, an empty filesystem that was previously created from the unittests is now pre-generated. The update_engine_unittests program now depends on those modules being installed and those unittests pass. Bug: 26955860 TEST=/data/nativetest/update_engine_unittests/update_engine_unittests --gtest_filter=Ext2FilesystemTest.* Change-Id: I40082e328cec89a7ef4f06d3b8125a953b29efad
2016-02-17Build unittests in Brillo.Alex Deymo
Many unittests do not pass for simple reasons that will be addressed later. This CL includes all the changes to make the unittests build. In particular, the generated DBus mocks, required to build several unittests are now included here. The dbus-constants.h files were moved to the system_api repo, so they can be removed from here. The unittest build is only enabled for Brillo targets, since non-Brillo targets don't even build DBus. Bug: 26955860 TEST=`mmma` on edison-eng (and aosp_arm-eng). Change-Id: Ib38241f0a6eb99b1d60d72db6bcfd125d38e3fad
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
2015-10-13update_engine: Rename "chromeos" -> "brillo" in include paths and namespacesAlex Vakulenko
libchromeos is transitioning to libbrillo and chromeos namespaces and include directory is changing to brillo. Bug: 24872993 Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
2015-08-19Re-license update_engine to Apache2Alex Deymo
This patch automatically replaced the license on all text files from Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as a reference. The license header was added to .gyp and .gypi files, the NOTICE was replaced with a copy of the Apache2 license and MODULE_LICENSE_* file was updated. BUG=b/23084294 TEST=grep 'Chromium OS Authors' doesn't find anything. Change-Id: Ie5083750755f5180a8a785b24fe67dbf9195cd10
2015-07-02update_engine: Expose the update_engine.conf in the FilesystemInterface.Alex Deymo
The old image contains a /etc/update_engine.conf file that states the payload version supported by that image. Currently we read this file directly from the mounted filesystem and parse its contents. To stop mounting the filesystem we need to retrieve the information on this file somehow. This patch extends the FilesystemInterface with a method to load the update_engine.conf settings from the filesystem and implemets it using ext2fs on ext2 filesystems. CQ-DEPED=CL:282380 BUG=chromium:305832 TEST=Added new unittests with and without this file. Change-Id: I41b41e8aac58c645fb40aabfe340cde8821e405a Reviewed-on: https://chromium-review.googlesource.com/282381 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2015-06-12update_engine: Introduce FilesystemInterface abstraction.Alex Deymo
The interaction with the filesystem in the payload generation process is hard-coded in several places, making it hard to mock out or use a different filesystem like squashfs for delta generation. For example, the metadata, regular file data and non-file data are handled by three different functions in a similar way, but with different code. This patch introcudes a filesystem abstraction to map files or pseudo-files (like the metadata, free-space, etc) into the same interface. The interface includes three implementations: for parsing ext2 filesystems using ext2fs (already used by the metadata parsing but not by the file data processing), a raw one for monolitic partitions like the kernel and a fake one used for testing without requiring to build/parse a real ext2 filesystem. BUG=chromium:331965 TEST=FEATURES=test emerge-link update_engine Change-Id: I1e14cf8f3883c8e9a1d471c8193c8da60776aa7c Reviewed-on: https://chromium-review.googlesource.com/275803 Reviewed-by: Don Garrett <dgarrett@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>