Commit graph

887 commits

Author SHA1 Message Date
Yabin Cui
11c4353cdd Add --gtest-filter as synonym for --gtest_filter in bionic gtest main.
Bug: 19130480
Change-Id: I0d3df70ee8f692581cc4b9b742c5f347259fd0d2
2015-01-28 14:28:14 -08:00
Yabin Cui
385c07a74c Merge "Fix parse of gtest_filter in bionic gtest main." 2015-01-27 22:00:35 +00:00
Yabin Cui
0bc4e9697e Fix parse of gtest_filter in bionic gtest main.
Bug: 19130330
Change-Id: Id6a60570a8aab6ae7259ff228b3801285b378f77
2015-01-27 11:22:46 -08:00
Elliott Hughes
acc06a0b74 Merge "Add a test for float registers across setjmp/logjmp." 2015-01-27 19:08:33 +00:00
Yabin Cui
4a82ede754 Rename "TIMEWARN" to "SLOW" in bionic gtest.
Bug: 19109188.
Change-Id: Idfe769ac652bf37642da24e4abb6061ca861d57e
2015-01-26 20:56:20 -08:00
Elliott Hughes
87dd503018 Add a test for float registers across setjmp/logjmp.
Change-Id: I17cc056b185755e0b91de096b5ceefee4f4e0b3a
2015-01-26 20:52:34 -08:00
Yabin Cui
0e6af17a35 Merge "Support --gtest_ouput option in bionic gtest main." 2015-01-27 01:01:05 +00:00
Yabin Cui
657b1f9bef Support --gtest_ouput option in bionic gtest main.
Bug: 19109500
Change-Id: Ib18f90ad522e66ea62dd4e02e314585d9b36e15f
2015-01-26 16:53:05 -08:00
Elliott Hughes
247cfe0382 Merge "Add <error.h>." 2015-01-26 20:38:46 +00:00
Elliott Hughes
b8a8cf0d1a Add <error.h>.
Bug: https://code.google.com/p/android/issues/detail?id=79170
Change-Id: Id91765fac45124545e2674a5b2c814707c1a448b
2015-01-26 11:57:11 -08:00
Elliott Hughes
14152b9f31 Remove obsolete BUILD_TINY_ANDROID.
Change-Id: If2fc97134340fd09ec2583b666ace2f673cbdf66
2015-01-24 19:01:58 -08:00
Elliott Hughes
e6bb5a2776 Fix optimized fread.
gcov does writes after reads on the same stream, but the bulk read optimization
was clobbering the FILE _flags, causing fwrite to fail.

Bug: 19129055
Change-Id: I9650cb7de4bb173a706b502406266ed0d2b654d7
2015-01-24 12:35:41 -08:00
Dmitriy Ivanov
31005ca4c8 Merge "Minimize calls to mprotect" 2015-01-24 00:45:25 +00:00
Dmitriy Ivanov
279a22f96e Minimize calls to mprotect
Implement refcounter based data protection guard
  to avoid unnecessary calls to mprotect when dlopen/dlclose
  is called from a constructor.

Bug: 19124318
Big: 7941716
Change-Id: Id221b84ce75443094f99756dc9950b0a1dc87222
2015-01-23 16:30:34 -08:00
Dan Albert
4ce907d2ce Allow make to set a timeout for the host tests.
Change-Id: Icc2ebf64bd1da1687bf313fe7a5640155c5795d8
2015-01-23 11:35:48 -08:00
Elliott Hughes
62284dd2cc There's no such thing as LOCAL_CXXFLAGS.
Change-Id: Iad70e6bd4cb7cec9e0ece500a540e4dadc83d92e
2015-01-22 15:36:24 -08:00
Elliott Hughes
0ed7e08cda Fix the stdio.fread_EOF test.
Another sizeof/strlen screwup caused by trying to be too clever. Use
std::string instead.

Also fix all the ASSERT_STREQ calls in this file that had the arguments
the right^Wwrong way round. If I ever see Kent Beck...

Change-Id: I47a1bdfee99cf4e7bed9b398f3158a308fbcf1e8
2015-01-22 15:28:48 -08:00
Elliott Hughes
bcb378d643 Fix fread_EOF test name.
Change-Id: I53a7f1428fd27c0b2a5c80f2e8af4845d17f5b4b
2015-01-22 14:18:35 -08:00
Elliott Hughes
8c4994bbc1 Implement __fsetlocking.
The old __isthreaded hack was never very useful on Android because all user
code runs in a VM where there are lots of threads running. But __fsetlocking
lets a caller say "I'll worry about the locking for this FILE*", which is
useful for the normal case where you don't share a FILE* between threads
so you don't need any locking.

Bug: 17154740
Bug: 18593728
Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
2015-01-21 10:33:30 -08:00
Elliott Hughes
c053a42831 Merge "Optimized fread." 2015-01-21 00:11:31 +00:00
Elliott Hughes
75b99387dd Optimized fread.
This makes us competitive with glibc for fully-buffered and unbuffered reads,
except in single-threaded situations where glibc avoids locking, but since
we're never really single-threaded anyway, that isn't a priority.

Bug: 18593728
Change-Id: Ib776bfba422ccf46209581fc0dc54f3567645b8f
2015-01-20 15:59:17 -08:00
Yabin Cui
516eb53113 Remove testcase time printing in bionic-unit-tests.
Bug: 19075565
Change-Id: Icccb60657a2985e96abb1703673f0ebe2199586a
2015-01-20 14:46:03 -08:00
Yabin Cui
6104eb9fa7 Add target libbionic_gtest_main for cts test.
Bug: 17589740
Change-Id: I37f2d3fe72870b9dc867407fa1619c9a6fcd5cbb
2015-01-20 14:32:07 -08:00
Elliott Hughes
1d7b3f3ccc Merge "Improve <stdio_ext.h> testing." 2015-01-20 18:07:37 +00:00
Elliott Hughes
df8f1a42d1 Improve <stdio_ext.h> testing.
I almost fixed a non-bug. Add a test to prevent me from doing that.

Change-Id: I4a1dc13e603a7a377bdaee2e78132015087f7107
2015-01-16 16:40:55 -08:00
Yabin Cui
cfe7e75fc1 Merge "Make sys_resource test more robust." 2015-01-16 21:52:11 +00:00
Yabin Cui
4853f40f3f Make sys_resource test more robust.
"ulimit -c xxx" command may run before bionic-unit-tests.
Make sure sys_resource test fails gently in that case.

Change-Id: Ic3b5ed8b20acba56df8c5ef082c88e5050e761aa
2015-01-16 13:28:43 -08:00
Yabin Cui
19e246dda6 Fix possible leak in pthread_detach.
If pthread_detach() is called while the thread is in pthread_exit(),
it takes the risk that no one can free the pthread_internal_t.
So I add PTHREAD_ATTR_FLAG_ZOMBIE to detect this, maybe very rare, but
both glibc and netbsd libpthread have similar function.

Change-Id: Iaa15f651903b8ca07aaa7bd4de46ff14a2f93835
2015-01-15 10:45:25 -08:00
Yabin Cui
deab11acd7 Merge "Make bionic-unit-tests default run isolate mode." 2015-01-15 18:10:30 +00:00
Yabin Cui
a35cd8cdc2 Test that ip6-localhost exists in etc/hosts.
Addition change: make netdb_test pass on host.

Bug: 18791191
Change-Id: I7a9e29aa559ff6557288b47323d8a436379201a2
2015-01-13 17:30:51 -08:00
Yabin Cui
be837360c3 Make bionic-unit-tests default run isolate mode.
Fix bug of handling signal terminated tests.

Bug: 17589740
Bug: 18951146
Change-Id: I4803382b26cd5454693090202b3ba38e3dbe66e5
2015-01-08 20:34:58 -08:00
Elliott Hughes
c62a4b5a7a Fix freeaddrinfo(NULL).
Bug: https://code.google.com/p/android/issues/detail?id=13228
Change-Id: I5e3b126d90d750a93ac0b8872198e50ba047e603
2015-01-08 17:28:46 -08:00
Yabin Cui
917d390510 Make pthread stack size match real range.
Bug: 18908062
Change-Id: I7037ac8273ebe54dd19b1561c7a376819049124c
2015-01-08 14:27:24 -08:00
Dmitriy Ivanov
bfa15e464e Set linux 32bit personality for 32 bit processes
Bug: 18069809
Change-Id: Ie143d56b0f8f03510dc451649291067e1add1d2f
2015-01-07 16:32:05 -08:00
Yabin Cui
597800f1d7 Merge "better gtest runner for bionic" 2015-01-02 22:38:41 +00:00
Yabin Cui
541b0b187d Merge "Reserve enough user request stack space in pthread_create." 2015-01-02 22:37:56 +00:00
Yabin Cui
6a7aaf4675 Reserve enough user request stack space in pthread_create.
Bug: 18830897
Change-Id: I1ba4aaeaf66a7ff99c5d82ad45469011171b0a3b
2015-01-02 14:33:48 -08:00
Elliott Hughes
ba09edcb41 Merge "Fix nan output in the printf family." 2014-12-21 02:54:06 +00:00
Elliott Hughes
1b18aff9ba Fix nan output in the printf family.
Bug: https://code.google.com/p/android/issues/detail?id=82452
Change-Id: I51f226c8b033de6e81baeea5e6db3de6ed196f73
2014-12-20 18:53:08 -08:00
Yabin Cui
370a3e573d Merge "Sync with upstream for gethnamaddr.c." 2014-12-18 01:06:10 +00:00
Yabin Cui
58d33a51f3 Sync with upstream for gethnamaddr.c.
Bug: 18566967
Change-Id: I37e7410226b49eec67614e20b2c1d5e3e47817a5
2014-12-17 16:19:27 -08:00
Dmitriy Ivanov
92b9cb2c89 Merge "Add another test for weak-reference" 2014-12-16 22:01:47 +00:00
Dmitriy Ivanov
bfa88bca5c Add another test for weak-reference
This one covers undefined weak reference in .so
  referenced via JUMP_SLOT relocation.

Bug: 17526061
Change-Id: Ib8764bd30c1f686c4818ebbc6683cf42dee908b2
2014-12-16 19:46:45 +00:00
Yabin Cui
294d1e2c9e better gtest runner for bionic
1. option to run each test in a separate forked process: "--isolate".
2. warnings about slow tests: "--warnline".
3. run multiple tests at the same time: "-j N".

Bug: 17589740
Change-Id: Ife5f4cafec43aa051ad7bd9c9b2b7e2e437db0de
2014-12-13 18:53:34 -08:00
Yabin Cui
6c238f2926 Fix pthread key num calculation.
Bug: 18723085
Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
2014-12-12 17:00:08 -08:00
Yabin Cui
562ae1e6e4 make stack_protector_DeathTest work for gcc4.9
Bug: 18721888
Change-Id: I5f0b5c84319f56dbc4efb88e9d828138944667ae
2014-12-11 17:24:55 -08:00
Elliott Hughes
1510a1c1ae Fix the setjmp tests for mips.
Although the LP32 mips sigset_t is large enough to represent all signals,
their jmp_buf is too small. This test succeeded on arm and x86 because the
RT signals were never in the 'expected' sigset_t, so the equality comparison
with the 'actual' sigset_t worked fine --- everyone was blind to the RT
signal. On mips the tests fail because the 'expected' sigset_t does contain
the RT signal but the 'actual' doesn't because the jmp_buf only saves and
restores the first 32 signals.

There are 32 free bits (currently used as padding) in the LP32 mips jmp_buf,
and they might choose to use those to provide better support than the other
two platforms, but I'll leave that to them. It will be easy to just remove
the #if defined(__LP64__) from this change in that case.

For mips64 it's not to late to increase the size of the jmp_buf and fix
the setjmp family, but since there are decisions to be made here for LP32,
I'll leave it all to Imagination folks...

Bug: 16918359
Change-Id: I6b723712fce0e9210dafa165d8599d950b2d3500
2014-12-10 11:48:19 -08:00
Yabin Cui
94926f8cfa Merge "support _POSIX_REALTIME_SIGNALS" 2014-12-09 20:10:19 +00:00
Yabin Cui
b033761cbf Merge "Change _POSIX_CPUTIME macro to make it compitable with glibc." 2014-12-09 17:51:37 +00:00
Yabin Cui
725756045e Change _POSIX_CPUTIME macro to make it compitable with glibc.
Change-Id: I7a8dbb74bd622693c9fef60bd779687207517b7d
2014-12-09 09:16:11 -08:00
Yabin Cui
634816055f support _POSIX_REALTIME_SIGNALS
Bug: 18489947
Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
2014-12-08 21:52:43 -08:00
Elliott Hughes
1c0c0ede57 Fix signal mask save/restore for x86-64.
Bug: 16918359
Change-Id: I30bf61e7d5f1c21daa3a1a21d361e98d77220bf3
2014-12-08 12:46:15 -08:00
Yabin Cui
5afae64a1b implement posix_madvise
Bug: 18472477
Change-Id: I8183de6c281acf69ed5f7f88351b056b9827b162
2014-12-04 11:01:28 -08:00
Elliott Hughes
65f0df7873 Implement <pty.h>.
Based on the package/apps/Terminal implementation. I'll switch them over
shortly. This also lets us build the toybox version of netcat.

Change-Id: Ia922a100141a67409264b43b937eeca07b21f344
2014-12-03 15:55:34 -08:00
Dmitriy Ivanov
6995c1dcb5 Merge "Extract bionic-prepare-run-on-host to inc file." 2014-12-03 00:02:13 +00:00
Dmitriy Ivanov
06b1b8ceac Extract bionic-prepare-run-on-host to inc file.
Make benchmark run-on-host depend on bionic-prepare-run-on-host.

Change-Id: I0bdbf561b2580d607a49b7c83cc273320ac55429
2014-12-02 15:15:34 -08:00
Elliott Hughes
27d276f3a6 Avoid pathological behavior in OpenBSD's fread.
(cherry picked from commit 20841a137b)

Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Ibdfebc20dce4c34ad565014523c9b074e90ea665
2014-12-02 14:54:52 -08:00
Elliott Hughes
20841a137b Avoid pathological behavior in OpenBSD's fread.
Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Idc60976b79610e2202cc42dc393dcb4ca6c42e05
2014-12-02 14:22:02 -08:00
Dmitriy Ivanov
a55126f1f6 Create /system/lib(64)? symlinks for host tests.
Replace LD_LIBRARY_PATH with default path for
  the tests run on host.

Bug: 18589961

Change-Id: Id4a84b73d25c2ca9c557fcfa19b8169daeaa016b
2014-12-02 12:11:08 -08:00
Dmitriy Ivanov
291dbf65ca Merge "Count references for groups instead of instances" 2014-12-02 19:10:04 +00:00
Dmitriy Ivanov
ab972b9adf Count references for groups instead of instances
Count references on the group level to avoid
  partially unloading function that might be
  referenced by other libraries in the local_group

  Bonus: with this change we can correctly unload recursively
  linked libraries. is_recursive check is removed.

  Also dynamic executables (not .so) with 0 DT_NEEDED libraries
  are now correctly linked.

Change-Id: Idfa83baef402840599b93a875f2881d9f020dbcd
2014-12-02 10:54:26 -08:00
Yabin Cui
e323e99ffb restore sigprocmask in setjmp/longjmp test.
Bug: 18571921
Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
2014-12-02 10:35:25 -08:00
Yabin Cui
3e6ef3f902 Merge "support _POSIX_CPUTIME" 2014-12-01 17:06:02 +00:00
Yongqin Liu
9fea4090f1 bionic tests: add setjmp/_setjmp/sigsetjmp tests.
Bug: 17288973
Change-Id: I2808eee58cbddae1b16fbe19a715b72d6dbaaec3
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-26 17:31:24 -08:00
Yabin Cui
d5c652756b support _POSIX_CPUTIME
Bug: 18490039
Change-Id: I01fa83b48e1b908de1f227b6e4f98e280bcd50ee
2014-11-26 17:14:50 -08:00
Yabin Cui
eb3a5e026e Merge "flesh out sysconf(3) and the _POSIX_* constants" 2014-11-24 01:59:23 +00:00
Yabin Cui
1c19194c9d flesh out sysconf(3) and the _POSIX_* constants
Bug: 17571891
Change-Id: I81036615486bde65969ae5662587fcc88348474e
2014-11-21 19:10:52 -08:00
Dmitriy Ivanov
0864d8bc47 Rename test_forked -> test_isolated
Change-Id: Ie72627e986c159832cbd3635d8ff5b1af3d5b1eb
2014-11-20 22:53:59 -08:00
Dmitriy Ivanov
8b4b827338 Merge "Add test_forked() option" 2014-11-21 01:21:16 +00:00
Dmitriy Ivanov
00e37818a7 Add test_forked() option
Executing test via test_forked() allows us to
 avoid undesired global state changes in tests like
 atexit, dlopen(.., RTLD_NODELETE) and similar.

Change-Id: I118cdf009269ab5dd7b117c9b61dafa47de2a011
2014-11-20 17:11:06 -08:00
Elliott Hughes
770198d3f7 Merge "Make the ftw(3) tests a bit more thorough." 2014-11-20 00:09:32 +00:00
Elliott Hughes
63bd43bbdc Make the ftw(3) tests a bit more thorough.
These also test much of fts(3).

Change-Id: Ia9245d6acbbd071191563ab1b91a400044104028
2014-11-19 15:47:53 -08:00
Dmitriy Ivanov
6b48b20a1e Merge "Yet another relocation test" 2014-11-19 19:35:59 +00:00
Dmitriy Ivanov
7699d13a74 Yet another relocation test
This time we check if a -> b -> c function in 'a' relocates against
 implementation in 'c'.

Change-Id: I528180c3efd346bd447ea0237e5a8a0ac3cc031f
2014-11-19 10:39:05 -08:00
Yabin Cui
649f78df79 Merge "fix shared gid support in getpwnam/getgrnam" 2014-11-19 04:25:24 +00:00
Yabin Cui
a04c79b9d3 fix shared gid support in getpwnam/getgrnam
Bug: 18374693
Change-Id: I5353403cbbead6f6abac87bee2cf53a60dba408c
2014-11-18 19:58:04 -08:00
Dmitriy Ivanov
a2547055f2 Fix jump to unmapped memory on atexit
Split d-tor calls and soinfo_free to 2 separate steps

Bug: 18338888
Change-Id: Idbcb7242ade16fa18cba7fe30505ebd8d6023622
2014-11-18 13:16:27 -08:00
Elliott Hughes
8eda0a6d69 Merge "libc: Fix mktime returns an uncorrect time in empty TZ case" 2014-11-17 23:14:58 +00:00
Dmitriy Ivanov
ee4c8febb7 Merge "bionic/test: migrate sysconf tests from system/extras to bionic/tests" 2014-11-17 18:43:32 +00:00
Elliott Hughes
f2c882095b Merge "Add getaddrinfo(3) tests for NULL arguments." 2014-11-17 18:26:46 +00:00
Elliott Hughes
32fea147ea Add getaddrinfo(3) tests for NULL arguments.
According to https://github.com/ukanth/afwall/pull/213 some OEMs have
shipped a getaddrinfo(3) that crashes given NULL hostnames.

Change-Id: I9cea5fdd68546b7c64cf47e10e2b2b4d672b69d0
2014-11-16 12:14:04 -08:00
Dan Albert
eef1eb64bb Merge "Allow asan for glibc tests." 2014-11-15 06:47:08 +00:00
Dan Albert
01f1ff2440 Allow asan for glibc tests.
SANITIZE_HOST will break if we don't allow ASAN.

Change-Id: I0beed82b058db391f633e0ea1098f140497c65d4
2014-11-14 20:00:06 -08:00
Satoru Takeuchi
154e2026c8 libc: Fix mktime returns an uncorrect time in empty TZ case
The mktime API returned an uncorrect time when TZ is set as empty.
A timezone UTC/GMT+0 should be implied in the empty case. However
mktime keeps previous information about timezone. If mktime was called
with a timezone which has DST before, the "defaulttype" member of
"state" structure wouldn't be 0. Then it would be used next time,
even though UTC/GMT+0 doesn't have DST.

Added initialization of the "defaulttype" in the empty TZ case.

Change-Id: Ic480c63c548c05444134e0aefb30a7b380e3f40b
2014-11-14 18:13:07 -08:00
Derek Xue
bc6447673f bionic/test: migrate sysconf tests from system/extras to bionic/tests
The old test are implemented in file:
  system/extras/tests/bionic/libc/other/test_sysconf.c
This change is to migrate them to bionic/tests with the gtest format.

and since the sysconf is defined in unistd.h, will put the test under
bionic/tests/unistd_test.cpp file as unistd.syscon test

Change-Id: Ie519147c1c86a6c4cefa8c88b18bf58bdfbffbdb
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-15 09:48:36 +08:00
Yabin Cui
9d93986481 Add functions in sysinfo.h.
Bug: 17703902

Change-Id: I699d12d76a8fc483c919be730c2ac63641b71a1d
2014-11-14 16:22:48 -08:00
Yabin Cui
661423a453 Merge "Increase support of pathconf options." 2014-11-14 23:45:45 +00:00
Yabin Cui
b5e581abfe Increase support of pathconf options.
Bug: 18206366
Change-Id: Ie770e49f5af3631eb9fbd2cd5174edf004c81e00
2014-11-14 23:45:24 +00:00
Dmitriy Ivanov
9df4b13baf Fix host build for arm/arm64
Change-Id: Id92543e4080aede205b3e63099fa2baa36ba21f0
2014-11-14 12:17:06 -08:00
Dmitriy Ivanov
b3356773c6 Add test for --hash-style=sysv
With build system switched to gnu-hash we need
 a test for sysv-hashed library.

Change-Id: I34adc216fa79199aa46066cf13fcc1c1f2581f0e
2014-11-14 11:19:22 -08:00
Christopher Ferris
59b1dea882 Merge "Add missing function prototypes wcpcpy/wcpncpy." 2014-11-14 03:23:35 +00:00
Christopher Ferris
5c7d9584d9 Add missing function prototypes wcpcpy/wcpncpy.
Also add smoke tests for a few of the wchar functions.

Change-Id: Id1be522f55a6708564d444941f42097548f16497
2014-11-13 18:56:12 -08:00
Elliott Hughes
e3c4acf1e3 Fix our <mntent.h> implementation.
Used by toybox.

Change-Id: I36a5053423e5cc54ae02a68f4fe110d75134accd
2014-11-13 15:51:36 -08:00
Elliott Hughes
68d98d832b Assume glibc >= 2.15.
This catches one trivial difference between us and glibc --- the error
returned by pthread_setname_np for an invalid pthread_t.

Change-Id: If4c21e22107c6488333d11184f8005f8669096c2
2014-11-12 21:03:26 -08:00
Elliott Hughes
92a585c91a Merge "Fix glibc 2.15 build." 2014-11-13 03:37:47 +00:00
Elliott Hughes
fb50057138 Fix glibc 2.15 build.
glibc 2.15 has prlimit64, has an unsetenv that's declared nonnull,
and hasn't fixed the problems we were having trying to use the
POSIX strerror_r in C++ code.

Change-Id: I834356a385e5ae55500bd86781691b6c1c9c8300
2014-11-12 19:31:21 -08:00
Dmitriy Ivanov
ec18ce06f2 Add support for hash-style=gnu
Change-Id: I171434a587420895feac8a9b1ad2342087197568
2014-11-12 16:38:12 -08:00
Yabin Cui
e5cabca516 Merge "implement missing seekdir and telldir" 2014-11-12 20:36:26 +00:00
Elliott Hughes
bbdfa51883 Merge "gethostname.c: change to report ENAMETOOLONG error when buflen is less" 2014-11-12 20:09:59 +00:00
Elliott Hughes
83204d5708 Merge "bionic tests: migrate gethostname test to unistd_test.cpp from system/extras" 2014-11-12 20:08:57 +00:00
Yongqin Liu
2f954bab2d gethostname.c: change to report ENAMETOOLONG error when buflen is less
change to behaviour the same as glibc for the check about buflen

Change-Id: I98265a8fe441df6fed2527686f89b087364ca53d
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 12:07:33 -08:00
Derek Xue
d94e7f0f1d bionic tests: migrate gethostname test to unistd_test.cpp from system/extras
The old tests are implemented in file
    system/extras/tests/bionic/libc/common/test_gethostname.c
Here migrate the test to the tests/unistd_test.cpp file and
add some more checks

Change-Id: Iab1e3da873bb333d1ddefc03108d536933792db2
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 10:47:39 -08:00
Christopher Ferris
1468765f8a Add align/overread tests for strlcpy/strlcat.
Change-Id: I2801c7ee1847cd68ec95eba5bdffde5e52edf1e5
2014-11-10 13:58:17 -08:00
Elliott Hughes
b86a4c7f65 Add sethostname(2).
Not very useful, but helps building stuff like toybox out of the box.

Change-Id: I110e39030452bd093a84278e019c5752d293718d
2014-11-07 16:48:27 -08:00
Yabin Cui
5ca4a9e2da implement missing seekdir and telldir
Bug: 18266863
Change-Id: I189ee949d4f7ccee099f3341e349cd969d25480f
2014-11-07 10:20:32 -08:00
Elliott Hughes
b20c24456e Implement all the POSIX _l functions.
Strictly speaking, this only implements the _l variants of the functions
we actually have. We're still missing nl_langinfo_l, for example, but we
don't have nl_langinfo either.

Change-Id: Ie711c7b04e7b9100932a13f5a5d5b28847eb4c12
2014-11-06 15:52:22 -08:00
Elliott Hughes
274afe8f0e Add POSIX lcong48.
Change-Id: I821046816661d77275cb02c8c99d526bb41afb9c
2014-11-06 14:14:37 -08:00
Elliott Hughes
39ba30354a Merge "Fix our <complex.h> support." 2014-11-06 19:43:17 +00:00
Elliott Hughes
b8ee16f1dc Fix our <complex.h> support.
We build libm with -fvisibility=hidden, so we weren't exporting any
of the <complex.h> functions.

We also weren't building many of the functions anyway.

We were also missing the complex inverse trigonometric functions.

And because we didn't even have perfunctory "call each function once"
tests, we didn't notice that we weren't exporting any symbols, so this
patch adds at least that level of testing.

Change-Id: Ibcf2843f507126c51d134cc5fc8d67747e033a0d
2014-11-06 11:16:55 -08:00
Yabin Cui
9df70403d9 make all bionic death tests not dumpable
Bug: 18067305

Change-Id: Ia1ecacf47eddecc9bc58aaac779e0c218f463179
2014-11-06 11:09:03 -08:00
Yabin Cui
2311383180 Merge "check invalid file offset when loading library" 2014-11-05 19:56:01 +00:00
Elliott Hughes
c13a2044e3 Merge "Fix newlocale with a NULL locale name." 2014-11-05 02:20:55 +00:00
Elliott Hughes
7e0d0f8572 Fix newlocale with a NULL locale name.
Bug: https://code.google.com/p/android/issues/detail?id=78567
Change-Id: I272dabc12ab186b44a525c7e8ac1846e62334e85
2014-11-04 18:03:44 -08:00
Elliott Hughes
1b37ba2178 Improve math tests to allow a specific ulp bound.
At the moment our libm is only good enough for a 1 ulp bound on these tests,
but that's better than the 4 ulp bound you get from gtest by default.

I'm not really happy with the multiple structures and corresponding functions,
but at least they mean there's no duplication in the tests themselves, and it
should be easy enough for us to make further improvements in future.

Change-Id: I004e12970332e1d9531721361d6c34f908cfcecc
2014-11-04 18:00:02 -08:00
Yabin Cui
16f7f8d250 check invalid file offset when loading library
Bug: 18178121
Bug: 18078224

Change-Id: I5254433d54645db68e9b83d5095dc2bf9d8531bc
2014-11-04 14:37:15 -08:00
Dmitriy Ivanov
9d3382d97a Revert "Fix dlsym() to take into account RTLD_GLOBAL/LOCAL"
This reverts commit c85e82dde5.

Bug: 18222321
Bug: 18211780
Change-Id: I32f4048bd5ea85dc8a3dfccce8cf141b241ab692
2014-11-03 22:15:29 -08:00
Dmitriy Ivanov
69c5d108a5 Revert "Add RTLD_NODELETE flag support"
This reverts commit c87f65d2cd.

Bug: 18222321
Bug: 18211780
Change-Id: I00252e26a28a41ab9f1e2dd3b32f0f80d86297f1
2014-11-03 22:15:26 -08:00
Dmitriy Ivanov
00dce52553 Revert "Fix relocation to look for symbols in local group"
This reverts commit fd2747bb58.

Bug: 18222321
Bug: 18211780
Change-Id: I2d4ebab1e73b7277161af76b99f8249825b22d65
2014-11-03 22:15:20 -08:00
Dmitriy Ivanov
f947be2889 Revert "Fix symbol lookup order during relocation"
This reverts commit 976402cca1.

Bug: 18222321
Bug: 18211780
Change-Id: Iafdd3d843db7b1cf288be9a0232022816622c944
2014-11-03 22:15:08 -08:00
Dmitriy Ivanov
494bee796a Revert "Fix arm64 and arm builds."
This reverts commit 445111a1c9.

Bug: 18222321
Bug: 18211780
Change-Id: I4fa9e1b63ec9b528f8bfed73c2ec15046c43a2fe
2014-11-03 22:14:19 -08:00
Elliott Hughes
d18f4b2578 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
(cherry-pick of 6a03abcfd23f31d1df06eb0059830e22621282bb.)

Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 13:46:41 -08:00
Dan Albert
695781b6f0 Merge "Make host tests depend on /system/etc/hosts." 2014-11-03 21:38:50 +00:00
Dan Albert
62b7279789 Make host tests depend on /system/etc/hosts.
Change-Id: I3e5ab1325d5e250a1d14b53f3a5a465d9f5de30c
2014-11-03 13:26:16 -08:00
Elliott Hughes
6a03abcfd2 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 12:32:17 -08:00
Dmitriy Ivanov
445111a1c9 Fix arm64 and arm builds.
Bug: 18186310

(cherry picked from commit 4e446b19d8)

Change-Id: Ibc77a9ade36dc6b9bf5a316b5ab9ae5f0a70e826
2014-10-31 19:29:04 -07:00
Dmitriy Ivanov
4e446b19d8 Fix arm64 and arm builds.
Change-Id: I2c8c41626768e792f27a2616f2cd5ae66606319d
2014-10-31 17:27:02 -07:00
Dmitriy Ivanov
976402cca1 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit d225a5e652)

Change-Id: I4e889cdf2dfbf8230b0790053d311ee6b0d0ee2d
2014-10-31 17:10:30 -07:00
Dmitriy Ivanov
fd2747bb58 Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit cfa97f172d)

Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
4d0c1f673f Correct way to specify additional dependencies
Previous one was not covering all the targets

Bug: 17548097
Bug: 18186310

(cherry picked from commit 4a9e1937c5)

Change-Id: I2cd9e58893555d16cbfe291b2d1279621489d5ad
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
382e06ce8e Add dlfcn_test to glibc test suite.
Bug: 18186310

(cherry picked from commit eb27bbae8f)

Change-Id: I1d608dfa12dbafbdcdb8bc6d818c5872404c19e0
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
c87f65d2cd Add RTLD_NODELETE flag support
Bug: 18186310
Bug: https://code.google.com/p/android/issues/detail?id=64069

(cherry picked from commit 1b20dafdbe)

Change-Id: Ic02eec22a7c322ece65eb40730a3404f611526b1
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
c85e82dde5 Fix dlsym() to take into account RTLD_GLOBAL/LOCAL
Symbols from libraries opened with RTLD_LOCAL (default)
  should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .)

Bug: 17512583
Bug: 18186310

(cherry picked from commit e8ba50fe0d)

Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
2014-10-31 17:02:13 -07:00
Dmitriy Ivanov
d225a5e652 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Change-Id: Ia788748be59b739d1c7e62b978e7e255f9e65c7b
2014-10-31 11:39:51 -07:00
Elliott Hughes
89aaaffbf8 Extra strtod/strtof tests.
Check that libc doesn't suffer from a couple of bugs that affected
Java in the past.

Bug: 2206701
Change-Id: I9eb64d7ff2fa0b79e93079b897a5fb78bef866be
2014-10-28 17:54:23 -07:00
Elliott Hughes
22e2c9d963 Fix mips signed/unsigned signal_test.cpp build breakage.
(cherry picked from commit aa13e839f0)

Bug: 17436734
Change-Id: I167fc5d74c49cca7031c5739bc53fdf3bde71887
2014-10-28 14:02:10 -07:00
Elliott Hughes
28ea229bb2 Don't mask out SA_RESTORER from sa_flags.
glibc doesn't do this, and we probably shouldn't either.

Bug: 16703540
Bug: 17436734

(cherry picked from commit afe58ad989)

Change-Id: Iada5d0ae814f438cb276f056b2b5e3675f0e3666
2014-10-28 07:55:53 -07:00
Pavel Chupin
8eb8c39299 [x86,x86_64] Fix libgcc unwinding through signal
This change provides __restore/__restore_rt on x86 and __restore_rt on
x86_64 with unwinding information to be able to unwind through signal
frame via libgcc provided unwinding interface. See comments inlined for
more details.

Also remove the test that had a dependency on
__attribute__((cleanup(foo_cleanup))). It doesn't provide us with any
better test coverage than we have from the newer tests, and it doesn't
work well across a variety architectures (presumably because no one uses
this attribute in the real world).

Tested this on host via bionic-unit-tests-run-on-host on both x86 and
x86-64.

Bug: 17436734
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>

(cherry picked from commit 50321e2e66)

Change-Id: Iba90e36958b00c7cc7db5eeebf888dc89ce4d619
2014-10-27 16:42:49 -07:00
Elliott Hughes
190dce9e56 Stack unwinding unit tests.
Bug: 17436734

(cherry picked from commit bee1993a14)

Change-Id: I7205a862ba2c3b474e287f5e9c8982cef4610af9
2014-10-27 16:42:37 -07:00
Pavel Chupin
50321e2e66 [x86,x86_64] Fix libgcc unwinding through signal
This change provides __restore/__restore_rt on x86 and __restore_rt on
x86_64 with unwinding information to be able to unwind through signal
frame via libgcc provided unwinding interface. See comments inlined for
more details.

Also remove the test that had a dependency on
__attribute__((cleanup(foo_cleanup))). It doesn't provide us with any
better test coverage than we have from the newer tests, and it doesn't
work well across a variety architectures (presumably because no one uses
this attribute in the real world).

Tested this on host via bionic-unit-tests-run-on-host on both x86 and
x86-64.

Bug: 17436734
Change-Id: I2f06814e82c8faa732cb4f5648868dc0fd2e5fe4
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-10-27 16:14:55 -07:00
Elliott Hughes
ed29e858d0 pthread_setname_np appears in glibc 2.12.
And our emulator kernels are now new enough to not require a workaround.

Change-Id: Id56c983dbfd8abc69f72a78411a5502391941dfc
2014-10-27 12:01:51 -07:00
Dmitriy Ivanov
095636e6ad Fix *tests-run-on-host target
Change-Id: Id0e5060977a2df91c47b5a916989eb7e2e3f8153
2014-10-25 21:41:32 -07:00
Derek Xue
4199695657 bionic tests: migrate test for mutex type from system/extras
Migrate the test about pthread mutex type in file
    system/extras/tests/bionic/libc/bionic/test_mutex.c
to the new place
    bionic/tests/pthread_test.cpp
in the gtest format.

Change-Id: I6aab10170ccad5b9a4892d52dba2403876c86659
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-24 18:54:42 -07:00
Chih-Hung Hsieh
57c5a5562b Merge "Disable clang compilation due to lack of ifunc." 2014-10-24 18:34:40 +00:00
Chih-Hung Hsieh
b086298629 Disable clang compilation due to lack of ifunc.
BUG: 18055309
Change-Id: I0f36011cf7872a20ddd36a6c3c607eb96f0a8ec2
2014-10-24 11:04:51 -07:00
Elliott Hughes
1e8ebdc375 Make the netdb unit tests work on the host.
Bug: 18111005
Change-Id: I79c6929c3827716e19b44d7469db69740f4b449c
2014-10-24 10:45:08 -07:00
Elliott Hughes
a4c0b75671 Merge "Add mkfifoat(3)." 2014-10-24 02:57:12 +00:00
Elliott Hughes
ca8e84c6ff Add mkfifoat(3).
Looks like I missed one of the *at functions when I added the rest.

Change-Id: If16de82dbf6f9a3ea7bfdcba406ca1c74a3f2279
2014-10-23 19:10:54 -07:00
Dmitriy Ivanov
566f2bc623 Merge "Fix relocation to look for symbols in local group" 2014-10-23 20:49:00 +00:00
Dmitriy Ivanov
cfa97f172d Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Change-Id: I9bb013b46d17dbb5cbdfb8fef26f552748385541
2014-10-23 12:13:54 -07:00
Derek Xue
ba811120ae Migrate system/extra getaddrinfo test, and fix a bug in getservbyname(3).
This change is to migrate the getaddrinfo tests defined in the old file
system/extras/tests/bionic/libc/common/test_getaddrinfo.c
to the new place bionic/tests/netdb_test.cpp.

The test here is more thorough, and catches a bug in getservbyname(3)
that was breaking getaddrinfo(3)'s ability to look up services by name
without a hint that would cause it to ask for a specific protocol.

Change-Id: Ief5ebd0869496d1bc6a97861dfefa04bdf24bab1
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-22 22:23:10 -07:00