Commit graph

3000 commits

Author SHA1 Message Date
Tao Bao
b50fa1fc23 Merge "otautil: Clean up obsolete includes."
am: b80d136dca

Change-Id: I374d678fe6636284d6ab9238418266fac355e14e
2016-11-09 05:39:20 +00:00
Tao Bao
b80d136dca Merge "otautil: Clean up obsolete includes." 2016-11-09 05:32:06 +00:00
Tao Bao
8992902aab updater: Add more testcase for symlink().
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
2016-11-08 21:29:16 -08:00
Tao Bao
14b61e7b96 otautil: Clean up obsolete includes.
external/zlib and external/safe-iop/include were used by Zip.c, which
became obsolete after [1].

Removing
 - <assert.h>: we no longer call assert(3);
 - <limits.h>: we no longer use PATH_MAX;
 - <stdio.h>: we don't need FILE anymore;
 - <stdlib.h>: no more malloc(3)/calloc(3);
 - <unistd.h>: was once needed for lseek(2);
 - <string.h>: no more memset(3).

Adding
 - <stdint.h> for SIZE_MAX.

[1] commit 8cf5c8f60f: "Replace minzip
with libziparchive".

Test: `mmma bootable/recovery`
Change-Id: I349e909ba83d0f6ade5f92856ce3934f29fdca6c
2016-11-08 13:39:12 -08:00
Tianjie Xu
1fd9f0aff7 Merge "Make make_parent() to take const argument"
am: 52e2a97aa7

Change-Id: Ia4d597510cf99ade837a9c6a33b19788b8cf2291
2016-11-08 20:57:54 +00:00
Tianjie Xu
e9390679c9 Merge "Move recovery_test.cpp out of unit test"
am: 8bfd96c0f8

Change-Id: I34ecca789d64dda77bec85d577ff0b7320a2b128
2016-11-08 20:57:42 +00:00
Treehugger Robot
52e2a97aa7 Merge "Make make_parent() to take const argument" 2016-11-08 20:53:59 +00:00
Treehugger Robot
8bfd96c0f8 Merge "Move recovery_test.cpp out of unit test" 2016-11-08 20:48:20 +00:00
Tao Bao
55883f660d resolve merge conflicts of 70172d7 to stage-aosp-master
Change-Id: I7626b57f9c8fd722708862ff1ae09c4fc0def51c
2016-11-08 10:49:47 -08:00
Tianjie Xu
5d8b53b248 Move recovery_test.cpp out of unit test
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
2016-11-08 10:42:51 -08:00
Tao Bao
70172d76ef Merge "otautil: Clean up SysUtil.cpp." 2016-11-08 18:29:37 +00:00
Tianjie Xu
d75003d24c Make make_parent() to take const argument
Switch to use const std::string; and add corresponding tests.

Bug: 32649858
Test: Component tests pass
Change-Id: I640f3ec81f1481fa91aa310f8d4d96dac9649cb9
2016-11-08 10:11:03 -08:00
Tao Bao
c3292f3fcb otautil: Clean up SysUtil.cpp.
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
2016-11-07 13:00:38 -08:00
Tao Bao
f46041a7d4 Merge "tests: Fix unit/zip_test.cpp."
am: ba41fba9e4

Change-Id: Ie756b132205a3602cdec4062fc84a725b9086479
2016-11-07 19:14:36 +00:00
Tao Bao
ba41fba9e4 Merge "tests: Fix unit/zip_test.cpp." 2016-11-07 19:07:44 +00:00
Tao Bao
74bda5f65b Add .clang-format style file.
The file is forked from bionic project. It's mostly in Google style, with
some tweaks (e.g. 100 column limit). New CLs can be formatted with `git
clang-format --style=file`.

Test: N/A
Change-Id: I6fbd0ab851c03aa6de9987777c7da8cdca8964ed
2016-11-07 10:02:33 -08:00
Tao Bao
0dfb7536bb tests: Fix unit/zip_test.cpp.
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
2016-11-04 15:20:52 -07:00
Tao Bao
05a801ca8e Merge "updater: Add a testcase for RenameFn()."
am: d0daf7f7df

Change-Id: I606b95f3d164063a271cd8faac8c5bfe42e2ef60
2016-11-04 21:04:12 +00:00
Tao Bao
d0daf7f7df Merge "updater: Add a testcase for RenameFn()." 2016-11-04 21:01:11 +00:00
Tianjie Xu
99adda9d67 Merge "Cleanup the duplicates of logs rotation functions"
am: e2d05c5658

Change-Id: Ia63785d846ab05eca45ec1e548f7265d7feffdbb
2016-11-04 18:14:01 +00:00
Tianjie Xu
e2d05c5658 Merge "Cleanup the duplicates of logs rotation functions" 2016-11-04 18:07:08 +00:00
Tao Bao
4f91ca78b9 Merge "updater: Fix a bug in DeleteFn()."
am: 529032f4a0

Change-Id: I77054ec63705d4e8f72ce7232db5f394f7de420e
2016-11-04 16:08:55 +00:00
Tao Bao
cb3cbaffac Merge "Revert "Revert "Some cleanups to recovery."""
am: a7a8262944

Change-Id: Iab6de4788c4dbecd33d076144f8324fde53b4024
2016-11-04 16:08:26 +00:00
Tao Bao
529032f4a0 Merge "updater: Fix a bug in DeleteFn()." 2016-11-04 16:04:58 +00:00
Tao Bao
a7a8262944 Merge "Revert "Revert "Some cleanups to recovery.""" 2016-11-04 16:04:20 +00:00
Tao Bao
a659d79b92 updater: Add a testcase for RenameFn().
Test: recovery_component_test passes.

Change-Id: Iba5a0fdf6c79e2bed6b30b8fc19a306c1ab29d8a
2016-11-03 23:35:42 -07:00
Tao Bao
0831d0b592 updater: Fix a bug in DeleteFn().
Also add a testcase for delete() function.

Test: recovery_component_test passes.
Change-Id: I064d1ad4693c3ed339d0a69eabadd08a61a2ea86
2016-11-03 23:28:36 -07:00
Tao Bao
917be35f0f Merge "updater: Fix an off-by-1 bug in file_getprop()."
am: da2b34b5d0

Change-Id: Ib5d4f50a42465648bb6a5213f6676b11427b4278
2016-11-04 04:36:14 +00:00
Tao Bao
da2b34b5d0 Merge "updater: Fix an off-by-1 bug in file_getprop()." 2016-11-04 04:30:24 +00:00
Tianjie Xu
e113e4d67f Cleanup the duplicates of logs rotation functions
Bug: 32067516
Test: Logs rotated successfully on angler, recovery-refresh/persist tests
passed on an a/b device.

Change-Id: Ie80adf0fa958ad3d7869d2d17f49489666b86c29
2016-11-03 18:16:33 -07:00
Tao Bao
51d516e913 updater: Fix an off-by-1 bug in file_getprop().
Also add a testcase for file_getprop().

Test: recovery_component_test passes.

Change-Id: I8eb2f9a5702b43997ac9f4b29665eea087b1c146
2016-11-03 14:58:54 -07:00
Tao Bao
ac9d94d19c Revert "Revert "Some cleanups to recovery.""
This reverts commit 8584fcf677.

This CL re-lands commit c0319b60f5.
The "stage" and "reason" variables are now declared as global by
dropping the static qualifier, because they may be used by vendor
recovery libraries.

Test: lunch aosp_angler-userdebug; mmma bootable/recovery
Test: lunch aosp_dragon-userdebug; mmma bootable/recovery

Change-Id: I252c346f450079478cff22bbff01590b8ab2e2b3
2016-11-03 11:57:46 -07:00
Tao Bao
a98b4e4bef Merge "tests: Set up testdata path for continuous native tests."
am: 4011bb161a

Change-Id: I9ca5ab5081cc1f08fe1caa0d0d9baac4f2447efb
2016-11-03 18:21:55 +00:00
Tao Bao
4011bb161a Merge "tests: Set up testdata path for continuous native tests." 2016-11-03 18:15:07 +00:00
Tao Bao
4102b28132 tests: Set up testdata path for continuous native tests.
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
2016-11-02 23:18:01 -07:00
Tao Bao
4fc42365ac Merge "applypatch: Add testcases for applypatch executable."
am: 5696526ba4

Change-Id: I923ed0311335a798965cd83f0ba070223a0963b2
2016-11-02 17:22:01 +00:00
Treehugger Robot
5696526ba4 Merge "applypatch: Add testcases for applypatch executable." 2016-11-02 17:19:45 +00:00
Tianjie Xu
88fc75ee54 Merge "Cleanup ReadArgs & ReadValueArgs usage"
am: a9b252887c

Change-Id: I2bf575fbb14165e7904d01b01b71ec6e3f24f068
2016-11-02 00:01:05 +00:00
Tianjie Xu
a9b252887c Merge "Cleanup ReadArgs & ReadValueArgs usage" 2016-11-01 23:53:02 +00:00
Tianjie Xu
5fe280ac96 Cleanup ReadArgs & ReadValueArgs usage
ReadArgs will switch to using std::string and std::unique_ptr. Also
cleanup the callers.

Test: mma & component test passed.
Change-Id: I4724406ae6c0c134a27bbd1cdd24ad5d343b2a3b
2016-11-01 15:03:06 -07:00
Tao Bao
36c3511952 applypatch: Add testcases for applypatch executable.
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
2016-11-01 14:40:14 -07:00
Tao Bao
bc48de6bf0 Merge "applypatch: Switch the parameter of Value** to std::vector."
am: 3f4030e0ef

Change-Id: I741638c51e9c3fe57cc874e6af86ea6a65d5aa71
2016-11-01 21:30:20 +00:00
Tao Bao
3f4030e0ef Merge "applypatch: Switch the parameter of Value** to std::vector." 2016-11-01 21:25:12 +00:00
Tao Bao
fada91ccf2 applypatch: Switch the parameter of Value** to std::vector.
Test: Unit tests and install-recovery.sh pass on angler and dragon.

Change-Id: I328e6554edca667cf850f5584ebf1ac211e3d4d1
2016-10-28 16:46:12 -07:00
Dan Albert
0c571e5923 Merge "Revert "Some cleanups to recovery.""
am: 9514eb1934

Change-Id: Id96135ffde5adaebd45811b9c3d319a99fe28ecd
2016-10-27 04:53:48 +00:00
Treehugger Robot
9514eb1934 Merge "Revert "Some cleanups to recovery."" 2016-10-27 04:49:49 +00:00
Dan Albert
8584fcf677 Revert "Some cleanups to recovery."
This reverts commit c0319b60f5.

Reason for revert: Broke builds.

Change-Id: I82aa880b83de5ae6c36fd7567cb001920559a972
2016-10-27 03:08:08 +00:00
Tao Bao
00f893fe23 Merge "Some cleanups to recovery."
am: 46fb0a6a6f

Change-Id: Ic247a408b1bd3e2eab1db34eb4b14423d9fd16d6
2016-10-26 23:32:30 +00:00
Treehugger Robot
46fb0a6a6f Merge "Some cleanups to recovery." 2016-10-26 23:26:04 +00:00
Tao Bao
c0319b60f5 Some cleanups to recovery.
- Remove the duplicate gCurrentUI variable in recovery.cpp;
- Refactor the load/save of locale functions;
- Clean up ui_print() to get rid of 256-byte buffer limit;
- Declare ui in common.h;
- Move the typedef of Volume into roots.h.

Test: Build and boot into recovery image.

Change-Id: Ia28c116858ca754133127a5ff9c722af67ad55b7
2016-10-26 14:36:42 -07:00