Commit Graph

57425 Commits

Author SHA1 Message Date
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
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
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
Baligh Uddin db6e6038d0 Migrate platform/system/core/libziparchive to p/system/libziparchive
BUG: 149737100
Test: Forrest Run and TH
Change-Id: Id0872496eb9fcfb5075ddec22956a9a35d1514d4
Merged-In: I357a8c655855949bb0957675510bbaa26b47bc3c
2020-05-19 11:55:59 +00:00
Treehugger Robot bd05d33ce7 Merge "Optimizing install-multi-package to use ABB." 2020-05-19 06:27:46 +00:00
David Anderson 0d2bcd4afe libsnapshot_test: Fix running on DSUs.
Because DSUs mount userdata via a fiemap, libfiemap has trouble creating
additional fiemaps on top of it. The complex stacking of dm-linear is
not supported. For other libfiemap tests we've hacked around this
limitation. If LpMetadata is in a folder named "test", we allow the
backing device search to stop at a dm node, whereas otherwise it would
need to stop at a physical device.

However this was not quite enough for vts_libsnapshot_test, because (1)
the test folder was not included in the pattern match, and (2)
CreateLogicalPartition() could not handle device-mapper names, as it
expects a named physical partition. Addressing both of these allows the
tests to pass on DSUs.

Bug: 156713441
Test: vts_libsnapshot_test on DSU
Change-Id: Ie7ee70e31dff0809a5f0c402ed132d80dd03d9b1
2020-05-19 06:02:37 +00:00
Treehugger Robot 3eb41352c5 Merge "Incremental install mode for install-multi." 2020-05-19 06:00:40 +00:00
Alex Buynytskyy a64d4f81a4 Optimizing install-multi-package to use ABB.
Bug: 150803885
Test: atest adb_test adbd_test
Test: adb install-multi-package Picsart_9.30.5.apk Pinterest_6.54.0.apk
Change-Id: I2fcd093e61afdd16d481194e1d5f8f66acf6a66c
2020-05-19 04:29:34 +00:00
Alex Buynytskyy c06d01e2d9 Incremental install mode for install-multi.
Bug: 150803885
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I242104267273bac21ab41390d3e77a434ffa565d
2020-05-19 04:29:27 +00:00
Joshua Duong 7ce4a267f5 Merge changes from topic "adb-mdns"
* changes:
  adb pair: allow passing password as command-line argument.
  Change adb auto-connect to use mdns instance name.
  'adb pair' by mdns instance name.
  'adb connect' by mDNS service name.
  Add mDNS service instance name parser.
2020-05-19 00:30:06 +00:00
Treehugger Robot 64979d3726 Merge "base: delete abi compatibility shims." 2020-05-18 22:59:39 +00:00
Tom Cherry a515197266 logd: build liblogd and its test on host
Plus the various fixups needed for building on host.

Test: run these tests on host
Change-Id: I85e6c989068f80c5a80eaf5ad149fdad0a045c08
2020-05-18 15:54:06 -07:00
Tom Cherry 43f3f761f0 logd: add LogBufferTest.cpp
Add a standalone test of log buffers that does not interact with the
logd running on the device.

Test: this new test
Change-Id: Ie4ecc50289ef164aa47cc72ddeeb9b28e776db94
2020-05-18 15:51:08 -07:00
Tom Cherry bd80e5678f liblog: remove unused log_time functions, inline the others
One of the reasons that logcat and logd statically include liblog is
to access the symbols in log_time.cpp, which we do not expose
otherwise.  Except for strptime(), which will be handled in a separate
CL, these symbols are either small enough to inline in the header or
unused and can be removed.

Test: logging unit tests
Change-Id: I1f8cfbb779aef79fc7d5b6d0050438fe5f0e0e2c
2020-05-18 15:40:26 -07:00
Elliott Hughes 0314dbaecf Merge "libsparse: use memory-mapping on Windows too." 2020-05-18 22:33:57 +00:00
Tom Cherry ff3be3155d Merge "logd: make liblogd just the core logd functionality" 2020-05-18 22:06:42 +00:00
Joshua Duong dcba5c9257 adb pair: allow passing password as command-line argument.
Bug: 155194845

Test: adb pair <host>
Test: adb pair <host> <pairing code>
Change-Id: I9813b5812a98524109a4c90cb089eab652da06fa
2020-05-18 14:24:10 -07:00
Joshua Duong 04d207d315 Change adb auto-connect to use mdns instance name.
This change will fix reconnects when the ip address and port changes for
the same mdns instance name.

Bug: 152886765

Test: 'adb pair <mdns_instance>' and wait for auto-connect.
'adb devices' | grep <mdns_instance
On device, toggle wireless debugging off/on. Client should be able to
reconnect with the different port.

Change-Id: I9ad486534019ee70fb54c9f26ce028951eca8566
2020-05-18 14:23:01 -07:00
Joshua Duong beac509301 'adb pair' by mdns instance name.
Bug: 152886765

Test: Turn on wireless debugging > "Pair with Pairing Code". On client,
> adb pair <mdns_instance>

Change-Id: I8f15c3ea17f3ac02205064f64aca0167bf5d2ad5
2020-05-18 14:23:01 -07:00
Joshua Duong 7ebc595736 'adb connect' by mDNS service name.
Bug: 152886765

Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: test_adb.py

Change-Id: I7e93ceca7cdf913060bbc5afe824593a9922c6d9
2020-05-18 14:22:52 -07:00
Treehugger Robot 7cd7b68f5d Merge "adb: don't cache failure to get features." 2020-05-18 21:12:28 +00:00
Josh Gao 3dc6710974 base: delete abi compatibility shims.
It's been a year, so references to these in master's vendor blobs
should be gone by now.

Test: treehugger
Change-Id: I090145e69f82e7ee78d66b0b92141bda56250837
2020-05-18 14:07:36 -07:00