summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Reset enviroment for math_testsDmitriy Ivanov2014-10-012-9/+46
| | | | | | | | Bug: 17390824 (cherry picked from commit 7b956ede3f0f40bd8a085a8ad3729bb3e0e030f2) Change-Id: I5d804ceb5e69533584161bfed6787529cd8296fb
* Load libraries in breadth-first orderDmitriy Ivanov2014-10-015-0/+330
| | | | | | | | | | | | | This patch fixes the problem with symbol search order for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries and ld_preloads in correct order. Bug: https://code.google.com/p/android/issues/detail?id=74255 Attempt: 2 (cherry picked from commit 14669a939d113214a4a20b9318fca0992d5453f0) Change-Id: Id87540c96a2242220967b6fa5d84ddcd829e2b97
* Revert "Load libraries in breadth-first order"Dmitriy Ivanov2014-10-015-330/+0
| | | | | | | | This reverts commit a3ad450a2e3fb6b3fe359683b247eba20896f646. (cherry picked from commit 498eb18b82a425f9f30132e4832f327b2ee0e545) Change-Id: Iec7eab83d0c0ed1604e1e8ea3f9e9d0ce1d29680
* Fix order of soinfo links (repairs libcxx tests).Dmitriy Ivanov2014-10-016-0/+111
| | | | | | (cherry picked from commit b2a30ee8d209154efc367db11b4167a5d6db605f) Change-Id: I59c5333bc050cbbea14051cea9220be2f64ee383
* Load libraries in breadth-first orderDmitriy Ivanov2014-10-015-0/+330
| | | | | | | | | | | | This patch fixes the problem with symbol search order for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries and ld_preloads in correct order. Bug: https://code.google.com/p/android/issues/detail?id=74255 (cherry picked from commit a3ad450a2e3fb6b3fe359683b247eba20896f646) Change-Id: I1125de10272c84e4f075cbc72859c1f6b3e89943
* Enable __cxa_atexit && __cxa_finalize for linkerDmitriy Ivanov2014-10-011-1/+1
| | | | | | | | | This allows adding destructors to classes used for global variables. (cherry picked from commit 14241402de0faa4b244b1bd6b1f0799ce169b880) Change-Id: I1d8776130d1e01a8c53d23a2949f5010f4c96b16
* Run constructors before resolving ifunc functionsDmitriy Ivanov2014-10-013-11/+56
| | | | | | | | Bug: 17177284 (cherry picked from commit 9598b8c415e2fa9f240508185fe8c964b83f538d) Change-Id: I2c9631ee1cd77f8cf95ec0216a35b605c8786454
* Added test for ifunc support in dynamic linker.Brigid Smith2014-10-013-0/+84
| | | | | | | | | | ifuncs now work in i386 and x86_64 when called in the same library as well as in a different library. Bug:6657325 (cherry picked from commit c5a13efa9bc4264be0a9a9e37c00633af01584ed) Change-Id: I321d780bc2f9bd1baa749e1acacd2683aefe827b
* Fix sys_stat.mkfifo when not run as root.Christopher Ferris2014-09-241-11/+15
| | | | | | | | It's not allowed for a shell user to create a fifo in /data/local/tmp. Make the test do nothing if not run as root. Bug: 17646702 Change-Id: I932262fa233eae8b5dd607a2398a47c50a208701
* Add posix_fadvise(3).Elliott Hughes2014-09-101-2/+23
| | | | | Bug: 12449798 Change-Id: I07cbf3f670a0d1304b68148325a774f266b5c433
* Don't expose non-standard basename_r and dirname_r in LP64.Elliott Hughes2014-09-051-3/+3
| | | | | Bug: 17407423 Change-Id: I47fe499a4c396bf09d7b78fd828728d04777398b
* Fix pthread_attr_getstack__main_thread.Elliott Hughes2014-09-041-0/+12
| | | | | | | | | | | | | | | | There were two problems here: * This would fail when run with unlimited stack, because it didn't know that bionic reports unlimited stacks as 8MiB. * This would leave RLIMIT_STACK small, causing failures to exec (so the popen and system tests would fail). (cherry-pick of 27a9aed81978af792cb06035a1619c8141a5fb5b plus the new ScopeGuard.h from a3ad450a2e3fb6b3fe359683b247eba20896f646.) Bug: 17394276 Change-Id: I5b92dc64ca089400223b2d9a3743e9b9d57c1bc2
* Make stdatomic.h work with gcc4.6 host compilerHans Boehm2014-09-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed to make L work correctly, and bionic tests pass again, after applying the equivalent of commit 00aaea364501b3b0abe58dae461136159df1e356 there. It makes the preexisting code that uses __sync implementations much more useful, although we should no longer be exercising that code in AOSP. Specifically fixes: We were invoking __has_extension and __has_builtin for GCC compilations. They're clang specific. Restructured the tests. The __sync implementation was not defining the LOCK_FREE macros. ATOMIC_VAR_INIT was using named field initializations. These are a C, not C++, feature, that is not supported by g++ 4.6. The stdatomic bionic test still failed with 4.6 and glibc with our questionable LOCK_FREE macro implementation. Don't run that piece with 4.6. In L, this is a prerequisite for fixing: Bug:16880454 Bug:16513433 Change-Id: I9b61e42307f96a114dce7552b6ead4ad1c544eab (cherry picked from commit 32429606bf696d3b2ca555f132a0d60c566d0bd0)
* Fix, generalize stdatomic.h; improve test.Hans Boehm2014-09-022-7/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | We seem to use this stdatomic.h sometimes, and slightly different prebuilts at other times, making them all difficult to test, and making it unclear which one we're testing. This generalizes the bionic header so that it can be used directly as the prebuilt header as well. So long as they don't diverge again, that should somewhat improve test coverage. Use the correct builtin for atomic_is_lock_free. Fix atomic_flag_init. Turn on atomic tests even with __GLIBC__, since they now appear to pass. Include uchar.h in stdatomic.h where needed. Add a basic memory ordering test. Fix bit-rotted comments in bionic tests makefile. Prerequisite for fixing b/16880454 and Bug:16513433 Change-Id: If6a14c1075b379395ba5d93357d56025c0ffab68 (cherry picked from commit 00aaea364501b3b0abe58dae461136159df1e356)
* Have pthread_attr_getstack for the main thread report RLIMIT_STACK...Elliott Hughes2014-08-271-19/+12
| | | | | | | | | | | | | ...rather than just what's already mapped in. This seems somewhat contrary to POSIX's "All pages within the stack described by stackaddr and stacksize shall be both readable and writable by the thread", but it's what glibc does. Bug: 17111575 (cherry picked from commit 9e4ffa7032eaab308876b8e3da86b05c3c613878) Change-Id: I73f219a569917b2e4546c09436d7ef5231facc07
* Merge "Fix pthread_getattr_np for the main thread." into lmp-devElliott Hughes2014-08-272-3/+87
|\
| * Fix pthread_getattr_np for the main thread.Elliott Hughes2014-08-262-3/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On most architectures the kernel subtracts a random offset to the stack pointer in create_elf_tables by calling arch_align_stack before writing the auxval table and so on. On all but x86 this doesn't cause a problem because the random offset is less than a page, but on x86 it's up to two pages. This means that our old technique of rounding the stack pointer doesn't work. (Our old implementation of that technique was wrong too.) It's also incorrect to assume that the main thread's stack base and size are constant. Likewise to assume that the main thread has a guard page. The main thread is not like other threads. This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK) whenever we're asked. Bug: 17111575 Signed-off-by: Fengwei Yin <fengwei.yin@intel.com> (cherry picked from commit 57b7a6110e7e8b446fc23cce4765ff625ee0a105) Change-Id: I87e679ee1c0db8092f2d1221c8e7c1461545c5a4
* | call uselocale() before freelocale() to make sure that g_local_key has a ↵Wally Yau2014-08-272-2/+4
|/ | | | | | | | | | | | | | | | valid locale. For tests that call uselocale(), the locale is stored in the g_userlocale_key thread-specific key. If freelocale() is called later, then g_uselocal_key points to a deleted pointer. CTS eventually calls vfprintf to print the result, which calls MB_CUR_MAX and MB_CUR_MAX accesses the deleted locale stored in g_uselocale_key, causing unpredictable errors. Fixed the tests by calling uselocale() with the old locale before calling freelocale. Bug: 17299565 Change-Id: I87efa2a9b16999a11d587f68d3aeedcbe6ac8a2c
* Fix unistd.getpid_caching_and_clone.Elliott Hughes2014-08-211-0/+4
| | | | | | | | | | | This test only works if you're root (strictly: if you have permission to CLONE_NEWNS), so it's useful to us when we're doing ad hoc testing (since that's usually done as root), but it's not useful as part of CTS or when running the tests on the host. Bug: 16705621 Bug: 17170200 Change-Id: Ia92c871b15f7e45fc174bb59bc95540fd00ae745
* Revert "Add support for protected local symbol lookup."Dmitriy Ivanov2014-08-185-127/+0
| | | | | | | This reverts commit d97e9f546ea195686a78e539315b273393609b9e. Bug: 17107521 Change-Id: I2b81ce2b5a4a2d166133a2626e49d81b6aef3672
* Merge "Do a second key cleanup in pthread_exit." into lmp-devChristopher Ferris2014-08-061-18/+27
|\
| * Do a second key cleanup in pthread_exit.Christopher Ferris2014-08-061-18/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | During pthread_exit, the keys are cleaned. Unfortunately, a call to free occurs after the cleanup and the memory for some of the keys is recreated when using jemalloc. The solution is to do the key cleanup twice. Also, modify the pthread_detach__leak test to be less flaky when run on a jemalloc system. Bug: 16513133 Change-Id: Ic17e8344bdc1ba053c4f5b6d827a4c19c57860c1
* | Merge "Proper MB_CUR_MAX." into lmp-devDan Albert2014-08-062-2/+24
|\ \
| * | Proper MB_CUR_MAX.Dan Albert2014-08-062-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously this was hard coded to 4. This is only the case for UTF-8 locales. As a side effect, this properly reports C.UTF-8 as the default locale instead of C. Change-Id: I7c73cc8fe6ffac61d211cd5f75287e36de06f4fc (cherry picked from commit 1aec7c1a35b2d03038b194967d5ebdc8e2c24b80)
* | | Fix mbsrtowcs(3) src param for finished string.Dan Albert2014-08-061-1/+1
|/ / | | | | | | | | | | | | | | A mistake I made while cleaning this up the first time through. mbstrtowcs(3) sets the src param to null if it finishes the string. Change-Id: I6263646e25d9537043b7025fd1dd6ae195f365e2 (cherry picked from commit b6cc8e00cd562bd0f81fe44a6bc646540a862f32)
* | Revert "Revert "Fix dlsym(3) to do breadth first search.""Dmitriy Ivanov2014-08-042-4/+30
|/ | | | | | This reverts commit 1b1966d9448e979d1503a3d8843708bfa8880dc6. Change-Id: I05d6d3481aaf8f3e260d2e5e950248519a1d347f
* Revert "Fix dlsym(3) to do breadth first search."Dmitriy Ivanov2014-08-042-30/+4
| | | | | | This reverts commit 422106a24d620af4be58e8d92a2e9b7b6167b72d. Change-Id: I9e26a6933d10eb30438b521450f2010997ca5aee
* Fix memchr with a zero length.Christopher Ferris2014-07-301-0/+8
| | | | | | | | | | | | | | | | The memchr implementation for 64 bit fails if these conditions occur: - The buffer is 32 byte aligned. - The buffer contains the character in the first byte. - The count sent in is zero. The function should return NULL, but it's not. Bug: 16676625 (cherry picked from commit e03e1eac0b7682884b6628df1305d34299680cb4) Change-Id: Ie4cca2c445127a0936ee2b96651a8e7204fbaffd
* Only wipe TLS for user-supplied stacks.Elliott Hughes2014-07-301-0/+51
| | | | | | | | Bug: 16667988 (cherry picked from commit 40a521744825b6060960c296d5fb3da4c6593d94) Change-Id: I7550fa47b76e643323aa3e2a53529e393c829e47
* Merge "Fix mbsrtowcs(3)'s handling of len parameter." into lmp-devDan Albert2014-07-281-0/+11
|\
| * Fix mbsrtowcs(3)'s handling of len parameter.Dan Albert2014-07-291-0/+11
| | | | | | | | | | | | | | | | | | | | The len parameter is a _maximum_ length. The previous code was treating it as an exact length, causing the following typical call to fail: mbsrtowcs(out, &in, sizeof(out), state); // sizeof(out) > strlen(in) Change-Id: I48e474fd54ea5f122bc168a4d74bfe08704f28cc (cherry picked from commit 6b55ba54eff4657cffe053b71e1c9cce2944a8a9)
* | Fix dlsym(3) to do breadth first search.Dmitriy Ivanov2014-07-292-4/+30
|/ | | | | | | | | | | dlsym(3) with handle != RTLD_DEFAULT|RTLD_NEXT performs breadth first search through the dependency tree. Bug: 16653281 (cherry picked from commit aa0f2bdbc22d4b7aec5d3f8f5f01eaeaa13414c2) Change-Id: I0ba8c2034ab341f8a279cdb4e2e7e47f1aef7897
* Fix linkage of grantpt(3).Elliott Hughes2014-07-291-0/+99
| | | | | | | | | | | Also clean up the implementation of all the pty functions, add tests, and fix the stub implementations of ttyname(3) and ttyname_r(3). Bug: https://code.google.com/p/android/issues/detail?id=58888 (cherry picked from commit 4916706cfe590eb06c9b5bd4bd402ce056034d51) Change-Id: I5cb7a1c17b156456e4c4818e65f256eb8d045424
* syscall(3)'s return type should be long.Elliott Hughes2014-07-281-0/+9
| | | | | | | | | | | | | | | This doesn't require us to change any of the syscall implementations because (a) the LP32 ones have sizeof(int) == sizeof(long) anyway, which is how we never noticed this bug before and (b) the LP64 ones all use a 64-bit register for the result (and for the syscall number too). Bug: https://code.google.com/p/android/issues/detail?id=73952 Bug: 16568314 (cherry picked from commit 21972b61ec0572395c5684eebc6cc7b3a4c9e3be) Change-Id: Ifbc424be29e5650ec72a24df25dd35f24fdd5b3c
* Use vsnprintf(3) in syslog(3).Elliott Hughes2014-07-281-11/+0
| | | | | | | | | | | | | It seemed like a clever trick to use the internal log message formatting code in syslog(3), but on reflection that means you can't (for example) format floating point numbers. This patch switches us over to using good old vsnprintf(3), even though that requires us to jump through a few hoops. There's no obvious way to unit test this, so I wrote a little program and ran that. Bug: 14292866 Change-Id: I9c83500ba9cbb209b6f496067a91bf69434eeef5
* Start hiding "private/bionic_time.h".Elliott Hughes2014-07-251-37/+0
| | | | | | | | Bug: 15765976 (cherry picked from commit 905e6d58aaf515bf237e62078f8a321920fe4c6b) Change-Id: Ic7435308e8b521886f42ac7bf59531924921ea67
* [MIPS] Fix atomic_is_lock_free test for mips32.Raghu Gandham2014-07-241-0/+5
| | | | | | | | | On 32-bit MIPS, 64-bit atomic ops are achieved through locks. So allow the test to fail for atomic_intmax_t on 32-bit MIPS. (cherry picked from commit f1837377d215a6eda294b6ac7552b226deee91ce) Change-Id: I973d999c31c9ab89b5a7b709beff6486b93408f2
* Implement twalk(3), add unit tests.Elliott Hughes2014-07-242-0/+211
| | | | | | | | | | | | | | | I've also added insque(3) and remque(3) (from NetBSD because the OpenBSD ones are currently broken for non-circular lists). I've not added the three hash table functions that should be in this header because they operate on a single global hash table and thus aren't likely to be useful. Bug: https://code.google.com/p/android/issues/detail?id=73719 (cherry picked from commit 3e424d0a241f8ae5194514dabc4ad899f5a5416d) Change-Id: I5882a6b48c80fea8ac6b9c27e7b9de10b202b4ff
* debuggerd: if PR_GET_DUMPABLE=0, don't ask for dumpingNick Kralevich2014-07-231-58/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | PR_GET_DUMPABLE is used by an application to indicate whether or not core dumps / PTRACE_ATTACH should work. Security sensitive applications often set PR_SET_DUMPABLE to 0 to disable core dumps, to avoid leaking sensitive memory to persistent storage. Similarly, they also set PR_SET_DUMPABLE to zero to prevent PTRACE_ATTACH from working, again to avoid leaking the contents of sensitive memory. Honor PR_GET_DUMPABLE when connecting to debuggerd. If an application has said it doesn't want its memory dumped, then we shouldn't ask debuggerd to dump memory on its behalf. FORTIFY_SOURCE tests: Modify the fortify_source tests to set PR_SET_DUMPABLE=0. This reduces the total runtime of /data/nativetest/bionic-unit-tests/bionic-unit-tests32 from approx 53 seconds to 25 seconds. There's no need to connect to debuggerd when running these tests. Bug: 16513137 (cherry picked from commit be0e43b77676338fd5e6a82c9cc2b6302d579de2) Change-Id: I6e1a9bce564e94fc19893d639b15f38c549cabfa
* Rewrite syslog(3) to use Android logging.Elliott Hughes2014-07-211-0/+11
| | | | | | | | | | | | Since we don't have syslogd on Android and you can't run one on a non-rooted device, it's more useful if syslog output just goes to the regular Android logging system. Bug: 14292866 (cherry picked from commit 3ad8ecb64e9dd5614169232b84a93eb3b8aa32d7) Change-Id: I3038855ca4f22532bf6d2c45d3f8028b866975f9
* Use VDSO for clock_gettime(2) and gettimeofday(2).Elliott Hughes2014-07-162-0/+42
| | | | | | | | Bug: 15387103 (cherry picked from commit 625993dfbb085a3cde7492eda8ec1cdc1ee39a78) Change-Id: I0e156d7049ba1495902259071a96936592e74025
* Implement rand/srand in terms of random/srandom.Elliott Hughes2014-07-141-7/+0
| | | | | | | | | | | Code developed for glibc or older versions of bionic might expect more randomness than the BSD implementation provides. Bug: 15829381 (cherry picked from commit 76c241b091b4d9d9a9237d40e814e52ce2917f47) Change-Id: If721b3f16efdb21cb67df5ec5034c0ba905bd029
* Make jemalloc the default choice.Christopher Ferris2014-07-111-4/+6
| | | | Change-Id: I5ff0cf0c396b7ae6278e6fcd5a0d50f8b966fb54
* Merge "TARGET_OUT_DATA_NATIVE_TESTS now points to ↵Ying Wang2014-07-091-2/+2
|\ | | | | | | $(TARGET_OUT_DATA)/nativetest64 in 64-bit target"
| * TARGET_OUT_DATA_NATIVE_TESTS now points to $(TARGET_OUT_DATA)/nativetest64 ↵Ying Wang2014-07-081-2/+2
| | | | | | | | | | | | in 64-bit target Change-Id: I9a562e79de7ec0f065c90de9ae1b72cbcd7d8c6b
* | Add test for constructor function.Dmitriy Ivanov2014-07-081-0/+12
|/ | | | Change-Id: I0ad26d617f00cdd6c2241d613be39a1d16918612
* Merge "Load library using file handle."Dmitriy Ivanov2014-07-023-0/+40
|\
| * Load library using file handle.Dmitriy Ivanov2014-07-023-0/+40
| | | | | | | | | | | | | | | | * This patch enables dlopen by file descriptor instead of path/name. Bug: 15984217 Change-Id: Ib39051e00567fb97070bf96d8ce63993877c0a01
* | Disable local/protected symbol test for lp64Dmitriy Ivanov2014-07-011-0/+5
|/ | | | | | | | * Static linker optimizes protected local symbol out of existence, which leads to test failure. Disabling it for now. Change-Id: I8de327e5073f98b64639f7a0bba3a273aa419884
* Build all bionic test files -Werror and fix our one warning.Elliott Hughes2014-07-012-5/+5
| | | | Change-Id: I62bb0528fd1bcb9aa4c61e44c78158a592690fc7