Commit graph

57444 commits

Author SHA1 Message Date
Yifan Hong
51b127c71e Merge changes I845d2250,I4faa0785
* changes:
  libsnapshot: proto use correct index
  libsnapshot: Export COW image size
2020-05-30 01:06:56 +00:00
Yifan Hong
a30076404e libsnapshot: proto use correct index
Test: pass
Bug: 154016862
Change-Id: I845d2250ddb27bdbaee0d54663a2fdb45dbfbd11
2020-05-29 16:21:40 -07:00
Alessio Balsini
02e639d1f5 libsnapshot: Export COW image size
Enable libsnapshot to export the size of the COW image, representing the
fraction of the COW device that is temporarily created in the /data
partition, computed just before initializing a merge operation.
Thise additional information can be used by other components (i.e.,
update engine) to enrich Virtual A/B metrics.

Bug: 154016862
Test: manual OTA
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I4faa0785f23884e26161e0d51268dd7a305d86bf
Merged-In: I4faa0785f23884e26161e0d51268dd7a305d86bf
2020-05-29 23:19:39 +00:00
David Anderson
b0b5d4f400 Merge "libdm: Fallback to legacy ueventd logic if running on an older system." 2020-05-29 05:06:22 +00:00
David Anderson
e681cf01c8 Merge "fastboot: Allow fastboot to asynchronously differentiate between fastboot and fastbootd." 2020-05-29 04:47:35 +00:00
David Anderson
a212760ec6 libdm: Fallback to legacy ueventd logic if running on an older system.
When delivering single-stage, non-AB OTAs, the updater binary is built
on a newer OS than recovery is compiled with. libdm relies on newer ueventd
behavior which therefore breaks this model. As a workaround, we allow
libdm to fallback to the old ueventd logic if the following conditions
hold true: (1) we're in recovery, (2) the device is not an AB device,
and (3) the release is <= 10.

Since the old ueventd behavior can lead to races in libdm, this fallback
should stay as narrow as possible.

Bug: 156536673
Bug: 155202260
Test: manual test
Change-Id: I7f9da49e4ba8dfe165e0923d9918827d51d090cd
2020-05-28 20:44:31 -07:00
David Anderson
4e058cac0d fastboot: Allow fastboot to asynchronously differentiate between fastboot and fastbootd.
It's not possible to programmatically determine which fastboot mode a
device is in, without sending a getvar:is-userspace query. Unfortunately
this is not possible asynchronously, and may interrupt other queries
being processed.

This patch changes fastbootd's USB interface name to "fastbootd". Note
that tools use the protocol number/class and not this string, so it
should be safe to extend. When using "fastboot devices", the interface
name is now listed if set. Note that currently only the Linux version of
the fastboot tool is capable of reading the interface name.

Bug: 156966319
Test: fastboot devices on Linux
Change-Id: I57ccf2bec1dda573fe3ac628a646624b76f45905
2020-05-28 17:42:00 +00:00
Tom Cherry
609630e7ba Merge changes I5cf0d014,Ib46f0646
* changes:
  logd: remove LogBufferElement dependency of LogReaderThread
  logd: rename FlushToResult to FilterResult
2020-05-28 15:25:20 +00:00
Elliott Hughes
49cd73754e Merge "Make systemTime() abort on bad input." 2020-05-28 15:11:20 +00:00
Alistair Delva
510d2437b4 Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" 2020-05-28 00:04:02 +00:00
Elliott Hughes
842e1cc17e Make systemTime() abort on bad input.
There's no CHECK in libutils, sadly.

Bug: http://b/157167405
Test: treehugger
Change-Id: I1532bf80ba7fdafad016610be3c782b547417126
2020-05-27 15:31:55 -07:00
Tom Cherry
70fadea36f logd: remove LogBufferElement dependency of LogReaderThread
In the future, not all log buffers will be implemented in terms of
LogBufferElement.

Test: build
Change-Id: I5cf0d01414857b1bfa08c92a4f8035b43ef2aad7
2020-05-27 15:13:52 -07:00
Tom Cherry
3e61a1368a logd: rename FlushToResult to FilterResult
This was a typo; the enum corresponds to the result of the 'Filter'
function, not the 'FlushTo' function.

Test: build
Change-Id: Ib46f0646570b6dbaac17ae9fc95c990128cdbe72
2020-05-27 15:09:34 -07:00
Treehugger Robot
37e8b5e587 Merge "liblp: delete unused function and fields" 2020-05-27 18:35:05 +00:00
Christopher Ferris
d46eb21906 Merge "Fail explicitly on length overflow." 2020-05-27 03:17:03 +00:00
Yifan Hong
bcf3cc8cce liblp: delete unused function and fields
Test: builds
Change-Id: Ib7c93cfadacedc4f8d983c490e55fb4672cc9c1d
2020-05-26 23:02:31 +00:00
Christopher Ferris
68604b9c29 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
2020-05-26 12:00:07 -07:00
Elliott Hughes
95e79c63a4 Merge "libcutils: reimplement system property functions with libbase." 2020-05-26 17:27:56 +00:00
Tom Cherry
f8f95a41f4 Merge changes If6e29418,I6d90838e,Ie488f8ac
* changes:
  logd: create SimpleLogBuffer and implement ChattyLogBuffer in terms of it
  logd: separate Chatty only vs generic LogBufferTests
  logd: move current sequence from LogBufferElement to LogBuffer
2020-05-26 15:19:44 +00:00
Treehugger Robot
aa15ef4d0e Merge "Update TEST_MAPPING." 2020-05-22 01:46:29 +00:00
Alistair Delva
a2cc1ebb72 Add ro.boot.fstab_suffix and modify mount_all to use it
Currently the ReadDefaultFstab function, which calls GetFstabPath,
makes some assumptions about what the fstab will be called and where
it is located. This is being used by vold to set up userdata encryption
and for gsid, and is even used in the default boot control HAL, so it
has become quite baked.

The original way for a board to specify things to mount was to use the
"mount_all /path/to/fstab" command in init.rc. However, due to the
above functionality, the path after mount_all is no longer very useful,
as it cannot differ from the inferred path, or userdata encryption and
other features will be broken.

On Cuttlefish, we have an interest in being able to test alternative
userdata configurations (ext4 vs f2fs, encryption on/off, etc.) and
currently the only way to achieve this is to either a) modify the
ro.hardware or ro.hardware.platform properties, which breaks a bunch
of things like default HAL filenames, or regenerate our odm.img or
vendor.img filesystems. We can't simply install another fstab and
point to it with "mount_all".

This change allows the fstab path to be omitted from "mount_all", and
adds another property which overrides the existing checks for
fstab.${ro.hardware} and fstab.${ro.hardware.platform}. Specifying
${ro.boot.fstab_suffix} will cause fstab.${ro.boot.fstab_suffix}
to be checked first.

Bug: 142424832
Test: booted cuttlefish with 'mount_all ${ro.hardware} --late'
Test: booted cuttlefish with 'mount_all --late'
Test: booted cuttlefish with 'mount_all --late' and fstab_suffix=f2fs
Test: partially booted cuttlefish with 'mount_all ${ro.hardware}'
Test: partially booted cuttlefish with 'mount_all'
Change-Id: I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c
2020-05-21 16:38:40 -07:00
S Vasudev Prasad
100b08a848 libcutils: reimplement system property functions with libbase.
This makes the system property functions available on the host too, and
ensures a consistent view of system properties between libcutils and
libbase, if you have code running on the host that uses both.

Bug: http://b/151789258
Test: treehugger
Change-Id: Ie524a77d0c392d7b23e9d12becbb1bf53c81eac6
2020-05-21 16:20:16 -07:00
Elliott Hughes
ca3dd7ec34 Update TEST_MAPPING.
libbase and libziparchive both just moved out of system/core/, so I
don't think there's any value to running their tests when system/core/
changes. (I already added new TEST_MAPPING files to the two new projects.)

Test: treehugger
Change-Id: I0dd7acb525d9cca5349c55dc2724eab8d3a06afa
2020-05-21 14:26:34 -07:00
Tom Cherry
8f613464b8 logd: create SimpleLogBuffer and implement ChattyLogBuffer in terms of it
Test: unit tests with SimpleLogBuffer
Change-Id: If6e29418645b5491df9b8aeef8f95bb786aeba93
2020-05-21 14:23:45 -07:00
Tom Cherry
e18346d3d9 logd: separate Chatty only vs generic LogBufferTests
Separate these tests such that future log buffer implementations can
be run against the generic tests.  Use a parameterized fixture to
allow testing any number of log buffers.

Test: these unit tests
Change-Id: I6d90838e8efa019b934d08da25cab0c2405b66cd
2020-05-21 14:10:32 -07:00
Tom Cherry
a3c5ff5d3f logd: move current sequence from LogBufferElement to LogBuffer
This is required for tests that are aware of sequence numbers to pass;
each new LogBuffer instance should start from sequence = 1, which
isn't the case if the current sequence number is a static.

Test: unit tests
Change-Id: Ie488f8ac5e22b946b7e6237d1d5caf14929c0ec3
2020-05-21 14:10:17 -07:00
Tom Cherry
f29cd20df5 Merge changes Ia7953e3c,Id1f29f4d,I38623130
* changes:
  logd: use a std::list<> of values not pointers
  logd: refactor chatty deduplication logging
  logd: use RAII locks and thread annotations
2020-05-21 20:35:41 +00:00
Treehugger Robot
eb3be2e28f Merge "emmc_optimized means stable_inodes" 2020-05-21 19:54:37 +00:00
Treehugger Robot
39fe8215e5 Merge "libsnapshot: delete unused todo" 2020-05-21 19:38:48 +00:00
Tom Cherry
1322472ad0 logd: use a std::list<> of values not pointers
This saves 4 or 8 bytes off of each log message for 32 bit or 64 bit
devices respectively.  In practice, this actually saves more, due to
avoiding heap fragmentation.

Averaging over 5 runs of the LogBufferTest.random_messages unit test
(32 bit), this change results in 8k less memory used when 1000 logs
are logged and results in 260k less memory used when 10000 logs are
logged.

Test: check memory usage during LogBufferTest.random_messages
Test: logging unit tests
Change-Id: Ia7953e3c4cb19631ef43bab1deb91bb336bc2520
2020-05-21 11:16:36 -07:00
Tom Cherry
a26f7dffe5 logd: refactor chatty deduplication logging
This code and comment is hard to follow, despite the operation being
simple, so refactor the code to be easier to follow.

Also, use std::unique_ptr instead of raw pointers as appropriate.

Test: logging unit tests
Change-Id: Id1f29f4deeca730d1e3b6856e1581d0b840f883e
2020-05-21 11:14:18 -07:00
Paul Crowley
c2f37683bc emmc_optimized means stable_inodes
If the emmc_optimized filesystem flag is set, then like
inlinecrypt_optimized, we have to ensure that stable_inodes is set
on the filesystem.

Bug: 144046242
Test: Cuttlefish, ext4: set the flag in fstab, check for the
    stable_inodes flag using tunefs -l
Change-Id: Id7f906564457c240ddf6677dd536698881385385
2020-05-21 11:14:05 -07:00
Tom Cherry
0b01ff0f39 logd: use RAII locks and thread annotations
Test: unit tests
Change-Id: I38623130a96f17a47ed79753e24b25efa9e38279
2020-05-21 11:07:04 -07:00
Yifan Hong
3f36212139 libsnapshot: delete unused todo
Too hard to make libsnapshot_fuzzer host supported.
Test: none

Change-Id: I974cea8f836b447e1fa6b676a1d95ebaf491442e
2020-05-21 11:03:01 -07:00
Tom Cherry
0a6c83e7d0 Merge "logd: add tests for log deduplication" 2020-05-21 16:06:30 +00:00
Treehugger Robot
4ea509e25d Merge "adb: only submit USB writes on the worker thread." 2020-05-20 23:34:37 +00:00
Tom Cherry
b398a7c85e logd: add tests for log deduplication
Fix a subtle bug that liblog event messages have a payload of int32_t,
not uint32_t, so they should only be summed to int32_t max.

Make a bunch of test improvements as well to support these.

Test: these tests
Change-Id: I4069cc546240bfffec5b19f34ebec913799674e8
2020-05-20 14:39:26 -07:00
Josh Gao
962551000b adb: only submit USB writes on the worker thread.
After USB disconnection, io_submit will block until the endpoint comes
back up. We handle this in the worker thread by sending it a signal to
break it out of io_submit when we notice that USB has gone down, but
opportunistic writes from the main thread can get stuck in this scenario
as well. Submitting the writes only on the worker thread doesn't have a
measurable impact on performance, so avert this scenario by only
submitting writes from the worker thread.

Bug: http://b/157078255
Test: test_device.py
Change-Id: I1118f2e2a70d13f15592eb996e7084033ed5cb9d
2020-05-20 21:03:18 +00:00
Josh Gao
b27365510d Merge "adb: fix flakiness in PTY shell protocol." 2020-05-20 21:01:23 +00:00
Treehugger Robot
fc4e54ecb0 Merge "adb: fix abb test." 2020-05-20 16:25:45 +00:00
Baligh Uddin
3b55f75706 Merge "Migrate system/core/base to system/libbase." 2020-05-20 12:22:54 +00:00
Josh Gao
be41ae5666 adb: fix flakiness in PTY shell protocol.
When a subprocess closes its PTY slave, the master fd will report
POLLHUP when polled. This leads to us prematurely tearing everything
down, without reading out output that's been written to the PTY.

Resolve this by waiting until the fd no longer reports POLLIN.

Bug: http://b/156551485
Bug: http://b/156552734
Test: `adb shell 'X=0; while /data/nativetest64/adbd_test/adbd_test --gtest_filter="ShellServiceTest.*Pty*" >/dev/null 2>&1; do X=$((X+1)); echo $X; done'` for 1000 iterations (failed within 20, previously)
Test: test_device.py
Change-Id: Ie591e0cafb532cd6cebdf6f356dc967565b5a2d9
2020-05-19 20:54:40 -07:00
Josh Gao
8f83498cbd adb: fix abb test.
Don't hardcode cmd's output.

Bug: http://b/157092201
Test: python3 -m unittest test_device.AbbTest
Change-Id: I7145e8d2a31b1c1b459c1e55af3670b95e653eee
2020-05-19 20:12:52 -07:00
Rick Yiu
9ada65c0c6 Merge "Add choice for changing sched policy when setting thread priority" 2020-05-20 03:03:18 +00:00
Christopher Ferris
1fbb1b8718 Merge "Add new reparse benchmarks." 2020-05-19 23:12:27 +00:00
Baligh Uddin
28d0f1a3af Migrate system/core/base to system/libbase.
Add Symlink to ensure hardcoded references do not break build.
BUG: 148941208
test: TH

Change-Id: Ia2b69de1af6e07be2aab3ba4fe1493de80269c40
Merged-In: I1134f1e9e968b9273748e2483bea8d25e5c9e994
2020-05-19 21:32:42 +00:00
David Anderson
984aa655df Merge "libsnapshot_test: Fix running on DSUs." 2020-05-19 18:47:32 +00:00
Christopher Ferris
5990a9d442 Add new reparse benchmarks.
Test: Ran benchmarks on host and device.
Change-Id: I41b7d29bfa3468b9b9b8cbdfe94aca830d14f98e
2020-05-19 10:31:53 -07:00
Tom Cherry
0e95c2108f Merge changes I85e6c989,Ie4ecc502,I1f8cfbb7
* changes:
  logd: build liblogd and its test on host
  logd: add LogBufferTest.cpp
  liblog: remove unused log_time functions, inline the others
2020-05-19 14:37:46 +00:00
Treehugger Robot
1b1ac36214 Merge "Migrate platform/system/core/libziparchive to p/system/libziparchive" 2020-05-19 12:45:51 +00:00