summaryrefslogtreecommitdiffstats
path: root/tests/component/updater_test.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Use SuffixArrayIndexInterface opaque type instead of the underlying data pointer."Treehugger Robot2017-10-241-1/+1
|\
| * Use SuffixArrayIndexInterface opaque type instead of the underlying data pointer.Alex Deymo2017-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | bsdiff interface is changing such that it hides the suffix array pointer from the public interface. This allows to use a different suffix array data size depending on the input size, running much faster in the normal case. Bug: 34220646 Test: `make checkbuild`; Ran an incremental update generation on a non-A/B device. Change-Id: I78e766da56cf28bc7774b8c8e58527bc11d919fb
* | Finish the new data receiver when update failsTianjie Xu2017-10-201-87/+133
| | | | | | | | | | | | | | | | | | | | | | The thread to receive new data may still be alive after we exit PerformBlockImageUpdate() upon failures. This caused memory corruption when we run the unittest repeatedly. Set the receiver_available flag to false and make sure the receiver exits when the update fails. Bug: 65430057 Test: unittests passed with tsan Change-Id: Icb232d13fb96c78262249ffbd29cdbe5b77f1fce
* | Move rangeset.h and print_sha1.h into otautil.Tao Bao2017-10-111-1/+1
| | | | | | | | | | | | | | | | | | Also drop the "bootable/recovery" path in LOCAL_C_INCLUDES from applypatch modules. Test: lunch aosp_{angler,bullhead,fugu,dragon,sailfish}-userdebug; mmma bootable/recovery Change-Id: Idd602a796894f971ee4f8fa3eafe36c42d9de986
* | Revert "Revert "Move error_code.h into otautil.""Tao Bao2017-10-091-1/+1
|/ | | | | | | | | | | | | | | | This reverts commit 26436d6d6010d5323349af7e119ff8f34f85c40c to re-land "Move error_code.h into otautil.". This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". This CL needs to land with device-specific module changes (e.g. adding the dependency on libotautil). Test: lunch aosp_{angler,bullhead,dragon,fugu,sailfish}-userdebug; mmma bootable/recovery Change-Id: If193241801af2dae73eccd31ce57cd2b81c9fd96
* Revert "Move error_code.h into otautil."Tao Bao2017-10-051-1/+1
| | | | | | | | This reverts commit 623fe7e701d5d0fb17082d1ced14498af1b44e5b. Reason for revert: Need to address device-specific modules. Change-Id: Ib7a4191e7f193dfff49b02d3de76dda856800251
* Move error_code.h into otautil.Tao Bao2017-10-041-1/+1
| | | | | | | | | This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". Test: mmma bootable/recovery Change-Id: Ia4649789cef2aaeb2785483660e9ea5a8b389c62
* Close cmd_pipe properly after updater test finishesTianjie Xu2017-09-111-8/+14
| | | | | | | | | Otherwise the test may fail after a large number of iterations due to file open failure. Bug: 65430057 Test: run recovery_component_test on sailfish for 2000 iterations. Change-Id: I0d456284d6064467038911d63eade95740cbec2c
* Merge "Fix a case when brotli writer fails to write last few blocks of data"Tianjie Xu2017-07-211-4/+15
|\
| * Fix a case when brotli writer fails to write last few blocks of dataTianjie Xu2017-07-211-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | receive_new_data may exit too early if the zip processor has sent all the raw data. As a result, the last few 'new' commands will fail even though the brotli decoder has more output in its buffer. Restruct the code so that 'NewThreadInfo' owns the decoder state solely; and receive_brotli_new_data is responsible for the decompression. Also reduce the test data size to 100 blocks to avoid the test timeout. Bug: 63802629 Test: recovery_component_test. on bullhead, apply full updates with and w/o brotli compressed entries, apply an incremental update. Change-Id: I9442f2536b74e48dbf7eeb062a8539c82c6dab47
* | Fix the android-cloexec-* warnings in bootable/recoveryTianjie Xu2017-07-191-2/+2
|/ | | | | | | | Add the O_CLOEXEC or 'e' accordingly. Bug: 63510015 Test: recovery tests pass Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
* Add support to decompress brotli compressed new dataTianjie Xu2017-07-081-0/+67
| | | | | | | | | | | | | | | | | | | | | | Add a new writer that can decode the brotli-compressed system/vendor new data stored in the OTA zip. Brotli generally gives better compression rate at the cost of slightly increased time consumption. The patch.dat is already compressed by BZ; so there's no point to further compress it. For the given 1.9G bullhead system image: Size: 875M -> 787M; ~10% reduction of package size. Time: 147s -> 153s; ~4% increase of the block_image_update execution time. (I guess I/O takes much longer time than decompression.) Also it takes 4 minutes to compress the system image on my local machine, 3 more minutes than zip. Test: recovery tests pass && apply a full OTA with brotli compressed system/vendor.new.dat on bullhead Change-Id: I232335ebf662a9c55579ca073ad45265700a621e
* Remove the obsolete package_extract_dir() testTianjie Xu2017-06-231-96/+0
| | | | | | | | | package_extract_dir() was removed in go/aog/402383, and the corresponding UpdaterTest should be removed as well. Bug: 62918308 Test: mma && code search Change-Id: Ibe9c473a5d41d2fa4d26abca5684e71b104891b0
* Move sysMapFile and sysReleaseMap into MemMapping class.Tao Bao2017-05-021-2/+2
| | | | | | | Test: recovery_component_test Test: recovery_unit_test Test: Apply an OTA on angler. Change-Id: I7170f03e4ce1fe06184ca1d7bcce0a695f33ac4d
* Abort the update if there's not enough new dataTianjie Xu2017-04-081-0/+66
| | | | | | | | | | Right now the update stuck in a deadlock if there's less new data than expection. Add some checkers and abort the update if such case happens. Also add a corresponding test. Bug: 36787146 Test: update aborts correctly on bullhead && recovery_component_test passes Change-Id: I914e4a2a4cf157b99ef2fc65bd21c6981e38ca47
* updater: Fix the broken case for apply_patch_check().Tao Bao2017-03-231-0/+49
| | | | | | | | | | | It's valid to provide only 1 argument to apply_patch_check(). We shouldn't fail the argument parsing. Bug: 36541737 Test: recovery_component_test passes. Test: recovery_component_test captures the failure without the fix. Test: The previously failed update applies successfully. Change-Id: Iee4c54ed33b877fc4885945b085341ec5c64f663
* Remove malloc in edify functionsTianjie Xu2017-03-221-1/+2
| | | | | | | | And switch them to std::vector & std::unique_ptr Bug: 32117870 Test: recovery tests passed on sailfish Change-Id: I5a45951c4bdf895be311d6d760e52e7a1b0798c3
* Add a test to perform block_image_updateTianjie Xu2017-03-171-5/+115
| | | | | | | | | | | | | | | | | Add the following tests: stash src bspatch stashed_src tgt free stashed_src (expected a successful update) stash src free stashed_src fail_the_update (expected stashed_src freed) Bug: 36242722 Test: Test identified unfreed stashes correctly. Change-Id: I5a136e8dc31774367972fbfe8c63cbc1ddb3a113
* updater: Remove some obsoleted functions for file-based OTA.Tao Bao2017-03-131-113/+0
| | | | | | | | | | | | | | This CL removes the updater support for delete(), symlink(), rename(), set_metadata() and set_metadata_recursive(). Such functions have been removed from the generation script in commit f388104eaacd05cfa075d6478369e1d0df5ddbf3 (platform/build). Note: This CL also removes delete_recursive() which seems to have never been supported in generation script. Bug: 35853185 Test: recovery_component_test passes. Change-Id: I51e1ec946fa73761118fa1eaa082423df6d588e9
* tests: Add testcase for show_progress() and set_progress().Tao Bao2017-01-061-0/+50
| | | | | Test: recovery_component_test passes. Change-Id: I4f00d0171cf86699e9ce747d07d7d44a01906e81
* updater: Refactor set_stage() and get_stage() functions.Tao Bao2016-11-181-0/+59
| | | | | | | | | | | Add read_bootloader_message_from() and write_bootloader_message_to() to allow specifying the BCB device (/misc). Also add testcases for set_stage() and get_stage(). Test: recovery_component_test passes. Test: Build a recovery image and apply a two-step OTA package. Change-Id: If5ab06a1aaaea168d2a9e5dd63c07c0a3190e4ae
* updater: Add testcase for package_extract_dir().Tao Bao2016-11-181-0/+96
| | | | | Test: recovery_component_test passes. Change-Id: I3af4707bc42c7331ca961be8b967a53de82ea25b
* updater: Add "write_value()" function.Tao Bao2016-11-171-0/+33
| | | | | | | | | | | | | write_value(value, filename) writes 'value' to 'filename'. It can be used to tune device settings when applying an OTA package. For example, write_value("960000", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"). Bug: 32463933 Test: recovery_component_test passes. Test: Apply an OTA package that contains a call to write_value(), and check the result. Change-Id: Ib009ecb8a45a94353f10c59e2383fe1f49796e35
* updater: Fix the wrong return value for package_extract_file().Tao Bao2016-11-151-17/+75
| | | | | | | | | | | | | | | 'bool success = ExtractEntryToFile()' gives opposite result. Fix the issue and add testcases. Change the one-argument version of package_extract_file() to explicitly abort for non-existent zip entry. Note that this is NOT changing the behavior. Prior to this CL, it aborts from Evaluate() function, by giving a general cause code. Now it returns kPackageExtractFileFailure. BUg: 32903624 Test: recovery_component_test works. Change-Id: I7a273e9c0d9aaaf8c472b2c778f7b8d90362c24f
* updater: Add more testcase for symlink().Tao Bao2016-11-091-6/+39
| | | | | | | | Clean up SymlinkFn() a bit. Also clean up the temp files created when running the tests; otherwise non-empty TemporaryDir won't be removed. Test: recovery_component_test passes. Change-Id: Id3844abebd168c40125c4dcec54e6ef680a83c3a
* Make make_parent() to take const argumentTianjie Xu2016-11-081-0/+22
| | | | | | | | Switch to use const std::string; and add corresponding tests. Bug: 32649858 Test: Component tests pass Change-Id: I640f3ec81f1481fa91aa310f8d4d96dac9649cb9
* updater: Add a testcase for RenameFn().Tao Bao2016-11-041-0/+29
| | | | | | Test: recovery_component_test passes. Change-Id: Iba5a0fdf6c79e2bed6b30b8fc19a306c1ab29d8a
* updater: Fix a bug in DeleteFn().Tao Bao2016-11-041-0/+33
| | | | | | | Also add a testcase for delete() function. Test: recovery_component_test passes. Change-Id: I064d1ad4693c3ed339d0a69eabadd08a61a2ea86
* updater: Fix an off-by-1 bug in file_getprop().Tao Bao2016-11-031-0/+50
| | | | | | | | Also add a testcase for file_getprop(). Test: recovery_component_test passes. Change-Id: I8eb2f9a5702b43997ac9f4b29665eea087b1c146
* Change StringValue to use std::stringTianjie Xu2016-10-151-4/+4
| | | | | | | | | | | Changing the field of 'Value' in edify to std::string from char*. Meanwhile cleaning up the users of 'Value' and switching them to cpp style. Test: compontent tests passed. Bug: 31713288 Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
* edify: Some clean-ups to libedify.Tao Bao2016-10-131-1/+0
| | | | | | | | | | | | - Remove dead declarations in expr.h: SetError(), GetError(), ClearError(). - Remove the declaration of Build() out of expr.h. - Use std::unordered_map to implement RegisterFunction() and FindFunction(); kill FinishRegistration(). - Add a testcase for calling unknown functions. Test: mmma bootable/recovery; recovery_component_test passes. Change-Id: I9af6825ae677f92b22d716a4a5682f58522af03b
* updater: Kill the duplicate PrintSha1() in install.cpp.Tao Bao2016-10-111-7/+36
| | | | | | | | Also add a testcase for sha1_check(). Test: mmma bootable/recovery; recovery_component_test passes. Change-Id: I4d06d551a771aec84e460148544f68b247a7e721
* Refactor libupdater into a seperate module.Tao Bao2016-10-111-0/+71
So that we can write native tests for updater functions. This CL adds a testcase for getprop() function. Test: mmma bootable/recovery; Run recovery_component_test on device. Change-Id: Iff4c1ff63c5c71aded2f9686fed6b71cc298c228