Commit graph

1543 commits

Author SHA1 Message Date
Elliott Hughes
cb9b9781e3 Merge "Fix our _POSIX_* macros to declare barriers and spin locks."
am: 0759e7f5c1

Change-Id: I602b845f97ce26dbc22edff2124d075951eb941c
2016-10-19 21:25:17 +00:00
Dimitry Ivanov
816676e70d Add test for libraries with textrels
Make sure android fails to load them.

Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Test: cts-tradefed run singleCommand cts --skip-preconditions -m CtsBionicTestCases
Change-Id: Id0ebdf336b2f297007479ceb1bbccf778a7ca3f2
2016-10-19 14:21:42 -07:00
Elliott Hughes
73c44a4738 Fix our _POSIX_* macros to declare barriers and spin locks.
We have these now.

Test: ran tests
Change-Id: Ie7b479061ecec19c8b35ea81e04debfd8323d94a
2016-10-19 09:28:21 -07:00
Elliott Hughes
0aec154aa8 Merge "Fix ifaddrs error handling."
am: d824421475

Change-Id: I1eb9d61522501a9e5c925a8d3b4976674169af97
2016-10-14 23:40:53 +00:00
Elliott Hughes
22950687ee Fix ifaddrs error handling.
An NLMSG_ERROR packet includes an errno value that we should use. Also report
failures to create a socket immediately, rather than falling through to the
send and reporting EBADF.

Bug: http://b/32145516
Bug: http://b/31038971
Test: bionic ifaddr tests on ryu (with broken kernel) and flounder
Change-Id: I84c480c5b75077eb90d40426a9d66d7bffbd3d51
2016-10-14 14:35:26 -07:00
Dimitry Ivanov
2e70370aaa Merge "Remove unused build targets" am: 49ef8c822f am: df4e844940
am: 7e22b1317b

Change-Id: Ia012e4ee440c14150f8a70f631bf13d5820b6553
2016-10-13 00:06:04 +00:00
Dimitry Ivanov
426960ac87 Remove unused build targets
Test: mm
Change-Id: I4eadc40411a31a0e5fa910b0054c19f0dea6c1e2
2016-10-12 14:22:58 -07:00
Elliott Hughes
8c2b7620f9 Merge "Fix Mac build." am: e89385743e am: cbe7d68916
am: 76d8f51256

Change-Id: I0f93ba5cd644eff7661392353263398e96b483c8
2016-10-11 04:12:01 +00:00
Elliott Hughes
ffbb0f8aa4 Fix Mac build.
Test: builds on Linux (I don't have a Mac)
Change-Id: I049e1d6420b0d169e727680da9c3d97e0b8aa3d2
2016-10-10 18:38:25 -07:00
Dimitry Ivanov
48d28b50ac bionic-unit-tests: remove dependency on ANDROID_DATA am: 927877c7d3 am: 474da5a6d4
am: dde2ec372b

Change-Id: I394bdb0e53af24c075f95946efcfa75d534c03b6
2016-10-11 00:53:53 +00:00
Dimitry Ivanov
676db441c8 bionic-unit-tests: Create symlinks in runtime am: 708589f5e8 am: dbad17c928
am: 56f4114322

Change-Id: I491aaf15a2bf292ea52a4137cb18b08a29c4e2c0
2016-10-11 00:53:49 +00:00
Dimitry Ivanov
927877c7d3 bionic-unit-tests: remove dependency on ANDROID_DATA
Replace references to ANDROID_DATA enviroment variable with references
to g_testlib_root.

Bug: http://b/22182538
Test: build and run bionic-unit-tests --gtest_filter=dl*:Dl*
Test: make cts && cts-tradefed run singleCommand cts --skip-preconditions -m CtsBionicTestCases
Change-Id: I5667e991551cec55b9b664f2f0063039671ff34b
2016-10-10 13:56:20 -07:00
Dimitry Ivanov
708589f5e8 bionic-unit-tests: Create symlinks in runtime
Instead of creating symlinks in build time and then relying
on usage of adb sync (adb push follows symlinks) - create
them in test run time.

Test: mm && run bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/22182538
Change-Id: I9d2a873e3ba303533c14ba5e3b779e4a67925462
2016-10-10 04:41:56 -07:00
Dimitry Ivanov
ff006267b6 Fix bionic-unit-tests am: d11d1e4a97 am: 1a4e213bce
am: ec7a2273c6

Change-Id: Iecf8f9499e4c5a495800a159cdfdea0ba4120824
2016-10-05 16:30:02 +00:00
Dimitry Ivanov
d11d1e4a97 Fix bionic-unit-tests
Fix rpath value for libraries after build system update

Bug: http://b/31221587
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*:*atexit*
Change-Id: Iaed834bef830fd0b252b5de82e27634bafc92d8b
2016-10-05 02:58:25 -07:00
Elliott Hughes
2d9fe94b92 Merge "Fix mbsnrtowcs where dst is null." am: b81ade6203 am: b11335cf6c
am: ec198c17f7

Change-Id: I6e4c3dbe04ac929aabad0abe74830879c48b28fa
2016-09-30 15:54:09 +00:00
Elliott Hughes
3276d7ae3f Merge "Fix tests/run-on-host.sh for glibc." am: d43c8891ae am: f8cafd1ade
am: 9c948d555d

Change-Id: I83a41930cbc297b9acf273cca7daac20d5b68ac0
2016-09-30 15:53:57 +00:00
Elliott Hughes
b81ade6203 Merge "Fix mbsnrtowcs where dst is null." 2016-09-30 15:41:40 +00:00
Elliott Hughes
d43c8891ae Merge "Fix tests/run-on-host.sh for glibc." 2016-09-30 15:37:48 +00:00
Colin Cross
9510ee8453 Merge "Update escaping in Android.bp files" am: 83e9f36a11 am: ffddaa224f
am: 6fac759338

Change-Id: Iec71672602f38aa32a6cb02a56eff880b9fc152c
2016-09-30 04:26:51 +00:00
Elliott Hughes
89e29ee485 Fix mbsnrtowcs where dst is null.
POSIX is its usual unintelligible self
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/mbsrtowcs.html),
but the ISO C11 standard (7.29.6.4.1 paragraph 2) is pretty clear: *src
should change if and only if dst is non-null.

Bug: https://code.google.com/p/android/issues/detail?id=166381
Test: bionic tests
Change-Id: Ibc631cfa5b1bf4a6f56963feba9f0eea27b07984
2016-09-29 17:26:13 -07:00
Elliott Hughes
f48f499329 Fix tests/run-on-host.sh for glibc.
Test: tests/run-on-host.sh glibc
Change-Id: Idd5b2a72335ff0ca47f37c578f71cec8c9fb6ea0
2016-09-29 17:17:15 -07:00
Colin Cross
7b29495d0a Update escaping in Android.bp files
Strings like cflags in Android.bp files are parsed by blueprint,
written to build.ninja files, parsed by ninja, and then passed to
/bin/sh -c.  This had resulted in a combination of blueprint
(\"), ninja ($$), and shell (\$) escaping being necessary.

Soong has been updated to automatically handle ninja and shell
escaping, remove extra escaping from Android.bp files.

Bug: 31221587
Test: m -j
Change-Id: Ib58a51dee8d22296b69ec21768ba6a49dd60e980
2016-09-29 14:37:30 -07:00
Elliott Hughes
d6d868f116 Merge "Fix complex.csqrtf test and add a trivial sincosl test." am: 424a5f629c am: 1692a4d2bc
am: 43aa53bd2f

Change-Id: Ib2df9b109833f697c6e1b8ab1aa9d1e01fc4b4f3
2016-09-26 18:43:46 +00:00
Elliott Hughes
e9719f3fb5 Fix complex.csqrtf test and add a trivial sincosl test.
sincos and sincosf are being tested more thoroughly with a table of data,
but there's nothing equivalent for sincosl.

Test: ran the tests, obviously.
Change-Id: I5b4b22b73cad9b0030549de2e2ed2a0e38648806
2016-09-26 09:35:04 -07:00
Nick Desaulniers
7031660c7a Merge "bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE" am: 904460f749 am: 1d52d65277
am: d22c7a5540

Change-Id: I631cb5e71d98dafd2873abc7e705eeeb70f3000d
2016-09-22 00:50:24 +00:00
Nick Desaulniers
09d900d50f bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE
Bug: 28760453
Change-Id: I1a58d19bf45eac5f930b0f649cf9b8c9046302f3
2016-09-21 09:24:50 -07:00
Elliott Hughes
42aa9c0c91 Merge "Fix some easy cases of __ANDROID__ versus __BIONIC__." am: 42743f1e9e am: 38718ceac2
am: f23b244930

Change-Id: Ib500aae8607217b7a4ba90118ef30bb8c0162e38
2016-09-17 16:52:19 +00:00
Elliott Hughes
42743f1e9e Merge "Fix some easy cases of __ANDROID__ versus __BIONIC__." 2016-09-17 16:40:59 +00: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
Dimitry Ivanov
4c8f9960be Merge "Make static library for loader tests" am: 9d4d60b480 am: 0a727b2550
am: dc1089d246

Change-Id: Id4746100460e1bf3e017bd064ea928485c11a1fe
2016-09-16 16:26:08 +00:00
Treehugger Robot
9d4d60b480 Merge "Make static library for loader tests" 2016-09-16 16:14:48 +00:00
Josh Gao
38ee712325 Fix instances of '#if __LP64__'. am: b36efa4343 am: 8a72a46efa
am: 3b994ab10a

Change-Id: Iff93d422199f43900b98797f63ff5509cb4e7ed4
2016-09-15 23:51:29 +00:00
Dimitry Ivanov
c462c28afe Make static library for loader tests
1. Extract bionic loader tests to static library in
order to link it to bionic cts tests.
2. Make libpagemap dependency static to reduce dependencies
on internal native libraries.

Bug: http://b/22182538
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I5decd5893e6338c84b3ab23e1d65d70bd75ad880
2016-09-15 16:25:31 -07:00
Josh Gao
b36efa4343 Fix instances of '#if __LP64__'.
Triggers -Wundef, which is on in -Weverything.

Bug: http://b/31496165
Change-Id: Ib06107073f7dd1d584c19c222d0430da9d35630b
2016-09-15 14:21:28 -07:00
Kenny Root
1e59055c02 Merge "Fix memory leak in test util" am: b32184eb84 am: 3c749f13d3
am: 89ac2d147f

Change-Id: Ic6fd8973117772e49a5ebc01796e96bbc2f35750
2016-09-15 19:27:05 +00:00
Kenny Root
f0cccdbe19 Fix memory leak in test util
This shows up when you're doing make HOST_SANITIZE=address

Test: mmma bionic && out/host/linux-x86/bin/bionic_tests_zipalign (compare before and after)
Change-Id: Ia94790496327f3818d5fdb7b5ad07e14e60bcae1
2016-09-14 17:24:37 -07:00
Dimitry Ivanov
c6c430e35e Merge "Move test libraries under /data/nativetests" am: 0f81dd3548 am: b2d09c71b1
am: 866e9945d8

Change-Id: I459669903cf3ac1a900d63544b97be51ebd0cd48
2016-09-09 19:08:53 +00:00
Treehugger Robot
0f81dd3548 Merge "Move test libraries under /data/nativetests" 2016-09-09 18:58:34 +00:00
Elliott Hughes
ab728c07a5 Merge "Fix sscanf/wcstod parsing of NaNs." am: 8327a1707b am: ba04201f58
am: 3369646f57

Change-Id: I545ba4caee145e51869158b3073bd02fdde3f212
2016-09-07 23:15:53 +00:00
Elliott Hughes
7f0849fd11 Fix sscanf/wcstod parsing of NaNs.
The parsefloat routines -- which let us pass NaNs and infinities on to
strto(f|d|ld) -- come from NetBSD.

Also fix LP64's strtold to return a NaN, and fix all the architectures
to return quiet NaNs.

Also fix wcstof/wcstod/wcstold to use parsefloat so they support hex
floats.

Lots of new tests.

Bug: http://b/31101647
Change-Id: Id7d46ac2d8acb8770b5e8c445e87cfabfde6f111
2016-09-07 15:01:54 -07:00
Elliott Hughes
fde473ed67 Merge "Fix time.mktime_EOVERFLOW for LP32." am: 52ea18658f am: c97a9f0e64
am: fac932c36b

Change-Id: I9a8a96a3f8247ab3b8a94ac7e45759effea1a3b1
2016-09-06 23:06:11 +00:00
Elliott Hughes
47126edb90 Fix time.mktime_EOVERFLOW for LP32.
Times before 1901-12-13 *underflow* on LP32, making the year 1900 a bad
choice for success case.

Bug: http://b/31305222
Change-Id: I20d4885c80b57707225580db044abc8948a55fdc
2016-09-06 13:34:15 -07:00
Dimitry Ivanov
a36e59bb99 Move test libraries under /data/nativetests
Move libraries used in bionic-unit-tests out of system partition to
/data/nativetests../bionic-loader-test-libs

Bug: http://b/22182538
Test: build bionic and run bionic-unit-tests
Change-Id: I170177bef782839d0b4970ae4418bf54d0a77836
2016-09-02 14:27:47 -07:00
Dan Willemsen
299b5e6e68 Merge "cc_test_library now creates shared libraries too" am: dd14725eeb am: 4b5216d677
am: 9b6737e86d

Change-Id: I6584eb2cb237f8155fdeebcce033244d0726e786
2016-09-01 01:41:12 +00:00
Treehugger Robot
dd14725eeb Merge "cc_test_library now creates shared libraries too" 2016-09-01 01:27:01 +00:00
Elliott Hughes
701a726abd Merge "List failing tests last, to reduce the amount of scrolling." am: af071ed598 am: beb7c64177
am: b349ce0025

Change-Id: Icfaf21eff547f4519e5943860471c7522e969923
2016-08-31 23:37:58 +00:00
Dan Willemsen
4156770d84 cc_test_library now creates shared libraries too
Make these compile as static libraries by properly declaring their
dependencies.

I turned off the shared version of libBionicTests because it produces
this linker warning (treated as error):

external/libcxx/include/sstream:859: warning: relocation refers to
discarded section

Change-Id: I2e1448b47a441b273d208ebd068d0d22e340a0ff
2016-08-31 16:35:01 -07:00
Elliott Hughes
a456fae45f List failing tests last, to reduce the amount of scrolling.
On actual devices, we have a lot of slow tests. Warnings about those
cause cause the failed tests to scroll off the display.

Also replace the made-up word "warnline".

Change-Id: I6b579521a21b56da8a1add08cd34888fc902646e
2016-08-31 14:49:32 -07:00
Dimitry Ivanov
b276c80443 Merge "Remove $(module)_install_to_out_data flag from test makefile" am: 6d7a1eec4c am: a9c9129009
am: 729a12e3ec

Change-Id: I431f776bc02fbad7b3acdd313fdbbac912acdfbb
2016-08-30 21:29:12 +00:00
Treehugger Robot
6d7a1eec4c Merge "Remove $(module)_install_to_out_data flag from test makefile" 2016-08-30 21:16:33 +00:00
Elliott Hughes
6bdfbabd01 Merge "Fix SysV IPC test failures on Android devices." am: af730e63a3 am: c5b5e3adc8
am: 85256c71ab

Change-Id: I1de032b341d0172f17090a8c3099d1f651669156
2016-08-30 19:48:05 +00:00
Elliott Hughes
af730e63a3 Merge "Fix SysV IPC test failures on Android devices." 2016-08-30 19:35:04 +00:00
Dimitry Ivanov
b16e443239 Remove $(module)_install_to_out_data flag from test makefile
Use non-empty $(module)_install_to_out_data_dir as indication
of custom target dir for a library.

Bug: http://b/22182538
Test: build and run bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Ibfc87f45084a6fe2f487ca1b17a7625a8d8ec707
2016-08-30 11:38:43 -07:00
Alex Vakulenko
e9014474c9 Fix pty.bug_28979140 test in Bionic
The test relies on the fact/assumes that CPU 0 is available to the
test process. This is not necessarily the case. Instead of allocating
CPU 0 to the main thread, find the first available CPU and use that
instead.

BUG=b/29991929
TEST=All Bionic unit tests pass

(cherrypick of 766275e7f697c30164678e1fed55b2a2fcbf8546.)

Change-Id: I36b311cdba57112d663d652757fd5114183fc780
2016-08-27 09:12:31 -07:00
Elliott Hughes
40bae4fc89 Fix SysV IPC test failures on Android devices.
SysV IPC has been compiled out of all our kernels.

Change-Id: I1294459697ed7dff4f21af5c7b04c8b3d3649329
2016-08-26 19:23:39 -07:00
Elliott Hughes
1cfad1622d Merge "Fix execvp/execvpe behavior with absolute paths and ENOEXEC." am: 6395a3047a am: bb4f16227e
am: 389869899a

Change-Id: I5811305ab1495f4c3917e42bef31dcfceff11bfa
2016-08-26 16:28:06 +00:00
Elliott Hughes
63615066d9 Fix execvp/execvpe behavior with absolute paths and ENOEXEC.
Bug: http://b/31091962
Change-Id: Id0b3d41868f5e3ed1ccf618bfefb46609367bc9a
2016-08-25 17:40:27 -07:00
Elliott Hughes
7d15ac6ee1 Merge "Fix execvpe ENOEXEC behavior." am: e1d792b10c am: 745c5e5bf6
am: 32bde59fd0

Change-Id: I84a0a9b05fde3fd11e931997e7305c43ca952af7
2016-08-25 16:34:48 +00:00
Elliott Hughes
3c1159024c Fix execvpe ENOEXEC behavior.
The special case for absolute paths wasn't handling ENOEXEC.

Also add more extensive tests for execvpe.

Also switch to manually doing the fork in ExecTestHelper::Run because
ASSERT_EXIT doesn't actually return, meaning we were only running the
first part of each test.

Bug: http://b/31073104
Change-Id: I7a4640afc6d290c51ba2e66fc1b9bb6b0fc174f7
2016-08-24 22:56:52 -07:00
Elliott Hughes
dc2e87b302 Merge "Rewrite the exec family." am: fac56897f8 am: 6c7d654f69
am: 50a7bc7ead

Change-Id: I8009f1f5afb1844969780eb8346c7b3ac7984716
2016-08-24 21:33:04 +00:00
Treehugger Robot
fac56897f8 Merge "Rewrite the exec family." 2016-08-24 21:21:43 +00:00
Elliott Hughes
1b40aafe3f Rewrite the exec family.
* Removes duplication.
* Removes fixed PATH_MAX limit.
* Adds basic tests.

Bug: http://b/30032507
Change-Id: I4087a9de3e53884ac3297ebafbec4e6f8a9871b6
2016-08-24 13:03:04 -07:00
Alex Vakulenko
3fcca8b80a Fix pty.bug_28979140 test in Bionic am: 766275e7f6
am: 90e3740912

Change-Id: I155a7fb41860615e00d411c85c6f53c5e8230ee0
2016-08-24 06:27:08 +00:00
Alex Vakulenko
766275e7f6 Fix pty.bug_28979140 test in Bionic
The test relies on the fact/assumes that CPU 0 is available to the
test process. This is not necessarily the case. Instead of allocating
CPU 0 to the main thread, find the first available CPU and use that
instead.

BUG=b/29991929
TEST=All Bionic unit tests pass

Change-Id: I36b311cdba57112d663d652757fd5114183fc780
2016-08-23 21:26:37 +00:00
Elliott Hughes
123d261d85 Merge "Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>." am: 7d4e28a486 am: a0a3a8c3b6
am: 2e805b4f1a

Change-Id: Ic5cdfacb332a9cbd2a958a81f78b80099961aebf
2016-08-19 00:09:26 +00:00
Elliott Hughes
7d4e28a486 Merge "Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>." 2016-08-18 23:58:43 +00:00
Elliott Hughes
7c59f3f6f3 Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>.
Also fix <sys/ipc.h>.

Not useful except to systems/bringup folks for testing. Trivial tests
added, and double-checked under strace to see that things look right.

x86 -- which works differently to everything else -- tested on the host.

Bug: http://b/27952303
Change-Id: I328534e994ae9e90755f545478fba03038c0bb94
2016-08-18 15:23:38 -07:00
Dimitry Ivanov
076677961d Merge "[mips] Add missing linker shdr tests" am: fc9958ce76 am: 2223d5bb1c
am: 41b5e450e3

Change-Id: If324ce069b699987b836232e025b6fa29f897fdc
2016-08-17 19:07:30 +00:00
Dimitry Ivanov
fc9958ce76 Merge "[mips] Add missing linker shdr tests" 2016-08-17 18:29:52 +00:00
Elliott Hughes
acfa40ef15 Merge "Fix memmem behavior with empty needles." am: ce8a5b4b9d am: c8d967f0ec
am: 7fbe92cc29

Change-Id: Ifdeb9fe91fca986e954935ee1dcc6f48e792461b
2016-08-16 21:09:40 +00:00
Treehugger Robot
ce8a5b4b9d Merge "Fix memmem behavior with empty needles." 2016-08-16 20:56:54 +00:00
Elliott Hughes
cae33ade6c Fix memmem behavior with empty needles.
Change-Id: I8b893d80c27b548652d843af9520d7adc8ba8902
2016-08-16 12:28:58 -07:00
Nikola Veljkovic
44a654446e [mips] Add missing linker shdr tests
Test: bionic-unit-tests for mips, mips64.
Change-Id: I8ed5f03df8d129e74fa04be2b203bd113a381888
2016-08-16 18:52:06 +00:00
Dimitry Ivanov
45153a305e Merge "linker: add test for zeroed out shdr_table_" am: 3b2d331e77 am: b500830389
am: 8613fdc059

Change-Id: I3f4f0c7a7ca96741523b2203fb5cf59740636908
2016-08-15 23:35:59 +00:00
Treehugger Robot
3b2d331e77 Merge "linker: add test for zeroed out shdr_table_" 2016-08-15 23:23:26 +00:00
Dimitry Ivanov
65eb9b5bf8 Merge "linker: add test for zero shdr offset" am: 4154b77285 am: a9e2c78f8a
am: 989764a73f

Change-Id: Ia6507de40c3c4d9011d75e7337114e0b4ccce371
2016-08-15 22:17:54 +00:00
Treehugger Robot
4154b77285 Merge "linker: add test for zero shdr offset" 2016-08-15 22:01:30 +00:00
Lazar Trsic
ecb70b92c8 Merge "[MIPS] Fix bionic test build" am: 63ccb1bdac am: 05d6befe01
am: d6b302458f

Change-Id: I88d2004d81c0242cc5b59ba90422ee3b173c7252
2016-08-15 21:21:20 +00:00
Dimitry Ivanov
559583469c linker: add test for zeroed out shdr_table_
Bug: http://b/30795430
Change-Id: I86b658d01b64670d3e702ddb1d3f9db4f75d784f
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 14:06:04 -07:00
Treehugger Robot
63ccb1bdac Merge "[MIPS] Fix bionic test build" 2016-08-15 21:00:47 +00:00
Dimitry Ivanov
4623044517 linker: add test for zero shdr offset
Bug: http://b/30795430
Change-Id: I03853257c4b632ad9daaf1e90f9620678397cff0
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 13:42:47 -07:00
Elliott Hughes
f1598c86c6 Merge "Fix mktime's errno behavior." am: 228e747b6c am: b3ed1c5202
am: 368f348d16

Change-Id: I07e4a8a8d8352e351843d7bc66c5ac3ba26bc464
2016-08-15 20:34:47 +00:00
Dimitry Ivanov
9d268ffff2 Merge "linker: add test for empty shdr table" am: ac69db1f85 am: 68418746f2
am: d49567855e

Change-Id: I01f2357153b07da5bd34a7470c4bbf1dca812b28
2016-08-15 20:34:47 +00:00
Treehugger Robot
228e747b6c Merge "Fix mktime's errno behavior." 2016-08-15 20:06:57 +00:00
Lazar Trsic
293d5132d0 [MIPS] Fix bionic test build
Group of libtest_invalid* libraries does not exists for mips architecture,
so disable relevant tests.

Change-Id: I3a4fef94933eb33654c4274aa249ea5d61d6cf9b
2016-08-15 12:48:20 -07:00
Dimitry Ivanov
c268eb96d7 Merge "linker: add test for zero shstrndx" am: 21482db6e1 am: 5a66605226
am: cea5f282a8

Change-Id: Icd0e32a99fc0250ed3eecec97f25f81c7fd99f2e
2016-08-15 19:05:09 +00:00
Dimitry Ivanov
8bdf70e6e4 linker: add test for empty shdr table
Bug: http://b/30795430
Change-Id: Id839c22f88276f31e0615bc2a67d75e27a9aa7c6
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 11:30:45 -07:00
Dimitry Ivanov
c9a95613a9 linker: add test for zero shstrndx
Bug: http://b/30166532
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: I4cec73635cf403df9dd60b9a294d2298bb0abe3d
2016-08-15 10:29:50 -07:00
Dimitry Ivanov
3ae29cd6d3 Merge changes Ibcefd6d9,I249c0815,If59cb6da am: 0deb70cd04 am: aa2798e9a8
am: 1d539ce83d

Change-Id: Ifafcb9c4d10e0c2dbfc312505faa4e6abd4b54ce
2016-08-13 03:55:09 +00:00
Dimitry Ivanov
0deb70cd04 Merge changes Ibcefd6d9,I249c0815,If59cb6da
* changes:
  Remove some duplication in the makefile
  linker: add test for zero e_shentsize
  Add test for misaligned section header
2016-08-13 03:42:15 +00:00
Dimitry Ivanov
ff25581083 Remove some duplication in the makefile
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: Ibcefd6d913abafe0b202a83399db72050510cd5d
2016-08-12 16:55:17 -07:00
Elliott Hughes
f8ebaa4985 Fix mktime's errno behavior.
Don't touch errno on success, do set it to EOVERFLOW (the only allowed errno
value according to POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/mktime.html)
on failure.

Bug: http://b/30477946
Change-Id: Ia915c7b9c3bfcd2f9025530cf5b068fe4dd4fd9e
2016-08-12 16:28:36 -07:00
Dimitry Ivanov
cb86c3128f linker: add test for zero e_shentsize
Bug: http://b/30166532
Bug: http://b/30795430
Change-Id: I249c081563f0ca7bcc799d8445a53683616eaa4e
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-12 15:28:42 -07:00
Dimitry Ivanov
972e3d0787 Add test for misaligned section header
Make sure linker does not crash when dlopening
elf-file with odd section header offset.

Bug: http://b/30795430
Bug: http://b/30687964
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: If59cb6da85b8752a69dc5687de85f9a9b74c92b4
2016-08-12 14:48:15 -07:00
Elliott Hughes
fd7a70e3d4 Merge "Fix sysconf(_SC_ARG_MAX)." am: 51b3b44585 am: 8407ddebec
am: 50cef99a8f

Change-Id: Ia0e9fb045ba618918eab2e7e8b56386e53623249
2016-08-12 20:18:42 +00:00
Elliott Hughes
51b3b44585 Merge "Fix sysconf(_SC_ARG_MAX)." 2016-08-12 19:53:46 +00:00
Dimitry Ivanov
30a5ab1180 Merge "linker: disallow W + E PT_LOAD segments" am: e8087022c1 am: 3c2f0a2c39
am: 070b462b89

Change-Id: I33f9fa8d81b8cf5f009f5d8ea4f9c135a069977f
2016-08-12 18:06:31 +00:00
Dimitry Ivanov
e8087022c1 Merge "linker: disallow W + E PT_LOAD segments" 2016-08-12 17:55:36 +00:00
Elliott Hughes
18474bdfbf Merge "Use sysinfo(2) to implement more of <sys/sysinfo.h>." am: b17d845d9b am: fb94c6396e
am: bf74aa362d

Change-Id: Ib55e38785172da8afce78459f75e52e2c7cc73f1
2016-08-12 17:25:46 +00:00
Treehugger Robot
b17d845d9b Merge "Use sysinfo(2) to implement more of <sys/sysinfo.h>." 2016-08-12 17:07:41 +00:00
Dimitry Ivanov
9700babc05 linker: disallow W + E PT_LOAD segments
No mapped segment from the elf file can be writable and
executable at the same time. This commit adds a check
for malformed PT_LOAD segments in the elf-files.

Bug: http://b/30146890
Test: run bionic-unit-tests --gtest_filter=dlfcn.*
Change-Id: Ia23acbe5a48780b65d7e4a50bbe024cd528079f4
2016-08-11 17:24:47 -07:00
Elliott Hughes
c508de0e41 Use sysinfo(2) to implement more of <sys/sysinfo.h>.
We already had implementations of some of the functions, and I didn't
bother rewriting them when we added sysinfo(2). Ross Anderson said in
https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
that we should "simply disable access to all procfs files", which made
me curious how many places we use /proc in bionic. This is the one that's
obviously unnecessary. The others I'm not aware of alternative APIs for.

Change-Id: Ia64f36b76f29a7a1dd67845270a5472e121aae10
2016-08-11 14:51:31 -07:00
Elliott Hughes
38dba2e7e1 Fix sysconf(_SC_ARG_MAX).
ARG_MAX hasn't been a constant since Linux 2.6.23.

Bug: http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html
Change-Id: I1eddb562751604c75b89fa610d79be0655c53693
Test: ran the bionic tests on device and against glibc
2016-08-10 15:51:06 -07:00
Elliott Hughes
e4e137429d Merge "Fortify vsnprintf in more cases." am: af211ab23f am: 732a173505
am: ef0d3c20c4

Change-Id: I898db96198c67b453c0d3f20902aaea7705ca080
2016-08-10 21:45:20 +00:00
Elliott Hughes
fb3873d4db Fortify vsnprintf in more cases.
Bug: http://b/30445072
Change-Id: I1893890f0e3b56533eef053eda1bd96a0b9a5119
2016-08-10 11:50:12 -07:00
Elliott Hughes
68bc2f7567 Merge "Reimplement remove(3) without the lstat(2)." am: 7e93d9c675 am: 6d0c5d096b
am: 28279b5777

Change-Id: I4d89e78b9135524f0839a29202a66e36ba5b8147
2016-08-06 01:21:55 +00:00
Elliott Hughes
d1f25a7eb1 Reimplement remove(3) without the lstat(2).
This assumes that it's more likely we're unlinking a file than a directory,
though even if that's not true, as long as a failed unlink(2) is cheaper
than a successful lstat(2) -- which seems likely since there's no data to
copy -- we still win.

Change-Id: I0210e9cd3d31b8cf1813c55c810262ef327382ed
2016-08-05 15:53:03 -07:00
Elliott Hughes
8bbcc61b54 Add a test for a known kernel bug.
Bug: http://b/27265969

(cherry picked from commit 4a253496b8)

Change-Id: Ibf0b6457b02e89b90bc86c9367e14021c606356b
2016-08-02 12:31:43 -07:00
Elliott Hughes
cd7ec0ff65 Merge "More stdio one-liners." am: 1d8b312a07 am: 038edf9186
am: de4d6c5f76

Change-Id: Ic2b933dc68c3a21dbc92a0059973ddd54a5d40d9
2016-08-02 02:44:08 +00:00
Elliott Hughes
70715da453 More stdio one-liners.
This actually turns up a bug in fmemopen, so I guess that's what I'll
look at next...

Change-Id: I2971ecd1b5a3a3c7f43c22d985f88e389af89e97
2016-08-01 18:06:38 -07:00
Elliott Hughes
08f23b87ba Merge \\\"Upgrade to tzcode-2016f.\\\" am: def5854676 am: 44ff2f9d01
am: 7ef55501f5

Change-Id: Ib811b1027e0865f7accd4979cf2208b0ed894a6b
2016-07-30 05:25:22 +00:00
Elliott Hughes
0a610d00fe Upgrade to tzcode-2016f.
No significant changes other than a default implementation of strftime_l.

Change-Id: I6edd2c03e5e7559f012c0c87d43f7109d641d3ca
2016-07-29 14:04:17 -07:00
Elliott Hughes
31ac4d6f7d Merge \\\"Admit that we don\\\'t actually support thread priority inheritance.\\\" am: c7d97ec31d am: 08c2cb0fd4
am: 08e8acaa5a

Change-Id: If5c2c2413988de493e0e2626e7577fc6092f0e1b
2016-07-28 00:11:28 +00:00
Elliott Hughes
7292725bcd Admit that we don't actually support thread priority inheritance.
Bug: https://code.google.com/p/android/issues/detail?id=218323
Change-Id: I6c69b0fbb8414e7cc2deeb8be50b6af4830ed55e
2016-07-27 14:05:10 -07:00
Elliott Hughes
ccd0c3aa49 Merge \\\"Stop #define\\\'ing __func__ and __restrict.\\\" am: e656a3acaf am: 28250109c2
am: e69f6d8d96

Change-Id: If5af9adb648575f6df2af269faded0d66e5f3fff
2016-07-25 22:48:05 +00:00
Elliott Hughes
f6495c78a8 Stop #define'ing __func__ and __restrict.
__STDC_VERSION__ isn't defined for __cplusplus, so we've been removing
such checks. Some got missed.

Stop defining __func__ and just use the __PRETTY_FUNCTION__ GCC extension
in <assert.h>. Also fix the #if there so that C++ gets __assert2 rather
than __assert, and rewrite the cast to work with -I rather than -isystem.

Also remove __restrict and just always use the __restrict GCC extension.

Add a trivial test for <assert.h>.

Bug: http://b/30353757
Change-Id: Ie49bb417976293d3a9692b516e28fe3c0ae0a6d9
Test: ran bionic unit tests.
2016-07-25 11:13:47 -07:00
Elliott Hughes
ddea966f7a Merge \\\"Remove bionic\\\'s now-unused UniquePtr.\\\" am: 557b3a1194 am: 6c7b1953fb
am: 64c55b1fa8

Change-Id: Ic22c19899f72ecadb1dc682a8a6390f6b556a046
2016-07-23 03:59:36 +00:00
Elliott Hughes
1291e50173 Remove bionic's now-unused UniquePtr.
Change-Id: Id77dbdd6d4255ae8317449725ef093be9422407f
2016-07-22 19:52:46 -07:00
Christopher Ferris
5bbe259b28 resolve merge conflicts of 823e32e to stage-aosp-master am: 1750ab4e21
am: cf02165ee3

Change-Id: I3c9ff3f8992d3a8d36e6c45e3526107796b95cec
2016-07-21 02:14:06 +00:00
Dimitry Ivanov
5543746934 Pass argc/argv/envp to dso constructors
The glibc implementation of the loader passes argc/argv/envp
to all elf constructors. This change makes bionic linker
behave in the same way.

Bug: http://b/30145768
Change-Id: I1c65c42aa5305a5b133c64b5748205bbde869e0e
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
2016-07-20 16:10:19 -07:00
Elliott Hughes
e227492f79 Merge \\\"Add a test for a known kernel bug.\\\" am: 061cf180db am: a2487be0c7
am: d151b7505e

Change-Id: Ic3ac405a7926d871311222ec8645b0573f2fb810
2016-07-19 18:15:56 +00:00
Treehugger Robot
061cf180db Merge "Add a test for a known kernel bug." 2016-07-19 17:52:03 +00:00
Elliott Hughes
8f326adfab Merge \\\"Don\\\'t declare SYS_* constants for unavailable __NR_* constants.\\\" am: 20de9ef5bd am: 1b2b8362c9
am: 36edfa0260

Change-Id: Ic2fc7cbae83a207b3409f9d3fcd47df97ff76be1
2016-07-18 20:55:49 +00:00
Elliott Hughes
d2f725eaed Don't declare SYS_* constants for unavailable __NR_* constants.
Bug: https://code.google.com/p/android/issues/detail?id=215853
Change-Id: Iaaa3ce888deb8d032208bf636b7badaed6a72d30
2016-07-18 12:48:39 -07:00
Elliott Hughes
4a253496b8 Add a test for a known kernel bug.
Bug: http://b/27265969
Change-Id: I981cb6a91015bd17d362987ed12c8ca638987c5b
2016-07-14 17:07:17 -07:00
Colin Cross
e6ae372c11 Merge \\\"Convert bionic benchmarks and tests to Android.bp\\\" am: 55653cc33b am: 2d61b5bc3a
am: 6de6d43cd3

Change-Id: I9c826c1eb0c20f21eff250c34a300547acb968e2
2016-07-14 21:16:21 +00:00
Colin Cross
2722ebb30b Convert bionic benchmarks and tests to Android.bp
The compile-time tests and a few custom libraries for dynamic linker
testing are still compiled in make.

Also converts the make rules to run tests on the host to shell scripts
in tests/run-on-host.sh and benchmarks/run-on-host.sh

Change-Id: I6f174b3a69d58c4ed74d29f4e79332d483681534
2016-07-14 12:30:12 -07:00
Dimitry Ivanov
8160c2c21f Merge \\\"Fix dlext.ns_smoke test\\\" am: 48cedda02a am: 4b0c4250d2
am: a80d01e62b

Change-Id: I02f363288a29e2fcaacb2bbf225c5e42b6947511
2016-07-14 00:38:59 +00:00
Dimitry Ivanov
3a6c6b3254 Fix dlext.ns_smoke test
Check for updated error_message

Change-Id: I0f0dd59a6deba016d37d0ccc80113b62db86c1c2
Test: adb shell bionic-unit-tests32/64 --gtest_filter=dlext.ns*
2016-07-13 16:28:20 -07:00
Yabin Cui
a2b17388bf Merge \"Add test for a pty kernel bug.\" into nyc-mr1-dev
am: 8a05740714

Change-Id: I42f9d6bde58d23a54147a1b8ad1c7865a1ff23d1
2016-06-15 21:40:29 +00:00
Yabin Cui
f35c6bc70f Add test for a pty kernel bug.
Bug: 28979140
Change-Id: Iad79fcb7a3c5b068f625c7902785cc6e696fe9a1
2016-06-15 10:59:45 -07:00
Elliott Hughes
3ba55f8022 Rationalize visibility.
If it's C or POSIX, it's in. If it's BSD or GNU, it's guarded by __USE_BSD
or __USE_GNU.

Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: Ife51a21c2b37b060db56780d29c929805b199cb6
2016-06-09 17:40:19 -07:00
Elliott Hughes
20788aec00 Add ctermid.
Change-Id: I7c7c815c2725df222932db923632c8b6419741ab
2016-06-09 15:16:32 -07:00
Elliott Hughes
449eff02d2 Add futimes, futimesat, and lutimes.
Spotted these while cleaning up <sys/cdefs.h> --- if we remove __USE_XOPEN2K8,
libchrome decides you "must" have futimes. Adding the missing functions (all
just alternative interfaces to utimensat(2) system call) lets us clean up
without breaking anything.

Change-Id: If44fab08ee3de0e31066d650d128a3c96323529b
2016-06-08 19:51:20 -07:00
Elliott Hughes
f4840507b5 Preliminary cleanup of <sys/cdefs.h>.
We don't support anything other than Clang and GCC, and we don't support
GCC earlier than 4.9.

Move the various synonyms for __attribute__(__whatever__) together.

Fix a __STDC__VERSION__ (for __STDC_VERSION__) typo.

Drop support for BSD _ANSI_SOURCE and _C99_SOURCE; there's enough confusing
nonsense here already, and plenty of other ways to ask for obsolete standards.

There are plenty more problems here -- what I really want to do is rationalize
our treatment of __STDC_VERSION__ -- but let's get some of this easy stuff
out of the way first.

Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: I7526b9770fdc01f8a4667781b65e2fb08287b20b
2016-06-06 17:35:53 -07:00
Chih-Hung Hsieh
d61ca37d35 Fix misc-macro-parentheses warnings in bionic/tests.
Bug: 28705665
Change-Id: I532205b94e30acbdc97f3f4db0660c9a16a7de89
2016-06-03 10:18:07 -07:00
Chih-Hung Hsieh
9af13d24b1 Do not return with stack address in global variable.
Clang static analyzer gives warning when address of
local variable 'attr' is saved in a global variable.
This change passes required values down to signal handler
instead of saving local variable address in a signal handler.

Change-Id: I7955939487a5afdf7b1f47eb74a92eb5aa76cfc9
2016-06-02 15:02:25 -07:00
Christopher Ferris
a948a4e050 Change use of /data to /data/local/tmp.
The unistd fsync/fdatasync were changed to use /data from /.
Unfortunately, this directory is unreadable unless you are root, so
change this path to /data/local/tmp.

Bug: 28885777
(cherry picked from commit 7e53843f7b)

Change-Id: I14514e985af8039ab63ac2bcf890f8d04dd82ccb
2016-05-23 12:53:42 -07:00
Shuhei Takahashi
2e6e99128a Run fsync tests on mutable filesystem.
The purpose of those tests is to ensure fsync succeeds for
directories. However, they try to call fsync for / (the root
filesystem) that is usually mounted read-only, which does not
make sense because the whole point of fsync is to flush
uncommitted changes to the filesystem.

In fact, some well-known read-only filesystems (e.g. squashfs)
does not support fsync, so these tests fail if we use such
filesystems as the root filesystem.

This patch changes the tests to call fsync against /data
instead. /data is a user data partition and should be always
mounted read-write.

Bug: 28681455

(cherry picked from commit cfa3262ce4)

Change-Id: I3e50f7b6ef07e96138711eef1f678f90cc9eb632
2016-05-23 12:53:16 -07:00
Christopher Ferris
7e53843f7b Change use of /data to /data/local/tmp.
The unistd fsync/fdatasync were changed to use /data from /.
Unfortunately, this directory is unreadable unless you are root, so
change this path to /data/local/tmp.

Bug: 28885777
Change-Id: Ia88da7a05c8f1b05fbd45ef2e8c55ba0c3368164
2016-05-20 15:32:47 -07:00
Shuhei Takahashi
e9cb77f082 Merge "Run fsync tests on mutable filesystem." into marshmallow-cts-dev am: de1f02c028 am: 0fab155cf8 am: b46bb761d5 am: 1e44a6e1ed
am: 97ecf98be3

* commit '97ecf98be3efaf196b19fc98e14dbbbc0e58c373':
  Run fsync tests on mutable filesystem.

Change-Id: Id8b620cdc55da0bd2f473a176eac0fb921369d32
2016-05-19 02:16:14 +00:00
Daniel Xie
b46bb761d5 Merge "Run fsync tests on mutable filesystem." into marshmallow-cts-dev am: de1f02c028
am: 0fab155cf8

* commit '0fab155cf861ee12e8b01b6339ef56524d56ebe1':
  Run fsync tests on mutable filesystem.

Change-Id: Iadcaa7329c8ace2a898860dce99ae1a9cf5f2757
2016-05-19 02:07:14 +00:00
Dimitry Ivanov
041cf17cdd Merge "Fix dlopen of main executable by absolute path" into nyc-dev 2016-05-18 07:33:50 +00:00
Dimitry Ivanov
49cfc899a3 linker: Allow caller to specify parent namespace
This change enables apps to share libraries opened
with RTLD_GLOBAL between different classloader namespaces.

The new parameter to create_namespace allows native_loader
to instruct the linker to share libraries belonging to
global group from a specified namespace instead of
using the caller_ns.

Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I5d0c62730bbed19cdeb16c7559c74aa262a2475f
(cherry picked from commit fc2da53440)
2016-05-17 15:58:28 -07:00
Treehugger Robot
42abf3d241 Merge "linker: Allow caller to specify parent namespace" 2016-05-17 22:43:01 +00:00
Dimitry Ivanov
dcaef3710d Fix dlopen of main executable by absolute path
This CL adds initialization of inode for the main executable
which enables linker to resolve the correct soinfo when
application calls dlopen with absolute path to the
main executable.

Bug: http://b/28420266
Change-Id: I102e07bde454bd44c6e46075e3faeeb5092830d8
(cherry picked from commit 2ba1cf39ae)
2016-05-17 15:31:05 -07:00
Dimitry Ivanov
2ba1cf39ae Fix dlopen of main executable by absolute path
This CL adds initialization of inode for the main executable
which enables linker to resolve the correct soinfo when
application calls dlopen with absolute path to the
main executable.

Bug: http://b/28420266
Change-Id: I102e07bde454bd44c6e46075e3faeeb5092830d8
2016-05-17 13:55:46 -07:00
Dimitry Ivanov
fc2da53440 linker: Allow caller to specify parent namespace
This change enables apps to share libraries opened
with RTLD_GLOBAL between different classloader namespaces.

The new parameter to create_namespace allows native_loader
to instruct the linker to share libraries belonging to
global group from a specified namespace instead of
using the caller_ns.

Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I5d0c62730bbed19cdeb16c7559c74aa262a2475f
2016-05-17 13:37:03 -07:00
Elliott Hughes
09e97e638d Fix the <netinet/ether.h> tests.
Looks like I never ran these even once :-(

Change-Id: Ie488dec229cddf59a4f526b3c4e674ad4334c088
2016-05-16 16:21:37 -07:00