summaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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-071-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
* StartsWith allows a std::string prefix now.Elliott Hughes2017-12-201-1/+1
| | | | | | Bug: N/A Test: builds Change-Id: I5183ec8133f5dc9a81a438223c6d3d2ea11ef0ec
* Load-balancing update_verifier worker threads.Tao Bao2017-11-091-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this CL, the block verification works were assigned based on the pattern of the ranges, which could lead to unbalanced workloads. This CL adds RangeSet::Split() and moves update_verifier over. a) For the following care_map.txt on walleye: system 20,0,347,348,540,556,32770,33084,98306,98620,163842,164156,229378,229692,294914,295228,524289,524291,524292,524348,529059 vendor 8,0,120,135,32770,32831,94564,98304,98306 Measured the time costs prior to and with this CL with the following script. $ cat test_update_verifier.sh #!/bin/sh adb shell stop adb shell "cp /data/local/tmp/care_map.txt /data/ota_package/" for i in $(seq 1 50) do echo "Iteration: $i" adb shell "bootctl set-active-boot-slot 0" adb shell "echo 3 > /proc/sys/vm/drop_caches" adb shell "time /data/local/tmp/update_verifier" sleep 3 done Without this CL, the average time cost is 5.66s, while with the CL it's reduced to 3.2s. b) For the following care_map.txt, measured the performance on marlin: system 18,0,271,286,457,8350,32770,33022,98306,98558,163842,164094,196609,204800,229378,229630,294914,295166,501547 vendor 10,0,42,44,85,2408,32770,32806,32807,36902,74242 It takes 12.9s and 5.6s without and with the CL respectively. Fixes: 68553827 Test: recovery_unit_test Test: Flash new build and trigger update_verifier. Check the balanced block verification. Change-Id: I5fa4bf09a84e6b9b0975ee5f522724464181333f
* Merge "otautil: Remove the aborts in RangeSet::Parse()."Tao Bao2017-11-081-14/+64
|\
| * otautil: Remove the aborts in RangeSet::Parse().Tao Bao2017-11-071-14/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to CHECK and abort on parsing errors. While it works fine for the updater use case (because recovery starts updater in a forked process and collects the process exit code), it's difficult for other clients to use RangeSet as a library (e.g. update_verifier). This CL switches the aborts to returning empty RangeSet instead. Callers need to check the parsing results explicitly. The CL also separates RangeSet::PushBack() into a function, and moves SortedRangeSet::Clear() into RangeSet. Test: recovery_unit_test Test: Sideload an OTA package with the new updater on angler. Test: Sideload an OTA package with injected range string errors. The updater aborts from the explicit checks. Change-Id: If2b7f6f41dc93af917a21c7877a83e98dc3fd016
* | Merge "Switch to bionic gtest in bootable/recovery"Tianjie Xu2017-11-064-238/+142
|\ \ | |/ |/|
| * Switch to bionic gtest in bootable/recoveryTianjie Xu2017-11-034-238/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-041-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
* | Merge "tests: Clean up the files in TemporaryDir."Treehugger Robot2017-11-031-5/+9
|\ \ | |/ |/|
| * 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
* | Merge "Add libbrotli as a dependency for libbsdiff"Tianjie Xu2017-11-021-0/+1
|\ \ | |/ |/|
| * Add libbrotli as a dependency for libbsdiffTianjie Xu2017-11-011-0/+1
| | | | | | | | | | | | Bug: 34220646 Test: mma Change-Id: If00285943fff8226f1bc7239db5570a277739904
* | Fix the size mismatch in imgdiffTianjie Xu2017-11-014-53/+36
|/ | | | | | | | | | | | 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 data pointer."Alex Deymo2017-10-241-1/+1
|\ | | | | | | | | | | am: 3d24b7bca6 Change-Id: I18b7e9ca9ae299b8a028da63fc7d3e9e9eaef221
| * 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
* | | 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-114-4/+5
|\| | | | | | | | | | | | | | | | | am: ff9b6f63a2 Change-Id: I4fea3584f64b273922ff20e9661c02a34ccca2f8
| * | Move rangeset.h and print_sha1.h into otautil.Tao Bao2017-10-114-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "otafault: Remove the use of LOCAL_WHOLE_STATIC_LIBRARIES."Tao Bao2017-09-291-1/+1
|\| | | | | | | | | | | am: 50f5a54a1e Change-Id: I4f2d63757bb122cd027627321c1ab66c5e9284b6
| * otafault: Remove the use of LOCAL_WHOLE_STATIC_LIBRARIES.Tao Bao2017-09-291-1/+1
| | | | | | | | | | | | | | | | Commit d80a99883d5ae2b117c54f076fe1df7eae86d2f8 has explanation of potential issues. Test: mmma bootable/recovery Change-Id: I25ca9920952b7bbdd8a661d9dc90962431410bc4
* | Merge "Output split information for imgdiff when handling large apks"Tianjie Xu2017-09-271-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-061-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-292-11/+4
|\| | | | | | | | | | | am: 11f68b6b69 Change-Id: I5f0531de7880682c7dfe75a6274f41519e0c64d6
| * Turn on -Wall for recovery modulesTianjie Xu2017-08-292-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: 3810046a55 am: e8b02d68e5Tianjie Xu2017-08-231-13/+58
|\| | | | | | | | | | | am: 968ebdeefd Change-Id: I21de76c870001cb5faf145d5f39f8fb2cfa58a66
| * Merge "Allow comparison against multi serial nums for A/B package"Tianjie Xu2017-08-231-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 "Move Image/ImageChunk/PatchChunk declaration into header files" am: b4bc57ed39 am: b127fddf09Tianjie Xu2017-08-191-1/+1
|\| | | | | | | | | | | | | | | | | am: f5e3cadeca Change-Id: Ic9056467184e272eec5c0aead3d4a712033b0503
| * | Merge "Move Image/ImageChunk/PatchChunk declaration into header files"Tianjie Xu2017-08-191-1/+1
| |\| | | | | | | | | | | | | | | | am: b4bc57ed39 Change-Id: If254ed9e24bc0cafa19db9766ed36643ca0fed49
| | * Move Image/ImageChunk/PatchChunk declaration into header filesTianjie Xu2017-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Move the declaration of the Image classes to the header file to make testing easier. 2. Also move rangeset.h to bootable/recovery to allow access in imgdiff. Test: recovery component test Change-Id: I68a863e60a3f2e7ae46ee48f48eb15391f5f4330
* | | Merge "tests: Add the missing dependency on libhidlbase." am: 05b2e982ad am: 43df6cfeeeTao Bao2017-08-101-1/+2
|\| | | | | | | | | | | | | | | | | am: 46c13f3f05 Change-Id: Iaa1bd4f403664a87153b9f6b647e04bc7798a33d
| * | Merge "tests: Add the missing dependency on libhidlbase."Tao Bao2017-08-101-1/+2
| |\| | | | | | | | | | | | | | | | am: 05b2e982ad Change-Id: Ie08dca777af1d12a304aebf11f4df25680ff939a
| | * tests: Add the missing dependency on libhidlbase.Tao Bao2017-08-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It fails to build recovery_component_test with the following errors: out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14: error: undefined reference to 'android::hardware::hidl_string::hidl_string(android::hardware::hidl_string const&)' out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14: error: undefined reference to 'android::hardware::hidl_string::operator=(android::hardware::hidl_string const&)' out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14: error: undefined reference to 'android::hardware::hidl_string::~hidl_string()' libupdate_verifier includes <android/hardware/boot/1.0/IBootControl.h>, which includes the 'types.h' above. In 'types.h', it defines struct CommandResult that's using android::hardware::hidl_string. Since libhidlbase doesn't have a static library target, remove 'LOCAL_FORCE_STATIC_EXECUTABLE := true', which isn't required for running tests. Test: mmma -j bootable/recovery Bug: 64538692 Change-Id: Iaa7c08adc241128d787274fcaea9b363e7ff93f4 (cherry picked from commit 102016ce1fe62190ace7016f2e7484b37f6391ea)
* | | Merge "Add implemention of SortedRangeSet" am: 64cba55fbc am: fbd4b10310Tianjie Xu2017-08-011-0/+47
|\| | | | | | | | | | | | | | | | | am: a09376ed90 Change-Id: I67b2f4e91133239d4eb35524c7f0ed41f18de8dc
| * | Merge "Add implemention of SortedRangeSet"Tianjie Xu2017-08-011-0/+47
| |\| | | | | | | | | | | | | | | | am: 64cba55fbc Change-Id: I2174e4f55c85fe57014b31625dbc2d06e41350be
| | * Merge "Add implemention of SortedRangeSet"Tianjie Xu2017-08-011-0/+47
| | |\
| | | * Add implemention of SortedRangeSetTianjie Xu2017-08-011-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful in imgdiff to maintain the block ranges of splitted source image. Bug: 34220646 Test: mma && unit tests pass Change-Id: I6427f2ea50f0e3b0aa3dd01880ec0206679b7429
* | | | Merge "otautil: Clean up dirCreateHierarchy()." am: 610712101b am: 5507c3d63cTao Bao2017-07-311-21/+11
|\| | | | | | | | | | | | | | | | | | | | | | | am: 0863373376 Change-Id: Ia2326bca2d8a1344fccd2838e2b376cb9a843a82
| * | | Merge "otautil: Clean up dirCreateHierarchy()."Tao Bao2017-07-311-21/+11
| |\| | | | | | | | | | | | | | | | | | | | | | am: 610712101b Change-Id: I95350c4b2aab36dd89ea7813f2eb63d407b5f8ac
| | * | otautil: Clean up dirCreateHierarchy().Tao Bao2017-07-271-21/+11
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changed to std::string based implementation (mostly moved from the former make_parents() in updater/install.cpp); - Removed the timestamp parameter, which is only neeed by file-based OTA; - Changed the type of mode from int to mode_t; - Renamed dirCreateHierarchy() to mkdir_recursively(). Test: recovery_unit_test passes. Test: No external user of dirCreateHierarchy() in code search. Change-Id: I71f8c4b29bab625513bbc3af6d0d1ecdc3a2719a
* | | Merge "otautil: Delete dirUnlinkHierarchy()." am: 031661d4a9 am: 993cec5cc9Tao Bao2017-07-251-32/+0
|\| | | | | | | | | | | | | | | | | am: 633aeba594 Change-Id: I9833741fe5d785298d7f99f6b2c9539723f8fcd1
| * | Merge "otautil: Delete dirUnlinkHierarchy()."Tao Bao2017-07-251-32/+0
| |\| | | | | | | | | | | | | | | | am: 031661d4a9 Change-Id: I33a793646f6f11757afc20f16fd3a0f700dd09fb
| | * otautil: Delete dirUnlinkHierarchy().Tao Bao2017-07-251-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This function has become obsolete since we've removed file-based OTA support (it was needed by 'delete_recursive' edify function earlier). Test: mmma -j bootable/recovery Test: Code search shows no active user of the function. Change-Id: If6faaa759d4c849b79acba4e6adb82baadc89f7a
* | | Merge "tests: Add a test to cover legacy care_map.txt handling." am: 6eb23c594c am: dbe9da5331Tao Bao2017-07-241-0/+13
|\| | | | | | | | | | | | | | | | | 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" am: e45c8f0057 am: 80acaab52fTianjie Xu2017-07-221-4/+15
|\| | | | | | | | | | | | | | | | | 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: 94a8ea1797 am: 6d8827e0d3Tianjie Xu2017-07-202-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | am: 96b5bb9601 Change-Id: I55911c112a34797d7c7098e5e325145667b46715
| * | | Merge "Fix the android-cloexec-* warnings in bootable/recovery"Tianjie Xu2017-07-202-3/+3
| |\| | | | | | | | | | | | | | | | | | | | | | am: 94a8ea1797 Change-Id: I57ae57bab58f603540654bb24df9facca9a7d625
| | * | Fix the android-cloexec-* warnings in bootable/recoveryTianjie Xu2017-07-192-3/+3
| | |/ | | | | | | | | | | | | | | | | | | | | | 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 am: 43bdf6cad6Tianjie Xu2017-07-112-0/+68
|\| | | | | | | | | | | | | | | | | am: 8375ebee37 Change-Id: I3eea508486f48d316644b68278f42976ffd4698d
| * | Merge "Add support to decompress brotli compressed new data"Tianjie Xu2017-07-112-0/+68
| |\| | | | | | | | | | | | | | | | am: 918e6ea1b2 Change-Id: I4fd9cea71716ad1574ecb4bb7f612bc8734711c5
| | * Add support to decompress brotli compressed new dataTianjie Xu2017-07-082-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Fix a rare failure for imgdiff when random data equals gzip header" am: b87a166a16 am: 8542502f1fTianjie Xu2017-07-071-0/+33
|\| | | | | | | | | | | | | | | | | am: 233f4b0b4b Change-Id: If7e81b8e794f34d374d385eb5603353cdfec524f
| * | Merge "Fix a rare failure for imgdiff when random data equals gzip header"Tianjie Xu2017-07-071-0/+33
| |\| | | | | | | | | | | | | | | | am: b87a166a16 Change-Id: Ic3c7d102cc7a2b992c699add012076a4bda549c6
| | * Fix a rare failure for imgdiff when random data equals gzip headerTianjie Xu2017-07-071-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a rare case, a random chunk will pass both the gzip header check and the inflation process; but fail the uncompressed length check in the footer. This leads to a imgdiff failure. So, we should treat this chunk as 'normal' instead of 'inflated' while generating the patch. Bug: 63334984 Test: imgdiff generates patch successfully on previous failing images. Change-Id: Ice84f22d3653bce9756bda91e70528c0d2f264a0
* | | Merge "Remove the obsolete package_extract_dir() test" am: e916cca8a9 am: af913974a5Tianjie Xu2017-06-231-96/+0
|\| | | | | | | | | | | | | | | | | am: e002d96194 Change-Id: If4887683362c1a00ee20b0d6e447d70bff442c28
| * | Merge "Remove the obsolete package_extract_dir() test" am: e916cca8a9Tianjie Xu2017-06-231-96/+0
| |\| | | | | | | | | | | | | | | | am: af913974a5 Change-Id: I6afcdb92726231325a7d2e8171e3e2b1b3b940e0
| | * Merge "Remove the obsolete package_extract_dir() test"Tianjie Xu2017-06-231-96/+0
| | |\
| | | * 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
* | | | Merge "update_verifier: Support AVB." am: e248e434ea am: 1f108dae49David Zeuthen2017-06-222-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | am: b0c38f1cce Change-Id: If4e8be8b8277143cad9447a487a674e39ba5a832
| * | | Merge "update_verifier: Support AVB." am: e248e434eaDavid Zeuthen2017-06-222-1/+5
| |\| | | | | | | | | | | | | | | | | | | | | | am: 1f108dae49 Change-Id: I85544f829783fade5e91cfa1d48013047056924d
| | * | Merge "update_verifier: Support AVB."Treehugger Robot2017-06-222-1/+5
| | |\ \ | | | |/ | | |/|
| | | * update_verifier: Support AVB.David Zeuthen2017-05-242-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using AVB, PRODUCT_SUPPORTS_VERITY is not set so check for BOARD_ENABLE_AVB as well. Also AVB sets up the root filesystem as 'vroot' so map that to 'system' since this is what is expected. Managed to test at least that the code is at least compiled in: $ fastboot --set-active=_a Setting current slot to 'a'... OKAY [ 0.023s] finished. total time: 0.023s $ fastboot reboot rebooting... finished. total time: 0.050s $ adb wait-for-device $ adb logcat |grep update_verifier 03-04 05:28:56.773 630 630 I /system/bin/update_verifier: Started with arg 1: nonencrypted 03-04 05:28:56.776 630 630 I /system/bin/update_verifier: Booting slot 0: isSlotMarkedSuccessful=0 03-04 05:28:56.776 630 630 W /system/bin/update_verifier: Failed to open /data/ota_package/care_map.txt: No such file or directory 03-04 05:28:56.788 630 630 I /system/bin/update_verifier: Marked slot 0 as booted successfully. 03-04 05:28:56.788 630 630 I /system/bin/update_verifier: Leaving update_verifier. Bug: None Test: Manually tested on device using AVB bootloader. Change-Id: I13c0fe1cc5d0f397e36f5e62fcc05c8dfee5fd85
* | | | Merge "kill package_extract_dir" am: 99e7216907 am: 49f9c969eb am: 66e53f59b9Tianjie Xu2017-06-013-229/+0
|\| | | | | | | | | | | | | | | | | | | | | | | am: d1b65aa645 Change-Id: Idb46742fd2b73e927a14e12dd1b7ae5854e35334
| * | | Merge "kill package_extract_dir" am: 99e7216907 am: 49f9c969ebTianjie Xu2017-05-313-229/+0
| |\| | | | | | | | | | | | | | | | | | | | | | am: 66e53f59b9 Change-Id: Iec9ae5171aaa2d8a0eb92de12b78e65aeb0136a4
| | * | kill package_extract_dirTianjie Xu2017-05-243-229/+0
| | |/ | | | | | | | | | | | | | | | | | | It's only used by file-based OTA which has been deprecated for O. Test: mma Change-Id: I439c93155ca94554d827142c99aa6c0845cc7561
* | | Merge "Print SHA1 of the patch if bsdiff fails with data error" am: 1f9808bd48 am: 8f68accc9d am: 1562f41348Tianjie Xu2017-05-191-0/+39
|\| | | | | | | | | | | | | | | | | am: 0abe9860d8 Change-Id: Id8d4e4b369f30a33a37ca1895d5dd36eb2bf8aff
| * | Merge "Print SHA1 of the patch if bsdiff fails with data error" am: 1f9808bd48 am: 8f68accc9dTianjie Xu2017-05-191-0/+39
| |\| | | | | | | | | | | | | | | | am: 1562f41348 Change-Id: I7b605673eb3cee6a615459ca9fe2fc00c532ed9d
| | * Print SHA1 of the patch if bsdiff fails with data errorTianjie Xu2017-05-161-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will help us to identify the patch corruption. Meanwhile fix a wrong size parameter passed to bspatch. (patch->data.size() into patch->data.size() - patch_offset). Also remove the only usage of "ApplyBSDiffPatchMem()" and inline its Sink function for simplicity. Bug: 37855643 Test: Prints SHA1 for corrupted patch in imgdiff_test. Change-Id: Ibf2db8c08b0ded1409bb7c91a3547a6bf99c601d
* | | Merge "Add a binary path param to update_binary_command()." am: 197304aada am: f648b5c9fc am: f49c57643dTao Bao2017-05-091-10/+74
|\| | | | | | | | | | | | | | | | | am: 460e47adfc Change-Id: I34b789b29f019f730d6c8a7e3a96384a056c1d4a
| * | Merge "Add a binary path param to update_binary_command()." am: 197304aada am: f648b5c9fcTao Bao2017-05-091-10/+74
| |\| | | | | | | | | | | | | | | | am: f49c57643d Change-Id: Iea3496ad9cbcd8389ade9effa7072198cf33a5c3
| | * Add a binary path param to update_binary_command().Tao Bao2017-05-081-10/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows writing native tests for non-A/B update_binary_command(). Prior to this CL, it was extracting the updater to a hard-coded location (/tmp/update_binary) that's not available under the test environment. Test: recovery_component_test on angler and marlin respectively. Test: Sideload OTA packages on angler and marlin respectively. Change-Id: I78b9cc211d90c0a16a84e94e339b65759300e2a8
* | | Merge "fuse_sideload: Change the minimal block size to 4096." am: 4e8e56eaea am: 53b98de866 am: 6bea344d7eTao Bao2017-05-042-2/+18
|\| | | | | | | | | | | | | | | | | am: bfca876038 Change-Id: I5d1fa644a867b523553127c8bde92000f4cb539a
| * | Merge "fuse_sideload: Change the minimal block size to 4096." am: 4e8e56eaea am: 53b98de866Tao Bao2017-05-042-2/+18
| |\| | | | | | | | | | | | | | | | am: 6bea344d7e Change-Id: If7e905a7630ee8cf142752695272afb8e76c28cb
| | * Merge "fuse_sideload: Change the minimal block size to 4096."Tao Bao2017-05-042-2/+18
| | |\
| | | * fuse_sideload: Change the minimal block size to 4096.Tao Bao2017-05-032-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | run_fuse_sideload() is passing the block size as the max_read option, so it will only handle a request that involves at most two blocks at a time. However, the minimal allowed value was set to 1024 prior to this CL, which is inconsistent with the kernel code (fs/fuse/inode.c) that sets it to the greater of 4096 and the passed-in max_read option. This would fail the calls with a block size / max_read less than 4096 due to the wrongly computed block indices. Note that we didn't observe real issue in practice, because we have been using 64 KiB block sizes for both of adb and sdcard sideload calls. The issue only shows up in my local CL (to come later) that uses 1024 block size in run_fuse_sideload() tests. Test: recovery_component_test Test: adb sideload with the new recovery image on angler Change-Id: Id9f0cfea13d0d193dcb7cd41a1553a23739545f2
* | | | Merge "Move sysMapFile and sysReleaseMap into MemMapping class." am: fe7eecff4c am: 08d9ede8f2 am: b3eeb817abTao Bao2017-05-034-41/+30
|\| | | | | | | | | | | | | | | | | | | | | | | am: 586377d1f3 Change-Id: I4d2cac061fbf6ac34e9e5125ebd5294dbc33e4ef
| * | | Merge "Move sysMapFile and sysReleaseMap into MemMapping class." am: fe7eecff4c am: 08d9ede8f2Tao Bao2017-05-034-41/+30
| |\| | | | | | | | | | | | | | | | | | | | | | am: b3eeb817ab Change-Id: I1bcf86cbbc495bf5df92dc53e01be39e7c623255
| | * | Move sysMapFile and sysReleaseMap into MemMapping class.Tao Bao2017-05-024-41/+30
| | |/ | | | | | | | | | | | | | | | | | | Test: recovery_component_test Test: recovery_unit_test Test: Apply an OTA on angler. Change-Id: I7170f03e4ce1fe06184ca1d7bcce0a695f33ac4d
* | | Merge "Separate libupdate_verifier module and add testcases." am: c99bb23955 am: d8c078d2c6 am: c7410924a3Tao Bao2017-04-272-0/+89
|\| | | | | | | | | | | | | | | | | am: 322d866ec8 Change-Id: I58bf1596f7247866e0d9e76c1c7a5ddc1d58024a
| * | Merge "Separate libupdate_verifier module and add testcases." am: c99bb23955 am: d8c078d2c6Tao Bao2017-04-272-0/+89
| |\| | | | | | | | | | | | | | | | am: c7410924a3 Change-Id: I452f0a1b5c0377f985294d37d59a19d1272be50d
| | * Separate libupdate_verifier module and add testcases.Tao Bao2017-04-272-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | Enable -Wall and expose verify_image() for testing purpose. Test: mmma bootable/recovery Test: recovery_component_test Change-Id: I1ee1db2a775bafdc1112e25a1bc7194d8d6aee4f
* | | Merge "applypatch: Remove the obsolete support for "applypatch -s"." am: d5ae4253c1 am: 22b1fa7d61 am: 7ee4b7dd84Tao Bao2017-04-261-14/+0
|\| | | | | | | | | | | | | | | | | am: 41dc284309 Change-Id: If092d5a6d97e31bef4d2ec19478061c8df4ad792
| * | Merge "applypatch: Remove the obsolete support for "applypatch -s"." am: d5ae4253c1 am: 22b1fa7d61Tao Bao2017-04-261-14/+0
| |\| | | | | | | | | | | | | | | | am: 7ee4b7dd84 Change-Id: I9f372c9b371f28b70ec6832e66053d3aee5b7c8e
| | * applypatch: Remove the obsolete support for "applypatch -s".Tao Bao2017-04-261-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SpaceMode (applypatch -s) was used in amend script (cupcake) only, which has been removed since commit 9ce2ebf5d300eba5f6086583b0941ef68a3e4b42 (platform/build). The later (and current) edify script uses apply_patch_space(). Note that other modes (PatchMode, CheckMode) of applypatch executable are mostly used by install-recovery.sh script. Test: No active user of "applypatch -s". Test: recovery_component_test Change-Id: I1d689b7fedd3884077e88ed1d6c22f7a2198859d
* | | Merge "Add more tests for verify_package_compatibility()." am: a9dd77fa84 am: 5f85d07e87 am: 54f8988cfeTao Bao2017-04-241-0/+84
|\| | | | | | | | | | | | | | | | | am: 7b2957ed25 Change-Id: Ia1dbea19d1975348a7dfdcaf803ebb6bf4b99a0a
| * | Merge "Add more tests for verify_package_compatibility()." am: a9dd77fa84 am: 5f85d07e87Tao Bao2017-04-241-0/+84
| |\| | | | | | | | | | | | | | | | am: 54f8988cfe Change-Id: I389ced1ec0e90e90e5fbde74f1b0ab5449310ab7
| | * Merge "Add more tests for verify_package_compatibility()."Tao Bao2017-04-241-0/+84
| | |\
| | | * Add more tests for verify_package_compatibility().Tao Bao2017-04-201-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This now covers the actual calls to libvintf, and asserts we're getting identical results through verify_package_compatibility() and by calling libvintf directly. We were missing the coverage and introduced the double free bug (fixed by commit f978278995d02a58e311fe017bdbb2c3702dd3bc). Bug: 37413730 Test: recovery_component_test passes. Test: recovery_component_test fails w/o commit f978278995d02a58e311fe017bdbb2c3702dd3bc. Change-Id: If5195ea1c583fd7c440a1de289da82145e80e23c
* | | | Merge "tests: Remove obsolete classes in applypatch_test." am: f17aa960db am: 8a3325dc8a am: f4a8d0bba6Tao Bao2017-04-241-49/+2
|\| | | | | | | | | | | | | | | | | | | | | | | am: b35fb1cf7b Change-Id: Iba385b5435dc8aa4393821f8a72c92c477685f51
| * | | Merge "tests: Remove obsolete classes in applypatch_test." am: f17aa960db am: 8a3325dc8aTao Bao2017-04-241-49/+2
| |\| | | | | | | | | | | | | | | | | | | | | | am: f4a8d0bba6 Change-Id: If68b3e47fa75a5d5f2041bdda8a8f4cb84c8880c
| | * | tests: Remove obsolete classes in applypatch_test.Tao Bao2017-04-211-49/+2
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ApplyPatchFullTest and ApplyPatchDoubleCacheTest were used for defining testcases for file-based OTA. The testcases have already been removed by commit 40e144dae877654f75e65242535036058ea48f58. This CL removes the obsolete class defnitions. Bug: 37559618 Test: recovery_component_test on angler and marlin respectively. Change-Id: I3f4f1dfc8580cf010365e671de256f68bbc0d99a
| | * Merge "Call libvintf to verify package compatibility."Tao Bao2017-04-201-0/+3
| | |\
| | | * Call libvintf to verify package compatibility.Tao Bao2017-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libvintf API has landed. Hook up to do the actual verification. Bug: 36597505 Test: recovery_component_test Test: m recoveryimage; adb sideload on angler and sailfish, with packages that contain dummy compatibility entries. Test: m recoveryimage; adb sideload on angler and sailfish, with packages that don't contain any compatibility entries. Change-Id: Idbd6f5aaef605ca51b20e667505d686de5ac781f (cherry picked from commit da320ac6ab53395ddff3cc08b88a61f977ed939a)
* | | | Call libvintf to verify package compatibility. am: da320ac6abTao Bao2017-04-201-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | am: 34ae4d02ce Change-Id: I96580281c3d898b382e9870f3dbc8db218114e27
| * | | Call libvintf to verify package compatibility.Tao Bao2017-04-201-0/+3
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | am: da320ac6ab Change-Id: I5749ac56a8eed8c3ce8420360643a4cfe8d52bc7
| | * | | Call libvintf to verify package compatibility.Tao Bao2017-04-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libvintf API has landed. Hook up to do the actual verification. Bug: 36597505 Test: recovery_component_test Test: m recoveryimage; adb sideload on angler and sailfish, with packages that contain dummy compatibility entries. Test: m recoveryimage; adb sideload on angler and sailfish, with packages that don't contain any compatibility entries. Change-Id: Idbd6f5aaef605ca51b20e667505d686de5ac781f
| | * | | Add tests for update_binary_command().Tao Bao2017-04-192-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose update_binary_command() through private/install.h for testing purpose. Also make minor clean-ups to install.cpp: a) adding more verbose logging on ExtractToMemory failures; b) update_binary_command() taking std::string instead of const char*; c) moving a few macro and global constants into update_binary_command(). Bug: 37300957 Test: recovery_component_test on marlin Test: Build new recovery and adb sideload on angler and sailfish. Change-Id: Ib2d9068af3fee038f01c90940ccaeb0a7da374fc Merged-In: Ib2d9068af3fee038f01c90940ccaeb0a7da374fc (cherry picked from commit bc4b1fe4c4305ebf0fbfc891b9b508c14b5c8ef8)
* | | | | Merge "Add tests for read_metadata_from_package()." am: e888d45950 am: c08c055ce0 am: 7b9b77f445Tao Bao2017-04-191-0/+50
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 67045afa85 Change-Id: I449c52d75ee821293e57878eda5b95782912d429
| * | | | Merge "Add tests for read_metadata_from_package()." am: e888d45950 am: c08c055ce0Tao Bao2017-04-191-0/+50
| |\ \ \ \ | | | |/ / | | |/| | | | | | | | | | | | | | | | | am: 7b9b77f445 Change-Id: I9e3563e052ce1b993981af29c8af9fd4ab4f3516
| | * | | Add tests for read_metadata_from_package().Tao Bao2017-04-191-0/+50
| | | |/ | | |/| | | | | | | | | | | | | Test: recovery_component_test Change-Id: I672a6a4f101c72e82b9f25f165dccd1c9520627b
* | | | Merge "Add tests for update_binary_command()." am: 44f61b4ce5 am: 1fc109bdc7 am: d218dca8f9Tao Bao2017-04-192-0/+91
|\| | | | | | | | | | | | | | | | | | | | | | | am: c6bb44e9bf Change-Id: I42f53d3d48caf913fa8d4ba2eba475e20c8b65f9
| * | | Merge "Add tests for update_binary_command()." am: 44f61b4ce5 am: 1fc109bdc7Tao Bao2017-04-192-0/+91
| |\| | | | | | | | | | | | | | | | | | | | | | am: d218dca8f9 Change-Id: Ib8520d3249f3c131be5008324c52e4b94cf8426d
| | * | Add tests for update_binary_command().Tao Bao2017-04-182-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose update_binary_command() through private/install.h for testing purpose. Also make minor clean-ups to install.cpp: a) adding more verbose logging on ExtractToMemory failures; b) update_binary_command() taking std::string instead of const char*; c) moving a few macro and global constants into update_binary_command(). Bug: 37300957 Test: recovery_component_test on marlin Test: Build new recovery and adb sideload on angler and sailfish. Change-Id: Ib2d9068af3fee038f01c90940ccaeb0a7da374fc
| | * | Verify the package compatibility with libvintf.Tao Bao2017-04-132-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | verify_package_compatibility() is added to parse the compatibility entry (compatibility.zip) in a given OTA package. If entry is present, the information is sent to libvintf to check the compatibility. This CL doesn't actually call libvintf, since the API there is not available yet. Bug: 36597505 Test: Doesn't break the install with existing packages (i.e. w/o the compatibility entry). Test: recovery_component_test Change-Id: I3903ffa5f6ba33a5c0d761602ade6290c6752596 (cherry picked from commit 62e0bc7586077b3bde82759fb34b51b982cea20f)
* | | | Verify the package compatibility with libvintf. am: 62e0bc7586Tao Bao2017-04-132-1/+59
|\| | | | | | | | | | | | | | | | | | | | | | | am: 33ebf7bea4 Change-Id: I9799279177b4b0c98b6a198a7544da224cda72b0
| * | | Verify the package compatibility with libvintf.Tao Bao2017-04-132-1/+59
| |\ \ \ | | | |/ | | |/| | | | | | | | | | | | | am: 62e0bc7586 Change-Id: I35383abfd52766070df0de00013ec743dea190c7
| | * | Verify the package compatibility with libvintf.Tao Bao2017-04-122-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | verify_package_compatibility() is added to parse the compatibility entry (compatibility.zip) in a given OTA package. If entry is present, the information is sent to libvintf to check the compatibility. This CL doesn't actually call libvintf, since the API there is not available yet. Bug: 36597505 Test: Doesn't break the install with existing packages (i.e. w/o the compatibility entry). Test: recovery_component_test Change-Id: I3903ffa5f6ba33a5c0d761602ade6290c6752596
| | * | Merge "Add the missing sr-Latn into png files and rename the png locale header" am: 713d915636 am: dc235b5ab9Tianjie Xu2017-03-291-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 5ec12126f0 Change-Id: Ia6b861c91958d3be23a4a7456d6d5d8e4a1607c8 (cherry picked from commit 9166f66eee883d6d6cc280a6c355e5528bb4a3f0)
* | | | Merge "Abort the update if there's not enough new data" am: b4b0c49c48 am: bc66528cb9 am: 955c5ebeceTianjie Xu2017-04-101-0/+66
|\| | | | | | | | | | | | | | | | | | | | | | | am: 3bd7aaf871 Change-Id: I015ba8d71c6aea95647b01b4c61a7c28d153fbda
| * | | Merge "Abort the update if there's not enough new data" am: b4b0c49c48 am: bc66528cb9Tianjie Xu2017-04-101-0/+66
| |\ \ \ | | | |/ | | |/| | | | | | | | | | | | | am: 955c5ebece Change-Id: I65b6699cc653192b3b8cbcb88093abd1a0e44ba1
| | * | 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
* | | | Merge "tests: Use get_bootloader_message_blk_device() to find /misc." am: 3cd630a5a8 am: cc630bdde1 am: f25cd871ccTao Bao2017-04-053-49/+4
|\| | | | | | | | | | | | | | | | | | | | | | | am: 8ce8affee8 Change-Id: I6501442dc37ef8db52a0bcd75c0475636f157d52
| * | | Merge "tests: Use get_bootloader_message_blk_device() to find /misc." am: 3cd630a5a8 am: cc630bdde1Tao Bao2017-04-053-49/+4
| |\| | | | | | | | | | | | | | | | | | | | | | am: f25cd871cc Change-Id: I7ee75869ea3b80548c25e5f96d0906c1e8d88862
| | * | tests: Use get_bootloader_message_blk_device() to find /misc.Tao Bao2017-04-053-49/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit fb00d82f32446804f7149bc6846dcc580cf0db1d has added get_bootloader_message_blk_device() as an API, switch the tests-local implementation to it. Test: recovery_component_test on angler. Test: recovery_component_test on a local build that doesn't have /misc. Change-Id: I4f5f542cb9ef58292c587a677da73d8822db7262
* | | | Merge "Change the internal representation in RangeSet." am: 7ffa8be41d am: 2e12242b7a am: 7f4e5d55f4Tao Bao2017-04-051-6/+34
|\| | | | | | | | | | | | | | | | | | | | | | | am: b126a2cd9a Change-Id: Iabb1641aec17d535d740ae1275351e7befdf1432
| * | | Merge "Change the internal representation in RangeSet." am: 7ffa8be41d am: 2e12242b7aTao Bao2017-04-041-6/+34
| |\| | | | | | | | | | | | | | | | | | | | | | am: 7f4e5d55f4 Change-Id: Ie48c858013808b1ccbe19b68e236b6bf18471da8
| | * | Change the internal representation in RangeSet.Tao Bao2017-04-031-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL makes the following changes to RangeSet: - Uses std::pair<size_t, size_t> to represent a Range; - Uses std::vector<Range> to represent a RangeSet; - Provides const iterators (forward and reverse); - Provides const accessor; - 'blocks()' returns the number of blocks (formerly 'size'); - 'size()' returns the number of Range's (formerly 'count'). Test: recovery_unit_test Test: Apply an incremental update with the new updater. Change-Id: Ia1fbb343370a152e1f7aa050cf914c2da09b1396
* | | | Merge "Move parse_range() and range_overlaps() into RangeSet." am: 8fab8f97b7 am: 74c4da4c01 am: 3cf1113021Tao Bao2017-03-312-0/+86
|\| | | | | | | | | | | | | | | | | | | | | | | am: 1980075fa9 Change-Id: Ife54e7b7235c4f81c8f01d8c5554cd278b350c6e
| * | | Merge "Move parse_range() and range_overlaps() into RangeSet." am: 8fab8f97b7 am: 74c4da4c01Tao Bao2017-03-312-0/+86
| |\| | | | | | | | | | | | | | | | | | | | | | am: 3cf1113021 Change-Id: I297d6d7d5bb266cddc11e76216e064ea3ad1529e
| | * | Move parse_range() and range_overlaps() into RangeSet.Tao Bao2017-03-312-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also move RangeSet into a header file to make it testable, and add unit tests. In RangeSet::Parse() (the former parse_range()), use libbase logging to do assertions. This has the same effect as the previous exit(EXIT_FAILURE) to terminate the updater process and abort an update. The difference lies in the exit status code (i.e. WEXITSTATUS(status) in install.cpp), which changes from 1 (i.e. EXIT_FAILURE) to 0. Test: recovery_unit_test Test: Apply an incremental update with the new updater. Change-Id: Ie8393c78b0d8ae0fd5f0ca0646d871308d71fff0
* | | | Merge "tests: Remove LOCAL_ADDITIONAL_DEPENDENCIES." am: 3f0a3a2b1d am: b648a8781f am: 4d6f904a88Tao Bao2017-03-301-4/+0
|\| | | | | | | | | | | | | | | | | | | | | | | am: 25546af375 Change-Id: Ibe08bac8d4197947db6535ea5900a30c416fe0c5
| * | | Merge "tests: Remove LOCAL_ADDITIONAL_DEPENDENCIES." am: 3f0a3a2b1d am: b648a8781fTao Bao2017-03-301-4/+0
| |\| | | | | | | | | | | | | | | | | | | | | | am: 4d6f904a88 Change-Id: Ib0e503efca67d3abcb964c5c9cc6bf6c60d0a0fc
| | * | tests: Remove LOCAL_ADDITIONAL_DEPENDENCIES.Tao Bao2017-03-301-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per the comment in build/make/core/base_rules.mk: Ninja has an implicit dependency on the command being run, and kati will regenerate the ninja manifest if any read makefile changes, so there is no need to have dependencies on makefiles. Test: mmma bootable/recovery Change-Id: I27b97df10d40f39ad966be70b33811175a665439
* | | | Merge "Add test config to minadbd_test" am: df1a585504 am: b8f33fdf5f am: 57bb313b1eDan Shi2017-03-302-0/+33
|\| | | | | | | | | | | | | | | | | | | | | | | am: c0e6475f68 Change-Id: Iaba7e4e7e62b4e735fd5b71531a2a36bab11428d
| * | | Merge "Add test config to minadbd_test" am: df1a585504 am: b8f33fdf5fDan Shi2017-03-302-0/+33
| |\| | | | | | | | | | | | | | | | | | | | | | am: 57bb313b1e Change-Id: I3e9aaedf23d1f3bfbeac9c7afee97993fa14422e
| | * | Merge "Add test config to minadbd_test"Treehugger Robot2017-03-302-0/+33
| | |\ \
| | | * | Add test config to minadbd_testDan Shi2017-03-292-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Design doc: Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo Details about test configs changes are tracked in doc https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit# Bug: 35882476 Test: local test Change-Id: I51e1b410536469d254ae7a353bc61a7df06c8324
* | | | | Fix the bad merge (duplicate tests).Tao Bao2017-03-291-45/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Test: mmma bootable/recovery Change-Id: I909164fed84fb17a7e1cb2427cb88208a69dc052
* | | | | resolve merge conflicts of 39ef2d7f to oc-dev-plus-aospTao Bao2017-03-291-0/+45
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 8fdce9ab99 Change-Id: Ifcd2c3236d337216adabb5bb810befd33f05f44c
| * | | | resolve merge conflicts of 39ef2d7f to oc-dev-plus-aospTao Bao2017-03-293-3/+46
| |\| | | | | | | | | | | | | | | | | | | | | | | Test: I solemnly swear I tested this conflict resolution. Change-Id: I59d27cec1ef2c6befe824848cdc9ef3b0a0dc586
| | * | | Merge "tests: Construct two bad packages at runtime for VerifierTest."Tao Bao2017-03-293-3/+46
| | |\ \ \
| | | * | | tests: Construct two bad packages at runtime for VerifierTest.Tao Bao2017-03-283-3/+46
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the BadPackage tests from VerifierTest: one alters the footer, and the other alters the metadata. Move the two tests to be based on otasigned_v3.zip (they're based on otasigned_v1.zip previously). Also construct the testdata files dynamically (to save the space and for better readability). Test: recovery_component_test Change-Id: I7604d563f8b4fa0c55fec8730c063384158e3abc
* | | | | Merge "tests: Add a test for --wipe_ab into UncryptTest." am: 7b0cda5b37 am: c6df7d2937 am: 62a4e5ca98Tao Bao2017-03-291-103/+82
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 20e4e73caa Change-Id: Ib58d2e7843c6cbe75695b83651e3dcd2f9d94f9a
| * | | | Merge "tests: Add a test for --wipe_ab into UncryptTest." am: 7b0cda5b37 am: c6df7d2937Tao Bao2017-03-291-103/+82
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 62a4e5ca98 Change-Id: I87b66da50364c0effdfdd5dbe8a7d0496152e68b
| | * | | Merge "tests: Add a test for --wipe_ab into UncryptTest."Tao Bao2017-03-291-103/+82
| | |\ \ \
| | | * | | tests: Add a test for --wipe_ab into UncryptTest.Tao Bao2017-03-281-103/+82
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also factor out the common parts in {setup,clear}_bcb into a separate function. Test: recovery_component_test Change-Id: I7b95cced925c8135e020dcb791ca2425d4f28449
* | | | | Merge "tests: Construct two bad packages at runtime for VerifierTest."Tao Bao2017-03-283-3/+46
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | tests: Construct two bad packages at runtime for VerifierTest.Tao Bao2017-03-283-3/+46
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the BadPackage tests from VerifierTest: one alters the footer, and the other alters the metadata. Move the two tests to be based on otasigned_v3.zip (they're based on otasigned_v1.zip previously). Also construct the testdata files dynamically (to save the space and for better readability). Test: recovery_component_test Change-Id: I7604d563f8b4fa0c55fec8730c063384158e3abc (cherry picked from commit 217d9f98595076f344746bffdafb4314191f3e1b)
* | | | Merge "Add the missing sr-Latn into png files and rename the png locale header" am: 713d915636 am: dc235b5ab9Tianjie Xu2017-03-281-10/+11
|\ \ \ \ | | |/ / | |/| | | | | | | | | | | | | | am: 5ec12126f0 Change-Id: Ia6b861c91958d3be23a4a7456d6d5d8e4a1607c8
| * | | Merge "Add the missing sr-Latn into png files and rename the png locale header"Tianjie Xu2017-03-281-10/+11
| |\ \ \
| | * | | Add the missing sr-Latn into png files and rename the png locale headerTianjie Xu2017-03-251-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch the locale header in the png files from Locale.toString() to Locale.toLanguageTag(). For example, en_US --> en-us and sr__#Latn --> sr-Latn. Also clean up recovery a bit to expect the new locale format. Bug: 35215015 Test: sr-Latn shows correctly under graphic tests && recovery tests pass Change-Id: Ic62bab7756cdc6e5f98f26076f7c2dd046f811db
* | | | | Merge changes from topic 'sinkfn' am: 34df98ee6d am: 862b7e8523Tao Bao2017-03-281-56/+24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: a2015e0d86 Change-Id: I55bd4c762033cbfd68b019c3fad861ff9b954450
| * | | | applypatch: Let Apply{BSDiff,Image}Patch accept std::function.Tao Bao2017-03-281-56/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test: mmma bootable/recovery system/update_engine Test: recovery_component_test Change-Id: I93c2caa87bf94a53509bb37f98f2c02bcadb6f5c
* | | | | applypatch: Change the ssize_t length parameters to size_t. am: f7eb760fe7 am: d4d9ef3941Tao Bao2017-03-281-1/+1
|\| | | | | |_|/ / |/| | | | | | | | | | | | | | | am: 52569ce2ed Change-Id: Ifeeb537d59d93acac445a0c748e4180a9704fcfb
| * | | applypatch: Change the ssize_t length parameters to size_t.Tao Bao2017-03-281-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly for applypatch family APIs like ApplyBSDiffPatch() and ApplyImagePatch(). Changing to size_t doesn't indicate they would necessarily work with very large size_t (e.g. > ssize_t), just similar to write(2). But otherwise accepting negative length doesn't make much sense. Also change the return type of SinkFn from ssize_t to size_t. Callers tell a successful sink by comparing the number of written bytes against the desired value. Negative return values like -1 are not needed. This also makes it consistent with bsdiff::bspatch interface. Test: recovery_component_test Test: Apply an incremental with the new updater. Change-Id: I7ff1615203a5c9854134f75d019e266f4ea6e714
* | | tests: Construct signature-boundary.zip at runtime.Tao Bao2017-03-272-2/+18
| | | | | | | | | | | | | | | | | | Test: Observe the same failure with recovery_component_test ("signature start: 65535 is larger than comment size: 0"). Change-Id: I98c357b5df2fa4caa9d8eed63af2e945ed99f18a
* | | Merge "applypatch: Drop the support for patching non-EMMC targets." am: b4c4f8c494 am: 351f69e64aTao Bao2017-03-261-124/+0
|\| | | | | | | | | | | | | | | | | am: dcbabd5932 Change-Id: Ia8ff537f0c503fec5602ae6ad6677c8b427d0806
| * | Merge "applypatch: Drop the support for patching non-EMMC targets."Tao Bao2017-03-261-124/+0
| |\ \ | | |/ | |/|
| | * applypatch: Drop the support for patching non-EMMC targets.Tao Bao2017-03-161-124/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patching regular files is used in file-based OTA only, which has become obsolete. Bug: 35853185 Test: Apply an incremental that patches the boot.img. Test: /system/bin/install-recovery.sh works. Test: recovery_component_test passes. Change-Id: Id44e42c4bc63f2162ecc8a6df1cb528b7ae6b0a9
* | | Merge "updater: Fix the broken case for apply_patch_check()." am: 9f2062657d am: 923d41ccd5Tao Bao2017-03-231-0/+49
|\| | | | | | | | | | | | | | | | | am: 47ee8fa42a Change-Id: I24a2b7776779a61f786fae0cbe5dd9569250ff7b
| * | 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
* | | Merge "Remove malloc in edify functions" am: 1ea869b0c6 am: 137d85333eTianjie Xu2017-03-232-3/+5
|\| | | | | | | | | | | | | | | | | am: eb0623b14b Change-Id: I7c48105d9259b1713e8be5fb2c50ef8d6a92c993
| * | Remove malloc in edify functionsTianjie Xu2017-03-222-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | And switch them to std::vector & std::unique_ptr Bug: 32117870 Test: recovery tests passed on sailfish Change-Id: I5a45951c4bdf895be311d6d760e52e7a1b0798c3
* | | Merge "Refactor asn1_decoder functions into a class." am: ea3d0b923d am: d7846b7303Tao Bao2017-03-221-217/+180
|\| | | | | | | | | | | | | | | | | am: 6e30101834 Change-Id: I4ac855fe7b33e4b1141c601045ecf79a681c60cf
| * | Refactor asn1_decoder functions into a class.Tao Bao2017-03-211-217/+180
| | | | | | | | | | | | | | | | | | | | | Test: mmma bootable/recovery Test: recovery_unit_test passes. Test: recovery_component_test passes. Change-Id: If0bf25993158eaebeedff55ba4f4dd0f6e5f937d
* | | Merge "verify_file: Add constness to a few addresses." am: 5b2bf90e13 am: 43bd2c8414Tao Bao2017-03-211-14/+14
|\| | | | | | | | | | | | | | | | | am: 1c456cd3a5 Change-Id: I6d423a2fe19727e0d41b083a4020be30ae9400fb
| * | verify_file: Add constness to a few addresses.Tao Bao2017-03-211-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should not touch any data while verifying packages (or parsing the in-memory ASN.1 structures). Test: mmma bootable/recovery Test: recovery_component_test passes. Test: recovery_unit_test passes. Change-Id: Ie990662c6451ec066a1807b3081c9296afbdb0bf
* | | Merge "Add testcases for load_keys()." am: 110102f37e am: 43f5ad6e90Tao Bao2017-03-201-0/+57
|\| | | | | | | | | | | | | | | | | am: 60ea643afb Change-Id: I2246094d0db184726cae34d7b916c127512ad6d2
| * | Merge "Add testcases for load_keys()."Tao Bao2017-03-201-0/+57
| |\ \
| | * | Add testcases for load_keys().Tao Bao2017-03-181-0/+57
| | | | | | | | | | | | | | | | | | | | Test: recovery_component_test passes. Change-Id: I6276b59981c87c50736d69d4af7647c8ed892965
* | | | Merge "Remove the dead #include's in verifier.cpp." am: 64d25024b9 am: b2617e882eTao Bao2017-03-201-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | am: cc3f3c3d1c Change-Id: Ib78b586044938d9ec41cabfb07e8a274cc7d4d73
| * | | Remove the dead #include's in verifier.cpp.Tao Bao2017-03-181-1/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | A follow-up to commit 5e535014dd7961fbf812abeaa27f3339775031f1. Also clean up Android.mk, since libverifier no longer needs anything from libminui. Test: mmma bootable/recovery Test: recovery_component_test passes. Change-Id: I1c11e4bbeef67ca34a2054debf1f5b280d509217
| * | Merge "Drop the dependency on 'ui' in verify_file()."Tao Bao2017-03-181-104/+45
| |\ \
| | * | Drop the dependency on 'ui' in verify_file().Tao Bao2017-03-171-104/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | verify_file() has a dependency on the global variable of 'ui' for posting the verification progress, which requires the users of libverifier to provide a UI instance. This CL adds an optional argument to verify_file() so that it can post the progress through the provided callback function. As a result, we can drop the MockUI class in verifier_test.cpp. Test: recovery_component_test passes. Test: verify_file() posts progress update when installing an OTA. Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1
* | | | Merge "Drop the dependency on 'ui' in verify_file()."Tao Bao2017-03-181-105/+46
|\ \ \ \
| * | | | Drop the dependency on 'ui' in verify_file().Tao Bao2017-03-171-105/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | verify_file() has a dependency on the global variable of 'ui' for posting the verification progress, which requires the users of libverifier to provide a UI instance. This CL adds an optional argument to verify_file() so that it can post the progress through the provided callback function. As a result, we can drop the MockUI class in verifier_test.cpp. Test: recovery_component_test passes. Test: verify_file() posts progress update when installing an OTA. Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1 (cherry picked from commit 5e535014dd7961fbf812abeaa27f3339775031f1)
* | | | | Merge "Add a test to perform block_image_update" am: 881b08ecd2 am: 5c06706d51Tianjie Xu2017-03-172-6/+123
|\ \ \ \ \ | | |/ / / | |/| | | | | | | | | | | | | | | | | | am: 640fc1d338 Change-Id: If611a8023bb5411ac2a1063411d0030121ce0de2
| * | | | Merge "Add a test to perform block_image_update"Tianjie Xu2017-03-172-6/+123
| |\ \ \ \ | | |_|/ / | |/| | |
| | * | | Add a test to perform block_image_updateTianjie Xu2017-03-172-6/+123
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "More cleanup to imgdiff & imgpatch" am: 3541934ff5 am: 91f8574061Tianjie Xu2017-03-171-4/+5
|\| | | | |_|/ |/| | | | | | | | | | | am: dda128abbf Change-Id: I4369d91759d40a1fb261766fb5b1e6aa0ecb36c4
| * | More cleanup to imgdiff & imgpatchTianjie Xu2017-03-161-4/+5
| |/ | | | | | | | | | | | | | | Also remove the utils in applypatch and replace them with the corresponding libbase functions. Test: recovery tests pass. Change-Id: I77254c141bd3e7d3d6894c23b60e866009516f81
* | Merge "updater: Remove some obsoleted functions for file-based OTA." am: 342717d148 am: 000f364c19Tao Bao2017-03-141-113/+0
|\| | | | | | | | | | | am: 1fc6e95672 Change-Id: I3e01f0bbcbe9233b2c0ed8088fc3cf1781a4baf3
| * 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
* | Merge "recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs" am: 7a0dfec771 am: 1a23257214Bowgo Tsai2017-03-101-12/+5
|\| | | | | | | | | | | am: 1a76f4a3bc Change-Id: I8869ddf69589c2a1bb0e8dd493df67f9126db585
| * recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIsBowgo Tsai2017-03-101-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fstab settings of early-mounted partitions (e.g., /vendor) will be in kernel device tree. Switch to the new API to get the whole settings with those in device tree: fs_mgr_read_fstab_with_dt("/etc/recovery.fstab") The original default /fstab.{ro.hardware} might be moved to /vendor/etc/. or /odm/etc/. Use another new API to get the default fstab instead of using the hard-coded /fstab.{ro.hardware}. This API also includes the settings from device tree: fs_mgr_read_fstab_default() Bug: 35811655 Test: boot sailfish recovery Change-Id: Iaa56ac7f7b4c4dfc7180c65f03e9a37b94f1de09
* | Merge "Refractor the code for imgdiff" am: a2e7a07031 am: 68571e27d8Tianjie Xu2017-03-072-0/+57
|\| | | | | | | | | | | am: 36ee8dd262 Change-Id: I8ce462fa0d6c9ea601e1e3d3c9386cc3fcaa7972
| * Merge "Refractor the code for imgdiff"Treehugger Robot2017-03-072-0/+57
| |\
| | * Refractor the code for imgdiffTianjie Xu2017-03-072-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Put ImageChunk and some helper functions into a class. Also switch to using std::vector instead of malloc. Bug: 18606652 Test: imgdiff_test passed on host. Also generate a complete incremental OTA package. The file content is the same and time consumption is similar. Change-Id: Id603ada4e130ef521218400761a119001a86ca79
* | | Merge "Fix an error on bootloadermessager test teardown" am: b694ba8aab am: 536989892cTianjie Xu2017-03-031-2/+4
|\| | | | | | | | | | | | | | | | | am: b2dfc0182a Change-Id: Ie4ee06310e7ea9c36e5323f4990f71f2f8fb771e
| * | Merge "Fix an error on bootloadermessager test teardown"Tianjie Xu2017-03-031-2/+4
| |\ \
| | * | Fix an error on bootloadermessager test teardownTianjie Xu2017-03-031-2/+4
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | The test should not clear bcb during teardown on devices without /misc. Bug: 35712836 Test: The test tears down without errors after /misc removed from the fstab. Change-Id: I42df89feb18fac5a435cd17eef97a6bad0f44545
* | | Merge "Recovery Test: add SideloadTest to test FUSE support on target" am: 53feebea4f am: 3d605c54e3Wei Wang2017-03-032-0/+22
|\| | | | | | | | | | | | | | | | | am: 685391c5e9 Change-Id: I656a9c7f1e4880bb00e7aaad7f9e55104a7096a7
| * | Recovery Test: add SideloadTest to test FUSE support on targetWei Wang2017-03-032-0/+22
| |/ | | | | | | | | | | | | | | | | | | FUSE FS is required in recovery sideload functionalites. This CL is to add a native test to flag when FUSE is not supported in the device kernel. Bug: 35768196 Test: mma, run recovery_component_test on marlin and pass all Change-Id: I43b6dbee658010df56ba4d4b0e91baa7fd1c4480
* | Merge "Skip BootloaderMessageTest, UncryptTest for devices without /misc" am: 0f26468eda am: 5cce91a95aTianjie Xu2017-03-013-3/+111
|\| | | | | | | | | | | am: 6b0959a6bb Change-Id: I1dc478edd656d4a20b4b886570d8ff822fe5e29e
| * Skip BootloaderMessageTest, UncryptTest for devices without /miscTianjie Xu2017-03-013-3/+111
| | | | | | | | | | | | | | | | Skip these two tests if /misc partition is not found in fstab. Bug: 35712836 Test: Both test skip correctly if there's no /misc in fstab.${hardware}. Change-Id: I38417a8677030229a335e43eaef85ae70c4e0845
* | Merge "Use bspatch from external/bsdiff." am: f9962dbfe2 am: 2c467f6e49 am: 6f06890343Sen Jiang2017-02-161-0/+2
|\| | | | | | | | | | | am: 05087fb83d Change-Id: Ifafcedf27aa9394a307fca854c491891191cce04
| * Use bspatch from external/bsdiff.Sen Jiang2017-02-021-0/+2
| | | | | | | | | | | | | | | | | | | | Now ApplyBSDiffPatch() will stream the output to sink as we go instead of sinking everything at the end. Test: recovery_host_test Bug: 26982501 Change-Id: I05b6ed40d45e4b1b19ae72784cf705b731b976e3
* | Merge "Remove '_static' suffix from libext2* references." am: 56ff8061b1 am: 5b5b8333e0 am: 9518d34c0fAlex Deymo2017-01-261-1/+1
|\| | | | | | | | | | | am: ade61afd29 Change-Id: I8e5a22261264f0fd5506e9916a37e1af20261645
| * Remove '_static' suffix from libext2* references.Alex Deymo2017-01-241-1/+1
| | | | | | | | | | | | Bug: 34220783 Test: make checkbuild Change-Id: Iceea20e440a4bb6a3b254486a65a86401a2241ef
* | Merge "Add checkers and tests for empty locale in PNG file" am: 69e73ab7a9 am: a38224eadb am: 18098b7de3Tianjie Xu2017-01-193-2/+167
|\| | | | | | | | | | | am: 98cf72d3aa Change-Id: I1fb6b0898d347ca1187241e495fe28b260c6d905
| * Add checkers and tests for empty locale in PNG fileTianjie Xu2017-01-193-2/+167
| | | | | | | | | | | | | | | | | | | | | | match_locale() will return false for empty locale string in the PNG file. Also add a manual test to validate if a PNG file is qualified to use under recovery. Bug: 34054052 Test: recovery_manual_test catches invalid PNG files successfully & Locale_test passed Change-Id: Id7e2136e1d8abf20da15825aa7901effbced8b03
* | Remove "_static" suffix from libsparse am: 67f3aa8804 am: 204369ef1a am: 9e93a79f4cAlex Deymo2017-01-121-1/+1
|\| | | | | | | | | | | am: 3cbb199e24 Change-Id: Ia2447e399bd979402b535e8d7228ab0dad106d78
| * Remove "_static" suffix from libsparseAlex Deymo2017-01-111-1/+1
| | | | | | | | | | | | Bug: 34220783 Change-Id: I358f931f0b29f5bd526e1475180e477e2e90b936
* | Remove "_static" suffix from libext4_utils. am: 31653660ad am: 4b54093899 am: 9edd655f94Alex Deymo2017-01-121-1/+1
|\| | | | | | | | | | | am: 68b7f08b96 Change-Id: Ia98ed0b8e0d50c2256dcacb1a5240e98c68f4adb
| * Remove "_static" suffix from libext4_utils.Alex Deymo2017-01-111-1/+1
| | | | | | | | | | Bug: 34220783 Change-Id: I34ccc3b11da0d1b48805967ad75b9ddade569930
* | Merge "tests: Add testcase for show_progress() and set_progress()." am: 478a5ec9c7 am: 179fc8a82b am: ba0dad8828Tao Bao2017-01-061-0/+50
|\| | | | | | | | | | | am: 485b94f14d Change-Id: I437572556bcbf8110a8d6d7ea00442675297822e
| * tests: Add testcase for show_progress() and set_progress().Tao Bao2017-01-061-0/+50
| | | | | | | | | | Test: recovery_component_test passes. Change-Id: I4f00d0171cf86699e9ce747d07d7d44a01906e81
* | Merge "imgdiff: Fix an edge case that leads to infinite loop." am: 3b828d879b am: 4d37763c69 am: e513c0f2acTao Bao2017-01-041-0/+80
|\| | | | | | | | | | | am: bcde135fce Change-Id: I91af040f28085b4ab07fe191bee03b50c4c3ffce
| * Merge "imgdiff: Fix an edge case that leads to infinite loop."Tao Bao2017-01-041-0/+80
| |\
| | * imgdiff: Fix an edge case that leads to infinite loop.Tao Bao2016-12-281-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the input image ends with the magic value sequence of 0x1f, 0x8b, 0x0b (optionally with 0x00), the image parsing code will be stuck in an infinite loop. Test: recovery_component_test passes. Change-Id: Ie3629dfdc41360387b19cc3e0359c95ae4fb998e
* | | Merge "recovery: Fix the broken UI text." am: 56fc8fa376 am: 1227f6b841 am: 3806993e25Tao Bao2017-01-041-32/+38
|\| | | | | | | | | | | | | | | | | am: 74e0ecb25b Change-Id: If03ce22edaee2cf9aa38f3ea90ee992cd06695c3
| * | recovery: Fix the broken UI text.Tao Bao2017-01-041-32/+38
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | UI text is broken (doesn't show any text during FDR) due to commit d530449e54bd327e9c26209ffa0490c6508afe6c, which reordered the calls to RecoveryUI::SetLocale() and RecoveryUI::Init(). Because Init() uses the locale info to load the localized texts (from images), the locale must be set prior to that via SetLocale(). This CL refactors Init() to take the locale parameter, and removes the odd SetLocale() API. Bug: 34029338 Test: 'Run graphics test' under recovery. Change-Id: I620394a3d4e3705e9af5a1f6299285d143ae1b01
* | Merge "Add tests for imgdiff." am: 344c8eb453 am: 4fe022c4ed am: 4e2471d6ddTao Bao2016-12-282-0/+477
|\| | | | | | | | | | | am: e6c1d578bd Change-Id: If99c2af21db684d3874649144f0d1ff780474616
| * Merge "Add tests for imgdiff."Tao Bao2016-12-282-0/+477
| |\
| | * Add tests for imgdiff.Tao Bao2016-12-202-0/+477
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out libimgdiff static library for testing purpose. This CL adds the imgdiff tests on host and on target both (similar to libimgpatch). In practice, we only need imgdiff binary on host, and libimgpatch on target. But they should build and pass tests on both platforms. Test: recovery_host_test passes; recovery_component_test passes. Change-Id: I0eafb7faf727cdf70066310e845af6ee245d4f60
* | | Merge "tests: Add test coverage for DirUtil." am: f24d2a6b39 am: 1b83e7e28d am: 7f0f49dd2bTao Bao2016-12-232-0/+151
|\| | | | | | | | | | | | | | | | | am: f9d1e205eb Change-Id: I2ad7e507c25edeba24e80a3d74f3f3d7352e76c5
| * | tests: Add test coverage for DirUtil.Tao Bao2016-12-222-0/+151
| | | | | | | | | | | | | | | Test: recovery_unit_test passes. Change-Id: I764c56404c7ccdd57ae5486c946fbc9ac6ae7bc9
* | | Merge "tests: Replace the O_RDONLY in access(2)." am: 3b9645288e am: baf422229d am: ef801f9a62Tao Bao2016-12-222-8/+16
|\| | | | | | | | | | | | | | | | | am: 5a108b6e00 Change-Id: Ieae405488b3426364626be481ad2f5a5de5e4618
| * | Merge "tests: Replace the O_RDONLY in access(2)."Tao Bao2016-12-222-8/+16
| |\ \
| | * | tests: Replace the O_RDONLY in access(2).Tao Bao2016-12-222-8/+16
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although O_RDONLY gives the same value as F_OK (0), it's not the right friend of access(2). Also clean up the temporary files from ZipTest (TemporaryDir doesn't like non-empty directory). Test: recovery_unit_test passes and has no leftover. Change-Id: I66b90e43c0954c89ce08b36b9e2b4e84183b28f5
* | | Merge "tests: Add testcase for ZipUtil." am: aa305e9ce8 am: 6df1c4579e am: 830ab1c482Tao Bao2016-12-222-1/+193
|\| | | | | | | | | | | | | | | | | am: 7720e1ab48 Change-Id: Ia09ba6d6b82a088142a964b8223bb2576d78604c
| * | tests: Add testcase for ZipUtil.Tao Bao2016-12-222-1/+193
| |/ | | | | | | | | Test: recovery_unit_test passes. Change-Id: I8ad364e88aaee31579ed7206aad8e5620518d797
* / Add a checker for signature boundary in verifierTianjie Xu2016-12-172-1/+2
|/ | | | | | | | | | | | | | The 'signature_start' variable marks the location of the signature from the end of a zip archive. And a boundary check is missing where 'signature_start' should be within the EOCD comment field. This causes problems when sideloading a malicious package. Also add a corresponding test. Bug: 31914369 Test: Verification fails correctly when sideloading recovery_test.zip on angler. Change-Id: I6ea96bf04dac5d8d4d6719e678d504f957b4d5c1
* Add update_bootloader_message() to fix two-step OTAs.Tao Bao2016-12-151-0/+26
| | | | | | | | | | | | | | | | | This is a retry of commit 7e31f421a514da09b90e46dbd642a5e9b16e0003. Commit bd56f1590c967205dc45eb2ec298aa8d2aacb740 switches to calling write_bootloader_message(<options>) in get_args(), which unintentionally resets the stage field thus breaks two-step OTAs. This CL adds update_bootloader_message(<options>), which only sets the command field (to "boot-recovery") and the recovery field (with the specified options). Bug: 33534933 Test: Apply a two-step package. Test: recovery_component_test passes. Change-Id: Ie0b1ed4053d2d3c97d9cb84310d616b28fcfc72e
* Merge "tests: Add tests for bootloader_message."Tao Bao2016-12-152-0/+140
|\
| * tests: Add tests for bootloader_message.Tao Bao2016-12-152-0/+140
| | | | | | | | | | Test: recovery_component_test passes. Change-Id: Ib9aa2ffd6b018546223c76b7424f4ba355f5b088
* | Merge "Add a stub recovery UI."Sen Jiang2016-12-141-1/+1
|\ \ | |/ |/|
| * Add a stub recovery UI.Sen Jiang2016-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | This allows recovery to work on devices without screen. The stub recovery UI does nothing except print to stdout. Test: write 'recovery\n--wipe_data\n--reason=wipe_data_from_ota\n' to misc and boot to recovery on a device without screen. Bug: 33175036 Change-Id: Icde698aa2e2e29f4b3d0532dfd3c6a939ac2bc63
* | Add tests for setup-bcb and clear-bcb via uncrypt.Tao Bao2016-12-142-0/+176
|/ | | | | | | | | | Bug: http://b/33534933 Test: recovery_component_test passes (and fails on buggy build due to the CL in [1]). [1]: commit 7e31f421a514da09b90e46dbd642a5e9b16e0003 Change-Id: I120498048ec1db8f9fcbb3cf135c05d3a48cfcdf
* tests: Add testcases for EMMC targets.Tao Bao2016-11-221-31/+144
| | | | | | | | | | | | | There're two types of targets in applypatch: regular files and EMMC targets. We have two sets of functions to handle them respectively. This CL adds testcases to use "EMMC:filename:size:sha1" as the target name, which triggers the code path for patching EMMC targets. Bug: 33034669 Test: recovery_component_test passes. Change-Id: I8f10c6c8d2c1fb083f06a83de91d9e23cb41fb6d
* updater: Refactor set_stage() and get_stage() functions.Tao Bao2016-11-182-0/+61
| | | | | | | | | | | 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-182-0/+98
| | | | | 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-154-20/+86
| | | | | | | | | | | | | | | '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
* Merge "Make make_parent() to take const argument"Treehugger Robot2016-11-081-0/+22
|\
| * 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
* | Move recovery_test.cpp out of unit testTianjie Xu2016-11-083-92/+99
| | | | | | | | | | | | | | | | Move recovery-refresh/persist tests out because these tests need special steps to run. Also switch the constants to std::string. Test: recovery_manual_test passed on an A/B device Change-Id: I60b3ec6f094044945c3aafc1fae540896a6ddea6
* | otautil: Clean up SysUtil.cpp.Tao Bao2016-11-072-6/+147
|/ | | | | | | | | | Add unit testcases for sysMapFile(). Test: recovery_unit_test passes. Test: Build and use the new recovery image to sideload a package. Test: Build and use the new recovery image to install an update. Change-Id: I77d8f1ea151ab513865d992c256ba93a1fcb51a4
* tests: Fix unit/zip_test.cpp.Tao Bao2016-11-041-59/+50
| | | | | | | | | It's accidentally broken when refactoring the testdata path. Also clean up the testcase a bit by simplying the file reading. Test: recovery_unit_test passes. Change-Id: I592a1cf5a4eb9a7a5f4eecbc6426baeedeb02781
* 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
* tests: Set up testdata path for continuous native tests.Tao Bao2016-11-034-31/+23
| | | | | | | | | | | | | | | | | | | | continuous_native_tests expects the testdata under DATA/ in continuous_native_tests.zip. This CL packs a copy of the testdata into continuous_native_tests.zip as DATA/nativetest/recovery/testdata (via LOCAL_PICKUP_FILES). This CL also removes the extra copy for nativetest64. Testdata will always stay at /data/nativetest/recovery/testdata, even for 64-bit version. Otherwise we will unnecessarily get four copies (two for data/ and another two for DATA/). Bug: 32123241 Test: mmma bootable/recovery && adb sync data. On bullhead, /data/nativetest/recovery_component_test/recovery_component_test works; /data/nativetest64/recovery_component_test/recovery_component_test works. Test: m continuous_native_test; DATA/nativetest/recovery/testdata exists. Change-Id: Ifefa0309de7af23c77654e8e450848ca2da218c2
* applypatch: Add testcases for applypatch executable.Tao Bao2016-11-017-257/+324
| | | | | | | | | | | | | | | Refactor applypatch/main.cpp into libapplypatch_modes so that we can add testcases. Some changes to applypatch/main.cpp: - Replace char** argv with const char**; - Use android::base::Split() to split ":"; - Use android::base::ParseUInt(). Bug: 32383590 Test: Unit tests pass, install-recovery.sh works. Change-Id: I44e7bfa5ab717d439ea1d0ee9ddb7b2c40bb95a4
* applypatch: Switch the parameter of Value** to std::vector.Tao Bao2016-10-291-126/+138
| | | | | | Test: Unit tests and install-recovery.sh pass on angler and dragon. Change-Id: I328e6554edca667cf850f5584ebf1ac211e3d4d1
* tests: Generate testdata for 2nd arch.Tao Bao2016-10-261-1/+12
| | | | | | | | | | | | | | We currently only copy the testdata to $(TARGET_OUT_DATA_NATIVE_TESTS)/recovery, which fails the tests generated for 2nd arch (TARGET_2ND_ARCH). For example, on angler /data/nativetest/recovery_component_test/recovery_component_test fails due to missing testdata. Bug: 32123241 Test: Both of /data/nativetest/recovery... and /data/nativetest64/recovery... work on angler. Change-Id: Ib76264b4408d01c08b2619c8ac84b2476ea5a8bc
* Add a unit test for applypatch_checkTianjie Xu2016-10-191-0/+5
| | | | | | | | | If no sha1 is specified, applypatch_check should pass as long as the file content loads successfully. Add a unit case acccordingly. Test: Unit tests passed Bug: 32243751 Change-Id: I8c013be67c197d2935e11cf6acc59fb9b943cfd9
* Replace minzip with libziparchiveTianjie Xu2016-10-185-3/+104
| | | | | | | | | | | Clean up the duplicated codes that handle the zip files in bootable/recovery; and rename the library of the remaining utility functions to libotautil. Test: Update package installed successfully on angler. Bug: 19472796 Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
* Change StringValue to use std::stringTianjie Xu2016-10-153-81/+67
| | | | | | | | | | | 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-132-6/+23
| | | | | | | | | | | | - 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-112-6/+93
| | | | | | | | | 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
* edify: Move State.script and State.errmsg to std::string.Tao Bao2016-10-041-6/+1
| | | | | | | | | | | This way we kill a few strdup() and free() calls. Test: 1. recovery_component_test still passes; 2. Applying an update with the new updater works; 3. The error code in a script with abort("E310: xyz") is recorded into last_install correctly. Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
* Merge "recovery: drop log/logger.h"Mark Salyzyn2016-10-041-1/+0
|\
| * recovery: drop log/logger.hMark Salyzyn2016-10-041-1/+0
| | | | | | | | | | | | | | | | | | | | private/android_logger.h contains all we need. Test: compile Bug: 26552300 Bug: 31289077 Bug: 31456426 Change-Id: I6714d730372dc81f784e7f9dfee8a33848643a5d
* | edify: Move the testcases to gtest.Tao Bao2016-10-042-0/+158
|/ | | | | | | | | | | | | Now they live in tests/component/edify_test.cpp. Also rename edify/main.cpp to edify/edify_parser.cpp. It becomes a host-side debugging tool that validates the input edify script. However, it supports edify builtin functions only and doesn't recognize the ones defined via updater. Test: recovery_component_test passes on device. Change-Id: Ib94a787bf15098a9cc078d256b6a6dc96ff12b2e
* Turn on -Werror for recoveryTianjie Xu2016-09-301-1/+2
| | | | | | | | | | Also remove the 0xff comparison when validating the bootloader message fields. As the fields won't be erased to 0xff after we remove the MTD support. Bug: 28202046 Test: The recovery folder compiles for aosp_x86-eng Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
* Switch recovery to libbase loggingTianjie Xu2016-09-011-2/+3
| | | | | | | | Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
* Fix clang-tidy warnings in bootable/recovery.Chih-Hung Hsieh2016-08-261-1/+1
| | | | | | | | | | | | * Use const reference type for read-only parameters. Bug: 30407689 * Use faster overloaded string find function. Bug: 30411878 * Add parentheses around macro parameters. Bug: 28705665 Test: build with WITH_TIDY=1 Change-Id: I4e8e5748bfa4ae89871f1fb5fa4624d372530d75
* Merge "Fix references to libcrypto_utils_static."Josh Gao2016-08-081-2/+2
|\ | | | | | | | | | | am: b97da5e0f0 Change-Id: Ia935df84e5ea36dfc6605b41872c36db69a114a0
| * Fix references to libcrypto_utils_static.Josh Gao2016-08-061-2/+2
| | | | | | | | | | Bug: http://b/30708454 Change-Id: I7a5048beff1d8b783a9683dcb4a79606a77f20ee
* | Merge \"Clean up verifier testcases.\"Tao Bao2016-08-0121-41/+30
|\| | | | | | | | | | | am: e91aef0ee9 Change-Id: Ia130dc2a7f62ecf1ad40ec03d88a331a31800efa
| * Clean up verifier testcases.Tao Bao2016-08-0121-41/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Certificate is a pair of an RSAPublicKey and a particular hash. So v1 and v3 differ in the hash algorithm (SHA-1 vs SHA-256), similarly for v2 and v4. In verifier testcases, we used to load v1/v2 keys with an explicit argument of "sha256" to test the v3/v4 keys. This CL switches to loading v3/v4 keys directly and lets load_keys() to handle that, which is the actual flow we use in practice. Also remove the "fallback to v1 key" in the testcases, which is not the actual behavior. Bug: 30415901 Test: Run the verifier_test component test on device. Change-Id: I3a2baa64826f1b6c4c367a560090df384c4521bb
* | tests: Remove obsolete MTD support.Tao Bao2016-06-161-1/+0
| | | | | | | | | | | | | | | | Track the change in commit 63a319201fc0f5c34c1c62b446527e06f57f8d40 and fix builds. Bug: http://b/29250988 Change-Id: Iad5be953e102020931649629afc980d585ed2931
* | resolve merge conflicts of 5823dd4 to nyc-dev-plus-aospTianjie Xu2016-05-021-0/+1
|\ \ | | | | | | | | | Change-Id: I4ec33904a6af38d81b422c7be6f40b828fbc7525
| * | Add ability to show "installing security update"Tianjie Xu2016-04-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new command "--security" to boot commands. If this command is observed as part of BCB, choose a different background text picture for installing stage in recovery UI. As a result, users will see "installing security update" instead of "installing system update" when applying a security update package. Bug: 27837319 Change-Id: I2e2253a124993ecc24804fa1ee0b918ac96837c5
* | | Merge "Fix matches_locale function" into nyc-devTianjie Xu2016-04-212-1/+34
|\| | | | | | | | | | | | | | | | | | | | | | | | | | am: 8b86373 * commit '8b86373fd954276b18a6fba81afbe42c9caa49d3': Fix matches_locale function Change-Id: If7726c2f381ba0e4ab0519b77c167e75a9d46104
| * | Fix matches_locale functionTianjie Xu2016-04-202-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | matches_locale was expecting input locale string to have at most one underscore; as a result "zh_CN_#Hans" ignores "zh_CN" and matches into "zh". Fix the match function and add unit tests. Bug: 27837319 Change-Id: I4e8a66f91cae6ac2a46b6bf21f670d5ea564c7c8
| * | Use BoringSSL instead of mincrypt to speed up package verification.Elliott Hughes2016-04-145-109/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Cherry-pick of 452df6d99c81c4eeee3d2c7b2171901e8b7bc54a, with merge conflict resolution, extra logging in verifier.cpp, and an increase in the hash chunk size from 4KiB to 1MiB. Bug: http://b/28135231 Change-Id: I1ed7efd52223dd6f6a4629cad187cbc383d5aa84
| * | recovery: use __android_log_pmsg_file_write for log filesMark Salyzyn2016-03-312-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-pick from commit a4f701af93a5a739f34823cde0c493dfbc63537a) - Add call to __android_log_pmsg_file_write for recovery logging. - Add call to refresh pmsg if we reboot back into recovery and then allow overwrite of those logs. - Add a new one-time executable recovery-refresh that refreshes pmsg in post-fs phase of init. We rely on pmsg eventually scrolling off to age the content after recovery-persist has done its job. - Add a new one-time executable recovery-persist that transfers from pmsg to /data/misc/recovery/ directory if /cache is not mounted in post-fs-data phase of init. - Build and appropriately trigger the above two as required if BOARD_CACHEIMAGE_PARTITION_SIZE is undefined. - Add some simple unit tests NB: Test failure is expected on systems that do not deliver either the recovery-persist or recovery-refresh executables, e.g. systems with /cache. Tests also require a timely reboot sequence of test to truly verify, tests provide guidance on stderr to direct. Bug: 27176738 Change-Id: I17bb95980234984f6b2087fd5941b0a3126b706b
* | | resolve merge conflicts of 2bf95ac to nyc-dev-plus-aospElliott Hughes2016-04-135-109/+27
|\ \ \ | | |/ | |/| | | | Change-Id: Iaf232fbe65879bad6e19c7a9600aa6303a491a67
| * | Convert recovery to use BoringSSL instead of mincrypt.Mattias Nissler2016-04-065-109/+28
| | | | | | | | | | | | | | | | | | | | | This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
* | | Merge "recovery: use __android_log_pmsg_file_write for log files" am: 75da771Mark Salyzyn2016-03-312-0/+94
|\| | | | | | | | | | | | | | | | | | | | | | | | | | am: 6f83130 * commit '6f83130d7acd85df89a80e691d3aa63bd2ceda39': recovery: use __android_log_pmsg_file_write for log files Change-Id: Id2e7a76bae8eb061f6f57249dd912f25cd6332c6
| * | recovery: use __android_log_pmsg_file_write for log filesMark Salyzyn2016-03-282-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add call to __android_log_pmsg_file_write for recovery logging. - Add call to refresh pmsg if we reboot back into recovery and then allow overwrite of those logs. - Add a new one-time executable recovery-refresh that refreshes pmsg in post-fs phase of init. We rely on pmsg eventually scrolling off to age the content after recovery-persist has done its job. - Add a new one-time executable recovery-persist that transfers from pmsg to /data/misc/recovery/ directory if /cache is not mounted in post-fs-data phase of init. - Build and appropriately trigger the above two as required if BOARD_CACHEIMAGE_PARTITION_SIZE is undefined. - Add some simple unit tests NB: Test failure is expected on systems that do not deliver either the recovery-persist or recovery-refresh executables, e.g. systems with /cache. Tests also require a timely reboot sequence of test to truly verify, tests provide guidance on stderr to direct. Bug: 27176738 Change-Id: I17bb95980234984f6b2087fd5941b0a3126b706b
* | | Merge "Port applypatch.sh tests to recovery_component_tests" into nyc-devJed Estep2016-03-127-7/+428
|\ \ \ | |/ / |/| / | |/ | | | | | | am: 761653a4ad * commit '761653a4ad1c392fcd505e8909661fd64f02ce97': Port applypatch.sh tests to recovery_component_tests
| * Port applypatch.sh tests to recovery_component_testsJed Estep2016-03-127-8/+429
| | | | | | | | | | Bug: 27135282 Change-Id: If53682b591397ddfdb84860a3779b612904d4489
| * Fix verifier test base testdata directory after merge conflictJed Estep2016-02-221-1/+1
| | | | | | | | Change-Id: I7ffba0be5a6befc875ce59b51a008c1892e7d34b
* | Merge "verifier_test: Suppress the unused parameter warnings."Tao Bao2016-02-091-8/+9
|\ \
| * | verifier_test: Suppress the unused parameter warnings.Tao Bao2016-02-051-8/+9
| |/ | | | | | | Change-Id: I51fec30114c0a31efc9c2ac8472654baf8bb3e84
* / Change on-device directory for recovery test dataJed Estep2016-02-052-2/+2
|/ | | | | | Test data needs to go outside the gtest module. Change-Id: Ic444ca838cbafa651ec97ff8730129da84fafc09
* Refactor existing tests to use gtestJed Estep2016-02-0422-3/+413
| | | | | Bug: 26962907 Change-Id: I5f80636af1740badeff7d08193f08e23f4e4fee1
* recovery: Switch to clangTao Bao2015-06-031-0/+1
| | | | | | And a few trival fixes to suppress warnings. Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
* More test makefile cleanup.Dan Albert2014-10-171-24/+23
| | | | | | | Global variables kill. No need to manually link gtest, and that causes problems with libc++. Change-Id: If804cdd436cf1addfa9a777708efbc37c27770b6
* Add support for ECDSA signaturesKenny Root2013-10-102-0/+264
This adds support for key version 5 which is an EC key using the NIST P-256 curve parameters. OTAs may be signed with these keys using the ECDSA signature algorithm with SHA-256. Change-Id: Id88672a3deb70681c78d5ea0d739e10f839e4567