Commit graph

2986 commits

Author SHA1 Message Date
Evgenii Stepanov
19e63753d2 Merge "Regression test for scudo crash in resizeTaggedChunk." 2021-11-17 06:04:01 +00:00
Evgenii Stepanov
f0d7a34e25 Regression test for scudo crash in resizeTaggedChunk.
This is a copy of the upstream scudo test for CTS:
https://reviews.llvm.org/rG913d78c40c37c9c3428285d868ce454b058e40f3

Bug: 206701345
Test: CtsBionicTestCases
Change-Id: I76b6b33c0665d7ad3bdd8c07d39a39d0d24d94df
2021-11-16 20:10:12 -08:00
Stephen Hines
30cd30f644 Remove outdated ld.bfd usage.
LLD supports `-z global`, unlike ld.gold, which this was previously a
workaround for.

Test: mm in test dir
Change-Id: I1f621c329accfb31912a19544e34447aff0dfa28
2021-11-10 18:09:49 -08:00
Treehugger Robot
4b6ae54acf Merge "uchar.h tests: small improvements." 2021-11-09 18:48:20 +00:00
Elliott Hughes
3d8156d3ec uchar.h tests: small improvements.
Explicitly test an invalid 5-byte UTF-8 sequence with mbrtoc16(3); the
fact that we weren't testing this was shown by coverage data.

Merge the surrogate pair tests in with their fewer-byte siblings to make
it clearer to a human reader that we've covered both cases.

Clear errno to make assertions about errno more convincing.

Test: treehugger
Change-Id: I485a48cc141f3e52058e2138326f3134d41b2243
2021-11-05 17:49:36 -07:00
Elliott Hughes
b6b7e2ee2e Add the missing '--' to shell invocations.
This came up with POSIX recently. Doesn't seem like it matters since
everyone's had this wrong for 40 years, but "meh" --- it's a trivial
fix, and it's strictly correct even if nobody needs this, so let's just
do it...

(Geoff Clare pointed out that my app compat concern "what if someone's
relying on this bug to pass flags to the shell?" isn't relevant because
while you can indeed do that, you then can't pass a command!)

Bug: https://austingroupbugs.net/view.php?id=1440
Test: treehugger
Change-Id: I64f6440da55e2dc29d0136ee62007197d2f00d46
2021-11-04 17:29:35 -07:00
Christopher Ferris
2abfa9e4f8 Update to v5.15 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.15

Test: Builds, and ran bionic unit tests on flame.
Change-Id: I86901ea6d89fb0f7384b90a47bef35d194083c24
2021-11-02 15:53:58 -07:00
Yi Kong
d8854293d1 Merge "Workaround Clang cannot build ifunc with LTO" 2021-10-23 12:47:26 +00:00
Yi Kong
b952a77e70 Workaround Clang cannot build ifunc with LTO
This is a KI: https://bugs.llvm.org/show_bug.cgi?id=46488

Bug: 203737712
Test: m GLOBAL_THINLTO=true bionic-unit-tests-static
Change-Id: I950a85f9676136299fc994a800d32e20bf12a8dd
2021-10-21 14:19:48 +00:00
Christopher Ferris
11526e2fc6 Add execinfo functionality.
Bug: 27877410

Test: Add new unit tests.
Change-Id: Id5d7eb27a23f50e99a04f5ee1ab64047ba269bab
2021-10-20 21:53:07 +00:00
Elliott Hughes
cf59e19e22 Add preadv2/pwritev2 wrappers.
They're in glibc, though not in musl.

Also add basic doc comments to the whole of <sys/uio.h>.

Bug: http://b/203002492
Test: treehugger
Change-Id: Ic607f7f349e5b7c9bf66c25b7bd68f827da530d6
2021-10-18 12:58:47 -07:00
Chih-Hung Hsieh
9935aa7a27 Add/allow clang-14 warnings.
* -Wstatic-in-inline found in
  libm/upstream-freebsd/lib/msun/src/s_lround.c

Test: mm in bionic/tests
Bug: 201432564
Bug: 202752322
Change-Id: I4d506fa539ab0de939d85924a5fd9a61644e4fb0
2021-10-11 12:37:56 -07:00
Elliott Hughes
b4d9304628 Merge "Move ExecTestHelper to using a regex." 2021-10-01 23:31:05 +00:00
Colin Cross
8d9297f905 Merge "Add more tests to TEST_MAPPING" 2021-10-01 21:00:23 +00:00
Elliott Hughes
419554e99c Move ExecTestHelper to using a regex.
Test: treehugger
Change-Id: I1aa6bc174e000cb57481c51109d98b8c2c5acb8e
2021-10-01 13:11:53 -07:00
Colin Cross
7b40b4dda0 Merge "Convert bionic dlext test zips to Android.bp" 2021-10-01 16:27:54 +00:00
Colin Cross
0cc60afa33 Add more tests to TEST_MAPPING
Test: treehugger
Change-Id: I1d7dd32fd7f90a20d61de4701293527f83dc4ec4
2021-10-01 09:25:36 -07:00
Colin Cross
badcb38d3c Convert bionic dlext test zips to Android.bp
Use cc_genrules to create the dlext test zips needed by the bionic
tests.  The genrules aren't visible to Make, and so don't work with
the `required` property.  Move all of the dependencies to `data_bins`,
`data_libs` or `data` for helper binaries, shared libraries or
genrule zip files respectively.  The `data*` properties copy the
files into the same directory as a test, respecting the
`bionic-loader-test-libs` relative path specified by each, but
does not put each helper binary in its own subdirectory, so update
the paths in each of the tests.

Bug: 200872604
Test: atest CtsBionicTestCases
Test: atest bionic-unit-tests
Test: cts-tradefed run commandAndExit cts -m CtsBionicTestCases
Test: adb push $OUT/data/nativetest/bionic-unit-tests /data/nativetest/ && adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Change-Id: Ic4257cb4104ff558326df2363730acd20464b051
2021-09-30 14:04:27 -07:00
Evgenii Stepanov
b34d313d17 Merge "Random HWASan cleanups." 2021-09-24 22:15:43 +00:00
Evgenii Stepanov
4edbcee2c6 Random HWASan cleanups.
Makes CtsBionicTestCases pass under HWASan.

Bug: 193568145
Test: CtsBionicTestCases
Change-Id: I38ee8a8508827c0ffee61ce33bb8c6a3f40388c9
2021-09-24 11:21:38 -07:00
Christopher Ferris
b3cac0fab4 Update allocator alignment tests.
clang was configured to force 16 byte alignments on allocations > 8
for 64 bit. Unfortunately, we never updated our alignment test to
verify this behavior. So this finally adds these new restrictions.

In addition, when GWP-ASan is enabled, it will take over allocations
from the native allocator. In order to make sure that GWP-ASan also
obeys these alignment checks, add a test that forces GWP-ASan on and
runs the alignment check test.

Test: Ran unit tests on a flame using scudo (both 32 bit and 64 bit).
Test: Ran unit tests on a flame using jemalloc (both 32 bit and 64 bit).
Change-Id: I87a20b9c2f32b9d207f36437d291ed44247dcbd1
2021-09-21 16:09:22 -07:00
Christopher Ferris
8f9713e237 Fix broken return code of M_INITIALIZE_GWP_ASAN.
When calling android_mallopt using M_INITIALIZE_GWP_ASAN, nothing
was being returned. Fix this, add a test, and also refactor the
code a bit so dynamic and static share the same code.

Test: Unit tests pass in dynamic and static versions.
Test: Passed using both jemalloc and scudo.
Change-Id: Ibe54b6ccabdbd44d2378892e793df393978bc02b
2021-09-20 18:07:07 -07:00
Colin Cross
4c5595c968 Replace local MUSL define with global ANDROID_HOST_MUSL
Bug: 190084016
Test: m USE_HOST_MUSL=true bionic-unit-tests-glibc
Change-Id: I56b23576cb24912112d2ae56d8ecc2e3716982fe
2021-08-16 16:44:24 -07:00
Colin Cross
14d1507619 Fix some clang-format issues
Fix some formatting issues that clang-format wanted to fix in the next
CL.

Test: builds
Change-Id: I37ede84672a2ae7c262da00319d7dbc132d7f4d8
2021-08-16 16:37:33 -07:00
Colin Cross
35d469ba4f Fix bionic-unit-tests-glibc for 32-bit musl
Musl doesn't define __NR_clock_gettime and __NR_gettimeofday on
32-bit architectures, #define them to __NR_clock_gettime32 and
__NR_gettimeofday_time32 respectively.

Bug: 190084016
Test: m USE_HOST_MUSL=true bionic-unit-tests-glibc
Change-Id: Iec9ba776a94639a4b6a3ad42f18dfdb0e3580f02
2021-08-16 16:32:53 -07:00
Colin Cross
7da20341e9 Build bionic unit tests for musl
Modify bionic unit tests that are built for glibc so that they also
build against musl.  They don't all pass though:

With glibc:
 2 SLOW TESTS
 4 TIMEOUT TESTS
313 FAILED TESTS
  YOU HAVE 2 DISABLED TESTS

With musl:
11 SLOW TESTS
11 TIMEOUT TESTS
363 FAILED TESTS
  YOU HAVE 2 DISABLED TESTS

Bug: 190084016
Test: m bionic-unit-tests-glibc with musl
Test: atest bionic-unit-tests-static
Test: atest --host bionic-unit-tests-glibc with glibc
Change-Id: I79b6eab04fed3cc4392450df5eef2579412edfe1
2021-08-12 11:13:11 -07:00
Colin Cross
4408b8abb0 Enable posix strerror_r test in glibc
Work around the incompatibility between libc++ and !_GNU_SOURCE
by defining a wrapper function around the posix strerror_r in
a file that does not include any libc++ or gtest headers.

Test: bionic-unit-tests-glibc
Change-Id: I6b097079777b5dcd802e295cc566964fe1c01382
2021-07-30 09:39:58 -07:00
Colin Cross
695af0da30 POSIX strerror_r returns an error number, not -1
The posix spec says strerror_r returns a positive error number,  not
-1 and set errno.

Test: bionic-unit-tests-static
Change-Id: I6a12d50d046f9caac299bf3bff63e6c9496c1b6f
2021-07-30 09:39:21 -07:00
Evgenii Stepanov
53df1f3772 Make MTE tests pass with all values of MEMTAG_OPTIONS.
Do not assume that tests start with Sync MTE; check the initial setting
and change test logic as appropriate.

Bug: 192480262
Test: bionic-unit-tests with MEMTAG_OPTIONS=(off|sync|async)
Change-Id: Id80301e6426af16f89bd80a7a7ab127b6fd60425
2021-07-12 16:33:26 -07:00
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