Commit Graph

48283 Commits

Author SHA1 Message Date
Daniel Norman fb54b74fa0 Merge changes from topic "services_serve_interfaces_test"
* changes:
  Adds new property for service name -> PID.
  Adds a library to parse service info from init_rc files for use in tests.
  Adds a visibility rule for init defaults.
2019-08-02 21:51:17 +00:00
Treehugger Robot 41a5c022b4 Merge "logcat: error on multiple PID argument" 2019-08-02 21:09:49 +00:00
David Anderson 456e50193b Implement basic libsnapshot functionality.
This CL implements some of the libsnapshot internals necessary to work
with update_engine. In particular it implements snapshot and update
state, as well as creating and mapping snapshot devices. It does not
implement anything related to merging, nor does it implement the full
update_engine flow.

Update state is stored in /metadata/ota/state. To synchronize callers of
libsnapshot, we always flock() this file at the top of public functions
in SnapshotManager. Internal functions are only called while the lock is
held, and a "LockedFile" guard object is always passed through to
indicate proof-of-lock.

Low-level functions, such as snapshot management, have been moved to
private methods. Higher-level methods designed for update_engine will
ultimately call into these.

This CL also adds some functional tests for SnapshotManager. Test state
is stored in /metadata/ota/test to avoid conflicts with the rest of the
system.

Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: I78c769ed33b307d5214ee386bb13648e35db6cc6
2019-08-02 13:30:08 -07:00
Treehugger Robot d7546f1d57 Merge "Remove two more unused utf32 functions." 2019-08-02 19:29:45 +00:00
Treehugger Robot 77a4f372c4 Merge "dmctl: add replace command" 2019-08-02 19:24:14 +00:00
Yurii Zubrytskyi e800af5c23 [adb] Cache features set inside the client process
Test: manual
Change-Id: I99962edd85e9694c3ca309624368cda6355da008
2019-08-02 11:37:32 -07:00
Steven Moreland b0e867a1e6 logcat: error on multiple PID argument
Since they are dropped.

Bug: N/A
Test: manual try w/ 1 and 2 --pid arguments
Change-Id: I5945c12dc080a8c046b8071106f7d87ecb2b018c
2019-08-02 10:14:37 -07:00
Alessio Balsini 81d4ea79e2 dmctl: add replace command
The replace command is used to substitute the current table of a
device-mapper with the provided one.
The new table will be available as soon as the command returns
successfully.

Bug: 137759376
Test: manual
Change-Id: Iaf258d9043fab3a8770702f4e1c8c0e583c81519
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-08-02 03:27:00 +01:00
David Anderson f7970cee69 Merge "Fix storaged memory leak" 2019-08-02 00:15:28 +00:00
Treehugger Robot ab80f54949 Merge "libdm: compute percentage of snapshot-merge" 2019-08-01 23:32:16 +00:00
Tom Cherry 549ea4801b Merge changes Ied888249,Id8857c45
* changes:
  init: check the arguments of builtins during the build
  init: don't log in expand_props directly
2019-08-01 22:04:30 +00:00
Tom Cherry 4772f1da47 init: check the arguments of builtins during the build
Host init verifier already checks that the names and number of
arguments for builtins are correct, but it can check more.  This
change ensures that property expansions are well formed, and that
arguments that can be parsed on the host are correct.  For example it
checks that UIDs and GIDs exist, that numerical values can be parsed,
and that rlimit strings are correct.

Test: build

Change-Id: Ied8882498a88a9f8324db6b8d1020aeeccc8177b
2019-08-01 10:54:47 -07:00
Tom Cherry c5cf85db23 init: don't log in expand_props directly
It's better to pass the error message to the caller to determine how
best to print the error.

Test: build
Change-Id: Id8857c459df2f26c031650166609608d20e4d051
2019-08-01 10:34:58 -07:00
Treehugger Robot 1553cf829a Merge "libdm: improve ParseStatusText() and test it" 2019-08-01 02:42:23 +00:00
Treehugger Robot 873d867e3a Merge "Don't fail if default namespace isn't found" 2019-08-01 02:23:23 +00:00
Alessio Balsini 3565e31b42 libdm: compute percentage of snapshot-merge
Computes the merge completion percentage from the sector information.

Provided test for the function.

Change-Id: I64d83baa0478f9e6969636ee067174910d9b8e03
Bug: N/A
Test: dm_test
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-08-01 02:22:24 +01:00
Treehugger Robot 6bac7cd942 Merge "adb: fix track-devices-l." 2019-08-01 01:09:42 +00:00
Jiyong Park c5e85bf9ba Don't fail if default namespace isn't found
This fixes a regression caused by 8f4afc8298
that libnativeloader can't no longer handle the case that it has failed
to find the default namespace. Previously before the change,
libnativeloader continued to use nullptr as the parent namespace which
is reconized as the default namespace inside the linker.

This change recovers the previous behavior. When the default namespace
is not found, NativeLoaderNamespace object is constructed from nullptr.

Bug: 138607234
Test: run app-compat/app-startup-gce on cf_x86_phone using forrest
Change-Id: If518fbc055399b73e7d3a6b45ace0f71e9c25dae
(cherry picked from commit db825ceba6)
Merged-In: If518fbc055399b73e7d3a6b45ace0f71e9c25dae
2019-08-01 09:30:01 +09:00
Wei Wang 81e25f5e32 Merge "init: add timing log for oneshot and exec_background services" 2019-08-01 00:05:07 +00:00
Treehugger Robot 1be681cf50 Merge "dmctl: return detailed device information" 2019-07-31 23:37:29 +00:00
Treehugger Robot 6f4f7091aa Merge changes from topic "ion-unit-tests"
* changes:
  libion: make tests work with Ion from common kernel.
  libion: Add missing error checks for input parameters to APIs.
2019-07-31 22:32:45 +00:00
Elliott Hughes fc2f5f6728 adb: fix track-devices-l.
Also add a -l to the undocumented `adb track-devices` for easier
testing.

Bug: https://issuetracker.google.com/118470090
Test: manual
Change-Id: I436f6e45b249b98a073aa147ad4ed67d4d87f9bd
2019-07-31 14:14:59 -07:00
Alessio Balsini 4560856e33 libdm: improve ParseStatusText() and test it
Simplify the argument parsing of DmTargetSnapshot::ParseStatusText() and
improve its robustness when dealing with wrong imputs.

Add test for DmTargetSnapshot::ParseStatusText().

Change-Id: I7f078c9ecacb402e71db49e3e7072e37cffbc234
Test: dm_test
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-07-31 21:23:58 +01:00
Elliott Hughes 690c8c8f25 Merge "Restore default port for `adb connect`." 2019-07-31 19:48:02 +00:00
Treehugger Robot 11295b7f8b Merge "Allow overriding the log path." 2019-07-31 19:44:58 +00:00
Treehugger Robot 51406823c1 Merge "Clarify `adb sync -l` help text." 2019-07-31 19:44:49 +00:00
Wei Wang f7c2bfee08 init: add timing log for oneshot and exec_background services
Bug: 136523746
Bug: 138732985
Test: boot
Change-Id: I713edd2ba8a391d5afbea796c6d58ffac9477436
2019-07-31 11:53:18 -07:00
Treehugger Robot ae898442d1 Merge "Revert "fs_mgt: Fix remount failure in case of non-overlayfs system"" 2019-07-31 18:44:38 +00:00
Daniel Norman c788771da7 Adds new property for service name -> PID.
Bug: 138114550
Test: used in vts_ibase_test
Change-Id: Id21b81aa09b8597d17ad0a132ddd7749fe1182e9
2019-07-31 11:35:32 -07:00
Daniel Norman d19c5a5076 Adds a library to parse service info from init_rc files for use in tests.
Bug: 138114550
Test: used in vts_ibase_test
Change-Id: Ibadc2a76d6112b5778d3a282a1e05ffc74511623
2019-07-31 11:33:47 -07:00
Daniel Norman 8082ba2f77 Adds a visibility rule for init defaults.
Also ran bpfmt on the file.

Test: n/a
Change-Id: I33f6233a031462debe295ab5576dd75c948ae081
2019-07-31 11:33:35 -07:00
Mark Salyzyn 3d85fc6954 Merge changes I96d1acb3,Ief00af72,Idf8f4a0e
* changes:
  adb-remount-test: add /system/priv-app
  adb-remount-test: support devices that do not have verity
  adb-remount-test add --no-wait-screen option
2019-07-31 15:49:39 +00:00
Ryan Savitski 814cbfa10e Revert "fs_mgt: Fix remount failure in case of non-overlayfs system"
This reverts commit 588fe9e8af.

Reason for revert: definite cause for test failure

Test: adb-remount-test.sh
Bug: 138407617
Fixes: 138622072
Change-Id: If2fee8873dd7d4360e7ff5572a0481247beffbca
2019-07-31 15:03:45 +00:00
Elliott Hughes 573e67cbeb Restore default port for `adb connect`.
The default port of 5555 was removed a while back, but the help text was
never updated, and other contexts still allow a default port.

Bug: https://issuetracker.google.com/128561172
Test: manual
Change-Id: I6e5e6edeb2243386a0301c0a6cad569189f9910e
2019-07-30 21:55:56 -07:00
Treehugger Robot 47757e93aa Merge "adb: avoid leaking pty master FDs." 2019-07-31 02:55:35 +00:00
Alessio Balsini 712140ee82 dmctl: return detailed device information
Return detailed information for devices, i.e.:
- active
- access
- activeTable
- inactiveTable
- bufferFull

Bug: 137759376
Test: manual test
Change-Id: I6aa4ae319adbb5c4ca98823f24010e68e6a0b719
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-07-31 02:54:14 +00:00
Treehugger Robot a3e82da054 Merge "libdm: fetch and present device status flags" 2019-07-31 02:47:35 +00:00
Treehugger Robot 29fc6eafda Merge "OWNERS: add owners to libion" 2019-07-31 01:44:35 +00:00
Alessio Balsini 1b80a23c57 libdm: fetch and present device status flags
Fetch detailed information for devices through its flags and store in
helper Info class, i.e.:
- active
- access
- activeTable
- inactiveTable
- bufferFull

Change-Id: I3241c5bca00e038d19f99390f40710ca7cff8456
Bug: 137759376
Test: manual test
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-07-31 00:14:30 +01:00
Joshua Gilpatrick 60fa8b8ad2 Merge "Fastdeploy converted to c++ and bin2c on the jar." 2019-07-30 21:51:57 +00:00
Josh Gao 6733b2bf38 adb: avoid leaking pty master FDs.
Reimplement openpty with O_CLOEXEC to avoid accidentally leaking pty
master FDs.

Bug: http://b/138297062
Test: manual
Change-Id: I6d83c909232a95c9f03370f078aec7b0911d7369
2019-07-30 14:48:57 -07:00
Sandeep Patil f7f03c9e32 libion: make tests work with Ion from common kernel.
The tests do not care about legacy ION interface and are intended to
concentrate for kernels 4.14+ (new API). Running these tests
successfully during changes in ION will keep us honest with the upcoming
heap-as-module changes in ION.

Test: ./ion-unit-tests on cuttlefish.
Bug: 133508579

Change-Id: I2a31d09d09deb5be9ae84c4981cdf4b3c2cceb4c
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-07-30 14:40:24 -07:00
Sandeep Patil 21620dc745 OWNERS: add owners to libion
Bug: none
Test: n/a

Change-Id: Ie6c462068acf6b6ad8cd6579feab05c2fa238a94
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-07-30 14:40:24 -07:00
Sandeep Patil 89ea28116a libion: Add missing error checks for input parameters to APIs.
The errors were caught by ion-unit-tests. Make sure we fix them before
we start running the tests in automation etc.

Bug: 133508579
Test: ion-unit-tests

Change-Id: I7ebecfa037767481ee7f2b30e2923c84ebc352bf
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-07-30 14:40:24 -07:00
Tom Cherry d17c37952d init: ignore ENOENT from fewer builtins
Previously we were ignoring ENOENT from all builtins as
rootdir/init.rc has many legacy commands that we need to keep for
backwards compatibility, but are otherwise no longer relevant.

However, this wasn't catching actual issues, for example chown failing
due to not finding the user or group name.  This change therefore
reduces the scope of ignoring ENOENT to the only the extraneous errors
in builtins.

Test: boot CF and walleye without seeing errors from init.rc
Test: see errors from invalid users/groups in chown
Change-Id: Ia8e14fa2591e083cb1736c313a3e55515bc5d15e
2019-07-30 12:44:35 -07:00
Elliott Hughes 1a9da399cb Allow overriding the log path.
Bug: https://issuetracker.google.com/112588493
Test: manual
Change-Id: Ic273d46544479332b8e031f30feadd1840f2d653
2019-07-30 12:26:31 -07:00
Elliott Hughes 4c8ea89afb Clarify `adb sync -l` help text.
Seems like the bug submitter thought that -l listed the partitions shown
on the line above, rather than the files. Be more explicit.

Bug: https://issuetracker.google.com/73122762
Test: treehugger
Change-Id: I6ed1027639a5b785a5992909430d739958d10ad7
2019-07-30 10:32:53 -07:00
Mark Salyzyn 9daf79f43f adb-remount-test: add /system/priv-app
In 4.19+ kernels not yet patched, /system/priv-app/<file> can
cause EPERM on fstat of the directory, resulting in failure to
access content.

Test: adb-remount-test.sh
Bug: 138649540
Change-Id: I96d1acb3cdb80824c9d2ebce415ea6e1253f9c5b
2019-07-30 09:31:45 -07:00
Mark Salyzyn f6d8a631fa adb-remount-test: support devices that do not have verity
This allows the test to run to completion on cuttlefish

Test: adb-remount-test.sh
Bug: 138649540
Change-Id: Ief00af72af94bf14c1d69499b12ece8cfce2f552
2019-07-30 09:31:37 -07:00
Mark Salyzyn 91eb2c0a25 adb-remount-test add --no-wait-screen option
If the device screen drivers or frameworks are compromised, permit
remount testing without waiting for full boot complete to occur with
the --no-wait-screen option.  In the same vein to support development,
add --wait-adb and --wait-fastboot options to adjust the timeout.

For TreeHugger testing where other (previous) tests demonstrate
framework or screen regressions, it _may_ be advised to switch to the
--no-wait-screen option so that we do not register a false signal.
It should be noted that some of the past issues with overlayfs and
adb remount could introduce boot up, framework or screen regressions,
so it is advised to not use the option if that interlocking logic can
not be set up.

Test: adb-remount-test.sh
Bug: 138649540
Change-Id: Idf8f4a0eb6d7c9139bd4f2c600d14a70dc71902f
2019-07-30 09:31:29 -07:00