aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test.Tao Bao2018-03-121-0/+51
| | | | | | | | | | /system/bin/applypatch on device is expected to work with bsdiff based recovery-from-boot patch automatically. Adding a test to ensure that's always the case. Bug: 72731506 Test: Run recovery_component_test on marlin. Change-Id: I56283cd3ce7cf0215cc3bb3619b206fa01d552c4
* Add a singleton CacheLocation to replace the hard coded locationsTianjie Xu2018-02-282-9/+17
| | | | | | | | | | | | This class allows us to set the following locations dynamically: cache_temp_source, last_command_file, stash_directory_base. In the updater's main function, we reset the values of these variables to their default locations in /cache; while we can set them to temp files in unit tests or host simulation. Test: unit tests pass Change-Id: I528652650caa41373617ab055d41b1f1a4ec0f87
* Remove the assumption of target chunk size in imgdiffTianjie Xu2018-02-231-0/+101
| | | | | | | | | | | | | | | | In the split mode of imgdiff, we used to assume that the size of a split target chunk is always greater than the blocksize i.e. 4096. This may lead to the following assertion failure: I0221 04:57:33.451323 818464 common.py:205 imgdiff F 02-21 04:57:33 821203 821203 imgdiff.cpp:999] Check failed: tgt_size >= BLOCK_SIZE (tgt_size=476, BLOCK_SIZE=4096) This CL removes the assumption and handles the edge cases. Test: generate and verify the incremental update for TFs in the bug; unit test passes Bug: 73757557 Bug: 73711365 Change-Id: Iadbb4ee658995f5856cd488f3793980881a59620
* Log the last command to cacheTianjie Xu2018-02-061-0/+217
| | | | | | | | | | | | | | | | | | | | | | | | When performing an update, save the index and cmdline of the current command into the last command file if this command writes to the stash either explicitly of implicitly. This mitigates the overhead to update the last command file for every command. I ran a simple test on angler and the time to update 1000 times is ~2.3 seconds. Upon resuming an update, read the saved index first; then 1. In verification mode, check if all commands before the saved index have already produced the expected target blocks. If not, delete the last command file so that we will later resume the update from the start of the transfer list. 2. In update mode, skip all commands before the saved index. Therefore, we can avoid deleting stashes with duplicate id unintentionally; and also speed up the update. If an update succeeds or is unresumable, delete the last command file. Bug: 69858743 Test: Unittest passed, apply a failed update with invalid cmd on angler and check the last_command content, apply a failed update with invalid source hash and last_command is deleted. Change-Id: Ib60ba1e3c6d111d9f33097759b17dbcef97a37bf
* Merge "Switch to bionic gtest in bootable/recovery"Tianjie Xu2017-11-063-235/+135
|\
| * Switch to bionic gtest in bootable/recoveryTianjie Xu2017-11-033-235/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We encountered segfaults in Imgdiff host tests due to the failure to reset states of getopt. The problem can be solved by switching to use bionic's gtest where a new process is forked for each test. Also modify the recovery_component_test to make sure it runs in parallel. Changes include: 1. Merge the writes to misc partition into one single test. 2. Change the hard coded location "/cache/saved.file" into a configurable variable. Bug: 67849209 Test: recovery tests pass Change-Id: I165d313f32b83393fb7922c5078636ac40b50bc2
* | Clean up fuse_sideload and add a testcase.Tao Bao2017-11-031-4/+66
| | | | | | | | | | | | | | | | | | | | | | | | This CL mainly changes: a) moving the interface in struct provider_vtab to std::function; b) code cleanup, such as moving the declaration closer to the uses, using explicit type conversion. Test: recovery_component_test Test: minadbd_test Test: Sideload a package on marlin. Change-Id: Id0e3c70f1ada54a4cd985b54c84438c23ed4687e
* | tests: Clean up the files in TemporaryDir.Tao Bao2017-11-021-5/+9
|/ | | | | | | | | ~TemporaryDir() calls rmdir(2) directly, which works with empty directories only. Test: Run recovery_host_test; No leftover on host. Test; Run recovery_component_test on marlin; No leftover on device. Change-Id: Ib510efb16eeda61b34161e2b386499e6cb79a4ca
* Fix the size mismatch in imgdiffTianjie Xu2017-11-011-50/+27
| | | | | | | | | | | | As we construct the deflate entries of the target zip file with random data, the total size of the zip file may vary from case to case. This leads to occasional failures in the split test for deflate large apk files. This CL fixes the issue by adding two static zip files in the testdata instead of generating them dynamically. Bug: 67849209 Test: run the deflate_large_test repeatedly Change-Id: Iaeffad9205adefa10c9f62f9f088c33c4360a650
* tests: Take the ownership of the FD when calling fdopen.Tao Bao2017-10-262-29/+29
| | | | | | | To avoid closing the same FD twice. Test: recovery_component_test && recovery_host_test Change-Id: I95195be8109101081410e9224efda535b2560e72
* Merge "Use SuffixArrayIndexInterface opaque type instead of the underlying ↵Alex Deymo2017-10-241-1/+1
|\ | | | | | | | | | | | | | | data pointer." am: 3d24b7bca6 Change-Id: I18b7e9ca9ae299b8a028da63fc7d3e9e9eaef221
| * Merge "Use SuffixArrayIndexInterface opaque type instead of the underlying ↵Treehugger Robot2017-10-241-1/+1
| |\ | | | | | | | | | data pointer."
| | * Use SuffixArrayIndexInterface opaque type instead of the underlying data ↵Alex Deymo2017-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pointer. 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
* | | Merge "Finish the new data receiver when update fails"Tianjie Xu2017-10-201-87/+133
|\| | | | | | | | | | | | | | | | | am: 9831ef389b Change-Id: I62be2406eede1f9e02ee4ca45ffca6fd2283ef0a
| * | 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
* | | Merge "otautil: Move RangeSet implementation into rangeset.cpp."Tao Bao2017-10-171-0/+1
|\| | | | | | | | | | | | | | | | | am: bab1e8efc8 Change-Id: I5d41bdfe514e09c49bf2279ee6ca1b56ff5aab1f
| * | otautil: Move RangeSet implementation into rangeset.cpp.Tao Bao2017-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it has grown much larger, users of the header shouldn't compile and carry their full copies. Also add missing header includes in imgdiff.cpp and imgdiff_test.cpp. Test: mmma bootable/recovery Test: recovery_unit_test; recovery_component_test; recovery_host_test Change-Id: I88ca54171765e5606ab0d61580fbc1ada578fd7d
* | | Merge "Move rangeset.h and print_sha1.h into otautil."Tao Bao2017-10-112-2/+2
|\| | | | | | | | | | | | | | | | | am: ff9b6f63a2 Change-Id: I4fea3584f64b273922ff20e9661c02a34ccca2f8
| * | Move rangeset.h and print_sha1.h into otautil.Tao Bao2017-10-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge changes from topic "libedify-header"Tao Bao2017-10-101-1/+1
|\| | | | | | | | | | | | | | | | | am: abade5af15 Change-Id: I8a2c066f807b85139c24ec44f504d19549e1aa7d
| * | 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
* | Merge "Revert "Move error_code.h into otautil.""Tao Bao2017-10-051-1/+1
|\| | | | | | | | | | | am: b23d29642d Change-Id: Ib5b7fcf9c627bc1ee09b4abafc54e91c8e788edc
| * 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
* | Merge "Move error_code.h into otautil."Tao Bao2017-10-051-1/+1
|\| | | | | | | | | | | am: 916e155bab Change-Id: I53265b03c12bfd022a634f8633f2d2e15a5e641b
| * 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
* | Merge "Output split information for imgdiff when handling large apks"Tianjie Xu2017-09-261-8/+40
|\| | | | | | | | | | | am: 7f54fe8841 Change-Id: I97ad82d84b16b46e9c0c0f8198d3ab73d43031b0
| * Output split information for imgdiff when handling large apksTianjie Xu2017-09-211-8/+40
| | | | | | | | | | | | | | | | | | | | | | Add a mandatory option in imgdiff to write the split info (i.e. patch_size, tgt_size, src_ranges) to file when handling large apks. Therefore, the caller of imgdiff can create split transfers based on the info. Bug: 63542719 Test: unit tests pass Change-Id: I853d55d1f999fd576474faa81077f7307f4d856d
* | Merge "Fix the dangling pointer when setting up arguments of imgdiff"Tianjie Xu2017-09-171-6/+9
|\| | | | | | | | | | | am: ca5a071307 Change-Id: I9411f0bce8d96c598db365d0257d4c9893e24104
| * Fix the dangling pointer when setting up arguments of imgdiffTianjie Xu2017-09-131-6/+9
| | | | | | | | | | Test: unit tests pass Change-Id: If884e805ccd4df73671ab3436eb90860786ff6c9
* | Merge "Close cmd_pipe properly after updater test finishes"Tianjie Xu2017-09-121-8/+14
|\| | | | | | | | | | | am: 64307daf5b Change-Id: Ic384d9de3c559855cfe0bd122adb5e69fa996ad1
| * 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 "Improve imgdiff for large zip files"Tianjie Xu2017-09-081-5/+334
|\| | | | | | | | | | | am: 9f48641784 Change-Id: I999525af80c5423da275025d977de10399140479
| * Improve imgdiff for large zip filesTianjie Xu2017-09-051-5/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the cache size limit for OTA generation, we used to split large zip files linearly into pieces and do bsdiff on them. As a result, i) we lose the advantage of imgdiff; ii) if there's an accidental order change of some huge files inside the zip, we'll create an insanely large patch. This patch splits the src&tgt more smartly based on the zip entry_name. If the entry_name is empty or no matching source is found for a target chunk, we'll skip adding its source and later do a bsdiff against the whole split source image (this rarely happens in our use cases except for the metadata inside a ziparchive). After the split, the target pieces are continuous and block aligned, while the sources pieces are mutually exclusive. (Some of the source blocks may not be used if there's no matching entry_name in the target.) Then we will generate patches accordingly between each split image pairs. Afterwards, if we apply imgpatch to each pair of split source/target images and add up the patched result, we can get back the original target image. For example: Input: [src_image, tgt_image] Split: [src-0,tgt-0; src-1,tgt-1, src-2,tgt-2] Diff: [ patch-0; patch-1; patch-2] Patch: [(src-0,patch-0)=tgt-0; (src-1,patch-1)=tgt-1; (src-2,patch-2)=tgt-2;] Append: [tgt-0 + tgt-1 + tgt-2 = tgt_image] Peformance: For the small package in b/34220646, we decrease the patch size of chrome.apk dramatically from 30M to 400K due to the order change of two big .so files. On two versions of angler, I also observe decent patch size decrease. For chrome.apk, we reduced the size from 5.9M to 3.2M; and for vevlet.apk from 8.0M to 6.5M. Bug: 34220646 Test: recovery component test && apply imgdiff & imgpatch on two chrome.apk Change-Id: I145d802984fa805efbbac9d01a2e64d82ef9728b
* | Merge "Turn on -Wall for recovery modules"Tianjie Xu2017-08-291-8/+0
|\| | | | | | | | | | | am: 11f68b6b69 Change-Id: I5f0531de7880682c7dfe75a6274f41519e0c64d6
| * Turn on -Wall for recovery modulesTianjie Xu2017-08-281-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Turn on -Wall for all modules. Also remove the obsolete file_cmp() in apply_patch test and now() in wear_ui. The only exception is lib_edify due to the unused functions in the intermediate cpp files generated from the lex files. It will be handled in a seperate CL. Bug: 64939312 Test: mma, unit tests pass Change-Id: Ic53f76b60b6401ab20db3d98130d674c08e3702f
* | Merge "Allow comparison against multi serial nums for A/B package" am: ↵Tianjie Xu2017-08-221-13/+58
|\| | | | | | | | | | | | | | | 3810046a55 am: e8b02d68e5 am: 968ebdeefd Change-Id: I21de76c870001cb5faf145d5f39f8fb2cfa58a66
| * Merge "Allow comparison against multi serial nums for A/B package"Tianjie Xu2017-08-221-13/+58
| |\
| | * Allow comparison against multi serial nums for A/B packageTianjie Xu2017-08-221-13/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The metadata file now can have multiple serial numbers in the format: serialno=serialno1|serialno2|serialno3 ... Verifier will pass the check if the device serial number matches any of these numbers. Bug: 64802465 Test: Create a metadata file with 1000 numbers and sideload in sailfish. The checker detects both match and mismatch cases. Change-Id: I3f12b75e15f4179df260778e37f4563d65db0fa8
* | | Merge "tests: Add a test to cover legacy care_map.txt handling." am: ↵Tao Bao2017-07-241-0/+13
|\| | | | | | | | | | | | | | | | | | | | | | | 6eb23c594c am: dbe9da5331 am: 0148a6f9ab Change-Id: Id568b7cb5043c444f88032368be57a6f128a44c7
| * | Merge "tests: Add a test to cover legacy care_map.txt handling."Tao Bao2017-07-241-0/+13
| |\| | | | | | | | | | | | | | | | am: 6eb23c594c Change-Id: Iaad43cb44f4c406e4c07c9399e70e96cbaa4db7b
| | * tests: Add a test to cover legacy care_map.txt handling.Tao Bao2017-07-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to cover the code added by commit 5a1dee01df3af346729b5791606b72d59b8e9815, where an O update_verifier should not reject N care_map.txt. Bug: 63544345 Test: recovery_component_test passes on marlin. Change-Id: Ia944e16cba3cc635098b3ffd92842d725b570fec
* | | Merge "Fix a case when brotli writer fails to write last few blocks of data" ↵Tianjie Xu2017-07-211-4/+15
|\| | | | | | | | | | | | | | | | | | | | | | | am: e45c8f0057 am: 80acaab52f am: 75ff0107c8 Change-Id: Ieab5e6e412704599e873c7497d1c0de42453e642
| * | Merge "Fix a case when brotli writer fails to write last few blocks of data"Tianjie Xu2017-07-211-4/+15
| |\| | | | | | | | | | | | | | | | am: e45c8f0057 Change-Id: I337e8ec26f59a5245ab299080d7251331823e2da
| | * 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
* | | | Merge "Fix the android-cloexec-* warnings in bootable/recovery" am: ↵Tianjie Xu2017-07-191-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 94a8ea1797 am: 6d8827e0d3 am: 96b5bb9601 Change-Id: I55911c112a34797d7c7098e5e325145667b46715
| * | | Merge "Fix the android-cloexec-* warnings in bootable/recovery"Tianjie Xu2017-07-191-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | am: 94a8ea1797 Change-Id: I57ae57bab58f603540654bb24df9facca9a7d625
| | * | 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
* | | Merge "Add support to decompress brotli compressed new data" am: 918e6ea1b2 ↵Tianjie Xu2017-07-101-0/+67
|\| | | | | | | | | | | | | | | | | | | | | | | am: 43bdf6cad6 am: 8375ebee37 Change-Id: I3eea508486f48d316644b68278f42976ffd4698d
| * | Merge "Add support to decompress brotli compressed new data"Tianjie Xu2017-07-101-0/+67
| |\| | | | | | | | | | | | | | | | am: 918e6ea1b2 Change-Id: I4fd9cea71716ad1574ecb4bb7f612bc8734711c5