Commit graph

15 commits

Author SHA1 Message Date
Elliott Hughes
2ddb20d29d Remove a few glibc #if hacks.
We've updated the corresponding glibc headers so we don't need these
hacks any more.

Bug: http://b/318541070
Test: treehugger
Change-Id: Ic1974f30f9edb2589cc93041822706bc89909882
2024-01-04 16:44:57 -08:00
Elliott Hughes
95646e6666 Add ASSERT_ERRNO and EXPECT_ERRNO (and use them).
We've talked about this many times in the past, but partners struggle to
understand "expected 38, got 22" in these contexts, and I always have to
go and check the header files just to be sure I'm sure.

I actually think the glibc geterrorname_np() function (which would
return "ENOSYS" rather than "Function not implemented") would be more
helpful, but I'll have to go and implement that first, and then come
back.

Being forced to go through all our errno assertions did also make me
want to use a more consistent style for our ENOSYS assertions in
particular --- there's a particularly readable idiom, and I'll also come
back and move more of those checks to the most readable idiom.

I've added a few missing `errno = 0`s before tests, and removed a few
stray `errno = 0`s from tests that don't actually make assertions about
errno, since I had to look at every single reference to errno anyway.

Test: treehugger
Change-Id: Iba7c56f2adc30288c3e00ade106635e515e88179
2023-09-21 14:15:59 -07:00
Elliott Hughes
bcaa454d32 bionic tests: use GTEST_SKIP.
Also be a bit more to the point in our messages, focusing on "why" not
"what".

Test: ran tests
Change-Id: I297806c7a102bd52602dcd2fcf7a2cd34aba3a11
2019-03-12 10:26:39 -07:00
Elliott Hughes
910a2a83a4 Fix sys_prctl.pr_cap_ambient.
This test didn't clear errno before testing it, so was sensitive to
whatever code had run before. Since I'd already added the code to dump
the exact kernel version before realizing the actual bug, I've left that
in too.

Bug: http://b/121156651
Test: ran tests
Change-Id: I38482036cb6f035c0c98c27eb64d17829f29b09a
2018-12-18 15:19:40 -08:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Greg Hackmann
0b9c5be152 Merge "Add test for ambient caps" am: 51366e9b16 am: a505507056
am: 56795edd77

Change-Id: I0a1c8212ec3d6a9b367d01a01f52325d5a96dd48
2016-12-07 16:30:07 +00:00
Greg Hackmann
ba1f77d650 Add test for ambient caps
PR_CAP_AMBIENT landed in 4.3 and has been backported to earlier kernels
in kernel/common.

Test: bionic-unit-test --gtest_filter=sys_prctl.pr_cap_ambient
Change-Id: I632f6316ef1a4eb636d2bf7e07d541e400567ef4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-12-06 15:33:27 -08:00
Brian Carlstrom
b71d2f6cad Fix x86_64 build which uses g++ and hits -Werror=unused-but-set-variable
am: 2993aaa261

Change-Id: If389245812985975992b852cbadccfd84ea14fac
2016-11-24 04:12:56 +00:00
Brian Carlstrom
2993aaa261 Fix x86_64 build which uses g++ and hits -Werror=unused-but-set-variable
Bug: 32640542
Bug: 33078014
Change-Id: Id9d3b4e69ac909078b2ac5b81acf161debcefae3
2016-11-23 18:08:25 -08:00
Christopher Ferris
1dc3ae163e Fix error case to print newlines properly.
Bug: 32640542

Test: Built and ran on a failing device.

(cherry picked from commit 4dd2785f05)

Change-Id: I81a578af7608c741819062bd54aa8e348a621b83
2016-11-16 15:34:55 -08:00
Christopher Ferris
f1e44785e5 Make prctl test check maps.
It turns out that sometimes this kernel bug can be present but not
trigger a crash. Modify the test to check for overlapping maps instead.

Bug: 32640542

Test: Verified that this fails on a device without the kernel patch
Test: (both bionic-unit-tests32 and CtsBionicTestCases32). Verified
Test: this passes on an angler.

(cherry picked from commit f1649d92f7)

Change-Id: Ia3fae3ee3d01f33d8414c1796fc3e942d5b56ec8
2016-11-16 15:32:25 -08:00
Christopher Ferris
4dd2785f05 Fix error case to print newlines properly.
Bug: 32640542

Test: Built and ran on a failing device.
Change-Id: I81a578af7608c741819062bd54aa8e348a621b83
2016-11-08 14:05:18 -08:00
Christopher Ferris
f1649d92f7 Make prctl test check maps.
It turns out that sometimes this kernel bug can be present but not
trigger a crash. Modify the test to check for overlapping maps instead.

Bug: 32640542

Test: Verified that this fails on a device without the kernel patch
Test: (both bionic-unit-tests32 and CtsBionicTestCases32). Verified
Test: this passes on an angler.

Change-Id: Ia3fae3ee3d01f33d8414c1796fc3e942d5b56ec8
2016-11-06 23:25:34 -08:00
Elliott Hughes
a9209d7a0e Fix some easy cases of __ANDROID__ versus __BIONIC__.
We need to make a clearer distinction for bionic on the host. This patch
doesn't fully address things like "should host bionic try to talk to netd?"
for now, but is a step in the right direction.

Bug: http://b/31559095
Test: bionic tests.
Change-Id: I49812f8b75d9d78c4fd8a8ddf5df1201d63771d6
2016-09-16 18:27:07 -07:00
Yabin Cui
91ce715af1 Add test for an Android kernel bug about prctl.
Bug: 20017123

Change-Id: I8c109a06999a8bffcc8e8298b04ee637bb67d878
2015-07-13 19:15:38 -07:00