Commit graph

2957 commits

Author SHA1 Message Date
Elliott Hughes
40c8a8b1ba Extend <sys/sysinfo.h> tests slightly.
We know game developers (and the Games SDK) look at this stuff, so make
a bit more of an effort to ensure it's not completely broken.

Test: treehugger
Change-Id: I20b1c167faa1d9f4f39a94a723dabb848ce34269
2021-06-21 16:50:13 -07:00
Peter Collingbourne
be1c013280 Merge "Disable return PAC in __pthread_start." 2021-06-09 01:14:29 +00:00
Peter Collingbourne
26d83ba7ab Disable return PAC in __pthread_start.
This function doesn't return, but it does appear in stack traces. Avoid
using return PAC in this function because we may end up resetting IA,
which may confuse unwinders due to mismatching keys.

Bug: 189808795
Change-Id: I953da9078acd1d43eb7a47fb11f75caa0099fa12
2021-06-08 16:03:41 -07:00
Christopher Ferris
7c0ce86a00 Skip the malloc_slack test on native bridge.
The allocator for the native bridge is not necessarily going to
allocate the slack data.

Bug: 189606147

Test: Ran on non-native bridge and verified test isn't skipped.
Test: Ran on native bridge and verified test is skipped.
Change-Id: Ia1555be0e9f55896af7ca81830605367133c44a1
2021-06-08 15:33:22 -07:00
Ryan Prichard
546723b2b8 Use ro.build.type instead of ro.debuggable
The LD_CONFIG_FILE test needs to match how Bionic was compiled, and
Bionic only enables LD_CONFIG_FILE for debug builds (i.e. ro.build.type
is "user"). ro.debuggable can be forced on without recompiling Bionic.

Bug: http://b/140324381
Bug: http://b/189422994
Test: bionic unit tests
Change-Id: I139059a7f94d15a5447dab292927606a6bcc48ef
2021-06-04 17:32:51 -07:00
Elliott Hughes
ec580d3d07 Make the tests that call readelf(1) less sensitive to whitespace.
Bug: http://b/185168726
Test: treehugger
Change-Id: I13dbbf57c7366966d51b8ea771ec9edd52505e72
2021-04-12 15:56:49 -07:00
Elliott Hughes
27cf254193 Merge "Switch to libbase SilentDeathTest." 2021-04-12 18:39:46 +00:00
Elliott Hughes
141b917018 Switch to libbase SilentDeathTest.
Bug: http://b/184955378
Test: treehugger
Change-Id: Ie0849224074da92203340a741a86a24a4a3702c2
2021-04-12 10:01:20 -07:00
Elliott Hughes
2b1930afaa Merge "Add tests for inet_nsap_addr()/inet_nsap_ntoa()." 2021-04-12 16:09:23 +00:00
Elliott Hughes
c30a1c08ec Add tests for inet_nsap_addr()/inet_nsap_ntoa().
Turns out that "NSAP" is yet another ISO standard that no-one actually
uses: https://en.wikipedia.org/wiki/NSAP_address

Test: treehugger
Change-Id: I73b4d924a8f4d34e3e2f2da00d0d5529db8e97d1
2021-04-09 16:26:40 -07:00
Treehugger Robot
999d82e51d Merge "Add tests for the untested <wchar.h> functions." 2021-04-09 17:28:31 +00:00
Elliott Hughes
fe50a0cbeb Add tests for the untested <wchar.h> functions.
Test: treehugger
Change-Id: Id3d8852fd195a7238d1fdc70cb1a92b921372717
2021-04-09 09:11:23 -07:00
Elliott Hughes
b74ddc301e Merge "Use GTEST_SKIP() rather than GTEST_LOG_() when skipping." 2021-04-09 15:22:34 +00:00
Treehugger Robot
3741fca9f3 Merge "Improve tgamma(3) coverage." 2021-04-09 15:22:18 +00:00
Giuliano Procida
84ccc05258 Merge "Deflake time.clock_gettime test" 2021-04-09 10:58:43 +00:00
Elliott Hughes
14ab353e19 Use GTEST_SKIP() rather than GTEST_LOG_() when skipping.
Test: treehugger
Change-Id: I74dca1882c002a51c9758fe7282b10c4413ecb03
2021-04-08 20:59:50 -07:00
Elliott Hughes
8843066f29 Improve tgamma(3) coverage.
Test: treehugger
Change-Id: I645288d51f8238433335b42befd6a6e8b625a673
2021-04-08 20:59:07 -07:00
Josh Gao
44ec9c3252 Merge "Disable fdtrack post-fork." 2021-04-09 01:08:52 +00:00
Giuliano Procida
096f5954e4 Deflake time.clock_gettime test
The test aims to check that the time obtained the VDSO is the "same"
as that obtained via the system call. Unfortunately, time progresses.
Any check involving some fixed tolerance will have some non-zero
probability of failure.

We can instead check that a VDSO time value lies between two system
call times.

Bug: 184819133
Change-Id: Idb9c17b9f612613f6e18a56ee0f256971ddbdf1f
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-04-08 10:58:57 +01:00
Josh Gao
dcc97c0887 Disable fdtrack post-fork.
Also delete some fdsan code that attempts to check for the post-fork
state, but never will, because we update the cached pid upon fork.

Bug: http://b/174542867
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: treehugger
Change-Id: I9b748dac9de9b4c741897d93e64d31737e52bf8e
2021-04-07 19:00:45 -07:00
Giuliano Procida
ebc88d26a5 Use mean CPU time in an attempt to reduce test flakiness
The sleep(3) / clock(3) test is sensitive to outliers in the
distribution of CPU consumed by the sleep system call.

This changes the measured quantity to be the mean over 5 samples and
sets the threshold to 10ms.

Bug: 184727758
Change-Id: I20df3b620a5fbf4e58a3ca67306370351ac01d0c
Test: treehugger
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-04-07 15:14:38 +01:00
Elliott Hughes
c0d41db92e setjmp/longjmp: avoid invalid values in the stack pointer.
arm64 was already being careful, but x86/x86-64 and 32-bit ARM could be
caught by a signal in a state where the stack pointer was mangled.

For 32-bit ARM I've taken care with the link register too, to avoid
potential issues with unwinding.

Bug: http://b/152210274
Test: treehugger
Change-Id: I1ce285b017a633c732dbe04743368f4cae27af85
2021-04-05 17:43:36 -07:00
Treehugger Robot
4b6a29dbe9 Merge "Improve fchmod() coverage." 2021-03-11 19:19:17 +00:00
Elliott Hughes
ac3fcc6b8c Merge "Improve system() coverage." 2021-03-09 16:15:37 +00:00
Peter Collingbourne
6ba27e04df Merge "Add some slack at the end of large allocations when target SDK level < S." 2021-03-09 01:15:54 +00:00
Elliott Hughes
db6223f46e Improve fchmod() coverage.
Test: treehugger
Change-Id: I8ebccce7ab3c0a77cd84d0830f75e9d68c64bd52
2021-03-08 14:10:46 -08:00
Elliott Hughes
b82f5cfeb2 Improve <sys/xattr.h> coverage.
Also fix a comment copy & paste mistake and some formatting.

Test: treehugger
Change-Id: I0af3ab2eb4f180f86b0ab7d2af260f0f30692fdd
2021-03-08 14:09:43 -08:00
Elliott Hughes
bbbe27ff6e Improve system() coverage.
There's a weird POSIX special case that we implement but don't test.
Found from looking through the coverage data.

Test: treehugger
Change-Id: I74f5f57c4d8062034a3f6e986f9e57091bfc7f7c
2021-03-08 14:07:01 -08:00
Peter Collingbourne
2659d7b6c2 Add some slack at the end of large allocations when target SDK level < S.
This works around buggy applications that read a few bytes past the
end of their allocation, which would otherwise cause a segfault with
the concurrent Scudo change that aligns large allocations to the right.

Because the implementation of
android_set_application_target_sdk_version() lives in the linker,
we need to introduce a hook so that libc is notified when the target
SDK version changes.

Bug: 181344545
Change-Id: Id4be6645b94fad3f64ae48afd16c0154f1de448f
2021-03-05 14:29:17 -08:00
Josh Gao
3de19151e5 Add wrappers for pidfd_{open,getfd,send_signal}.
Bug: http://b/172518739
Test: `/data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter="*pidfd*"` on blueline
Change-Id: Ibae32bbedbcf26535a80a5cbfb55ce180906b610
2021-02-25 13:55:12 -08:00
Bob Badour
8ae9d017f3 Merge "Add LOCAL_LICENSE_KINDS to bionic" 2021-02-21 15:24:32 +00:00
Elliott Hughes
a0d3da5999 Merge "Fix fdsan death tests." 2021-02-20 21:26:29 +00:00
Elliott Hughes
d76dd14ea7 Fix fdsan death tests.
Disable debuggerd for these expected failures.

Also use the usual naming pattern.

Bug: http://b/180605583
Test: check logs
Change-Id: I0254cb658d8a68e963ef59264106de4775e3fedd
2021-02-19 15:48:49 -08:00
Elliott Hughes
526a888d3f Merge "Don't dump backtraces while running fdtrack tests." 2021-02-19 23:40:07 +00:00
Bob Badour
aa7d835fdd Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  apex/Android.bp
  libdl/Android.bp
  tools/Android.bp
  tools/versioner/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  benchmarks/linker_relocation/gen/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  linker/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
2021-02-19 23:38:28 +00:00
Elliott Hughes
35e81bfc9f Merge "Fix some bionic death tests." 2021-02-19 19:02:24 +00:00
Elliott Hughes
fabcc96a7c Merge "Use death tests correctly." 2021-02-19 18:26:00 +00:00
Treehugger Robot
3b7cc4ad89 Merge "Switch BionicDeathTest to #pragma once." 2021-02-19 18:22:53 +00:00
Elliott Hughes
7f7efa92df Merge "Use BionicDeathTest for an assert(3) test." 2021-02-19 18:09:44 +00:00
Treehugger Robot
6fe4daaa16 Merge "iconv(3): ignore src_bytes_left if src_bytes is null." 2021-02-19 18:09:17 +00:00
Treehugger Robot
18dd0731f6 Merge "Increase leniancy in an inherently flaky test." 2021-02-19 18:06:36 +00:00
Elliott Hughes
ba3187f102 Don't dump backtraces while running fdtrack tests.
I'm assuming this was useful while debugging, but isn't needed now.

Bug: http://b/180605583
Test: check logs
Change-Id: I9d5bb8db60e7709a9a52e29469f7fd1d5a9cb085
2021-02-18 17:25:53 -08:00
Elliott Hughes
6249f9b44e Don't involve debuggerd in a SIGFPE test.
We just want to check that SIGFPE is raised, not try to "debug" this
expected behavior.

Bug: http://b/180605583
Test: check logs
Change-Id: I11571e02c4608570e0d406adeabc36186c5bb107
2021-02-18 17:25:07 -08:00
Elliott Hughes
e657eb4f8a Fix some bionic death tests.
These were creating tombstones and spewing to the log.

You need TEST_F() rather than TEST(), and the modern style is apparently
to use `using` rather than an empty subclass.

Bug: http://b/180605583
Test: run tests, check logcat
Change-Id: I1e639d34854aeff6f042c24643b769a6bcfab877
2021-02-18 17:23:04 -08:00
Elliott Hughes
61d0706507 Use death tests correctly.
The existing attempt at a death test wrapper wasn't functional (because
the tests were TEST rather than TEST_F), and the code in that class
doesn't work anyway. Since I don't understand the intent behind the
failing dup2() calls, I've just removed this and replaced it with
BionicDeathTest which we do need to suppress all the debuggerd work
which caused this bug to be filed.

Bug: http://b/180605583
Test: treehugger
Change-Id: I7717f7ae2620452656cf07db299774dadef55766
2021-02-18 17:17:27 -08:00
Elliott Hughes
15122842ae Use BionicDeathTest for an assert(3) test.
Bug: http://b/180605583
Test: check logs
Change-Id: I5eebef156ea1185c605060fb7e9457ccaaadaf5d
2021-02-18 17:16:09 -08:00
Elliott Hughes
d63ea5627c Switch BionicDeathTest to #pragma once.
Test: treehugger
Change-Id: I3daded12812fb579e8b7d7abeb885ee7f17032e3
2021-02-18 17:15:25 -08:00
Elliott Hughes
527b78d194 Increase leniancy in an inherently flaky test.
The example in the bug was 16ms instead of 10ms. Try 20ms?

Bug: http://b/180581857
Test: treehugger
Change-Id: I58302ad576ab5a031124244edef9df733d796c7e
2021-02-18 10:46:35 -08:00
Elliott Hughes
20c023fdb2 iconv(3): ignore src_bytes_left if src_bytes is null.
This is undefined behavior, but glibc and macOS are both lenient, and
someone hit this in the wild, so we may as well be lenient too. (The
only cost is that it's now slightly easier to write code that works on
everything except old versions of Android.)

Bug: https://issuetracker.google.com/180598400
Test: treehugger
Change-Id: Ia217169ea6283cc53f4fbf71e5abfa08356c2049
2021-02-18 10:37:22 -08:00
Elliott Hughes
aa8db1b9d1 Fix/update notices.
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.

Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16 15:06:50 -08:00