summaryrefslogtreecommitdiffstats
path: root/libutils/tests
Commit message (Collapse)AuthorAgeFilesLines
* bpfmt.Elliott Hughes2018-02-161-2/+8
| | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* Use -Werror in system/coreChih-Hung Hsieh2017-11-011-0/+2
| | | | | | | | | * Move -Wall -Werror from cppflags to cflags. * Fix/suppress warning on unused variables. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
* libutils: Fix bug in strstr16.Branislav Rankov2017-10-241-1/+30
| | | | | | | | | | | | | In the original code when target is an empty string strlen16() would start reading the memory until a "terminating null" (that is, zero) character is found. This may happen because "*target++", at line 300, would increment the pointer beyond the actual string. Signed-off-by: Branislav Rankov <branislav.rankov@arm.com> Signed-off-by: Tamas Petz <tamas.petz@arm.com> Test: libutils_tests --gtest_filter=UnicodeTest.strstr16* Change-Id: I213ffe061057c7fa8f34b68881e106a709557dcd
* Use target.linux for all linux kernel based targetsDan Willemsen2017-10-161-3/+1
| | | | | | | | | | Now in Android.bp files, target.linux applies to all targets running a linux kernel (android, linux_glibc, linux_bionic). So common flags/sources/etc can be combined instead of copying them to each target. Test: m Change-Id: If7ad138ea1c540c160731f86b6ccc0daa5c69b83
* Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]Dan Willemsen2017-10-021-1/+1
| | | | | | | | | | | | | | In the future, target.linux will apply to all targets running a linux kernel (android, linux_glibc, linux_bionic). So move all current users to the specific linux_glibc. There will be another cleanup pass later that will move some instances back to target.linux if the properties should be shared with target.android and target.linux_bionic, but target.linux needs to be removed first. Test: out/soong/build.ninja identical before/after Change-Id: I72ef34689c60ce547cab2898e354b027e335f6a1 Exempt-From-Owner-Approval: build system cleanup
* Remove default librariesDan Willemsen2017-09-291-2/+0
| | | | | | | | | | libdl is part of system_shared_libs now. -ldl -lpthread -lm are now defaults for host_ldlibs on Linux and Darwin. -lrt is a default for host_ldlibs on Linux. Test: m host Change-Id: I0b3c147b00a8ab6ff289b85db55b88836c905f5c Exempt-From-Owner-Approval: build system cleanup
* Merge "Add thread safety analysis annotations."Siarhei Vishniakou2017-07-252-0/+34
|\ | | | | | | | | | | am: e7ce8c8485 Change-Id: I4963b623b6e5a190bfee1dcfec01fe009ba0e94f
| * Add thread safety analysis annotations.Siarhei Vishniakou2017-07-212-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable thread safety analysis annotations for clang. See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html for instructions on using these in the source code. Bug: 28094863 Test: annotated frameworks/native/services/inputflinger/InputDispatcher.cpp and enabled '-Werror' and '-Wthread-safety' clang compiler flags in Android.bp for inputflinger. Observed compiler errors when accessing instance attributes without holding a lock. Also added a compile test Mutex_test.cpp, which can be build using m libutils_tests and run using /data/nativetest64/libutils_tests/libutils_tests Change-Id: I24ce111241cc339901bc45dda8b446df5299af4a
* | Remove BlobCAche from libutilsMathias Agopian2017-03-102-426/+0
|/ | | | | | | | | it has moved to libEGL which was the only client. Test: compiled & Run Bug: vndk-stable Change-Id: Ife18727fa1c48b1be6910058867016348b7f02c1
* Add tests for multiton issueColin Cross2017-02-285-0/+212
| | | | | | | | | | Test accessing a singleton from two libraries, the second of which depends on the first but is dlopen'd after the first is already loaded. Bug: 35674422 Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests Change-Id: I975ba933a19b941a52bdb6e9c221a6910ffb8081
* Make libutils test compile on the hostColin Cross2017-02-241-17/+33
| | | | | | | | | Reapply of Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78 with RefBase_test.cpp and Looper_test.cpp removed from mac builds. Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests Test: out/host/darwin-x86/nativetest64/libutils_tests/libutils_tests Change-Id: I5979b296a8500b5697d94d64fc441363047adcea
* Revert "Make libutils test compile on the host"Richard Uhler2017-02-241-25/+15
| | | | | | | | Fails mac build: "system/core/include/utils/Looper.h:25:10: fatal error: 'sys/epoll.h' file not found" This reverts commit afa891e85e7d8f852d0eab706d44226b6fdfedd1. Change-Id: Ib558b8f5a303b55ab32a399d338d8aac0fae32b2
* Make libutils test compile on the hostColin Cross2017-02-231-15/+25
| | | | | Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests Change-Id: Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78
* Fix ODR issue in StrongPointer_test.cppColin Cross2017-02-231-7/+7
| | | | | | | | | StrongPointer_test.cpp's Foo was colliding with RefBase_test.cpp's Foo. Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests from later CL Change-Id: I2a4e956c88a07cec72d7ce734cf06c58134a4235
* Make __android_log_assert behave more like libc asserts.Elliott Hughes2017-02-061-18/+4
| | | | | | | | | | If we don't output to stderr too, not only is it annoying to shell users (who won't see anything), it prevents us from writing better gtests that actually make assertions about the assert message. Bug: http://b/23675822 Test: libutils tests still pass Change-Id: I62b3144c385cba4dde485f0b0f9b42aeaef51e9a
* system/core Replace cutils/log.h with android/log.hMark Salyzyn2016-09-303-8/+11
| | | | | | | | | | | Should use android/log.h instead of cutils/log.h as a good example to all others. Adjust header order to comply with Android Coding standards. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
* libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8Sergio Giro2016-08-251-0/+19
| | | | | | | | | | | | | Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length is causing a heap overflow. Correcting the length computation and adding bound checks to the conversion functions. Test: ran libutils_tests Bug: 29250543 Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb (cherry picked from commit c4966a363e46d2e1074d1a365e232af0dcedd6a1)
* Unicode: specify destination length in utf8_to_utf16 methodsSergio Giro2016-08-251-1/+12
| | | | | | | | | | String16(const char *utf8) now returns the empty string in case a string ends halfway throw a utf8 character. Bug: 29267949 Clean cherry-pick from 1dcc0c82394ec9cd6887c7ca39f9b5024db01ac9 Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
* Merge "Make RefBase more robust and debuggable"Hans Boehm2016-08-241-21/+95
|\
| * Make RefBase more robust and debuggableHans Boehm2016-08-131-21/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents two different kinds of client errors from causing undetected memory corruption, and helps with the detection of others: 1. We no longer deallocate objects when the weak count goes to zero and there have been no strong references. This otherwise causes us to return a garbage object from a constructor if the constructor allocates and deallocates a weak pointer to this. And we do know that clients allocate such weak pointers in constructors and their lifetime is hard to trace. 2. We abort if a RefBase object is explicitly destroyed while the weak count is nonzero. Otherwise a subsequent decrement would cause a write to potentially reallocated memory. 3. We check counter values returned by atomic decrements for plausibility, and fail immediately if they are not plausible. We unconditionally log any cases in which 1 changes behavior from before. We abort in cases in which 2 changes behavior, since those reflect clear bugs. In case 1, a log message now indicates a possible leak. We have not seen such a message in practice. The third point introduces a small amount of overhead into the reference count decrement path. But this should be negligible compared to the actual decrement cost. Add a test for promote/attemptIncStrong that tries to check for both (1) above and concurrent operation of attemptIncStrong. Add some additional warnings and explanations to the RefBase documentation. Bug: 30503444 Bug: 30292291 Bug: 30292538 Change-Id: Ida92b9a2e247f543a948a75d221fbc0038dea66c
* | Merge \"Fix google-explicit-constructor warnings in system/core.\"Chih-Hung Hsieh2016-07-293-3/+3
|\| | | | | | | | | | | am: 6dc68cb5f9 Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
| * Fix google-explicit-constructor warnings in system/core.Chih-Hung Hsieh2016-07-263-3/+3
| | | | | | | | | | | | | | | | | | | | * Declare explicit conversion constructors. * Add NOLINT for implicit conversion constructors. * Fix also some misaligned indendations. Bug: 28341362 Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e Test: build with clang-tidy
* | Merge \"LruCache: avoid copying keys in lookup\"Sergio Giro2016-07-201-0/+18
|\| | | | | | | | | | | am: 896c6b14ae Change-Id: If8223e90988510385378506cd3a05d382ab73fc9
| * LruCache: avoid copying keys in lookupSergio Giro2016-07-201-0/+18
| | | | | | | | | | | | | | | | Create objects of type KeyedEntry for lookups that only have a key reference Bug: 27567036 Change-Id: I5e609a3db63d3b9277ff1547a3cca37dce70251c
* | Merge \"Add test for RefBase etc.\"Hans Boehm2016-07-144-2/+199
|\| | | | | | | | | | | am: dc9fbc3440 Change-Id: I77ead7f91c17ee8c5614da783152ac3478fc5342
| * Add test for RefBase etc.Hans Boehm2016-07-134-2/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add some basic tests for RefBase, as well as a more ambitious memory ordering test. Add a README.txt with instructions to run the tests. Comment out a couple of BlobCache tests that failed consistently and appeared to be incorrect. With that fix, I managed to run libutils_tests successfully on device. Bug: 28705989 Change-Id: I8ad29995097a149a0cc38615d6ed37117ec6cb5c
* | resolve merge conflicts of 41e82a3 to stage-aosp-masterColin Cross2016-07-122-49/+49
|\| | | | | | | Change-Id: I5a7faca3249f0c038914540b1dd29edf0084c0e1
| * Convert libbacktrace, libutils to SoongDan Willemsen2016-07-122-49/+49
| | | | | | | | Change-Id: I8b578f671f92246aca61f98937d75a60b56bc5c6
* | Merge "SystemClock: add test" am: 282e8fb037Greg Hackmann2016-05-162-0/+75
|\| | | | | | | | | | | | | | | | | am: a91a1a990f * commit 'a91a1a990f1d629377dcd2c3f2b57ccab48dc8cf': SystemClock: add test Change-Id: I547a4c3422eb468530e3cdd02eb2bb157a444a15
| * SystemClock: add testGreg Hackmann2016-05-022-0/+75
| | | | | | | | | | | | | | Bug: 28357356 Change-Id: Idf66c048bda09cd8cb08adf89ed0edd3770c4e39 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* | Merge commit '8b452b876b90dcfff1dab9012b65b5e67c4531a4' into ↵Michael Wright2016-05-161-0/+35
|\ \ | | | | | | | | | | | | | | | manual_merge_8b452b8 Change-Id: Iacdc2d521f669661b4979c03b0476512abdb37c7
| * | Add String16#contains and strstr16 methods.Michael Wright2016-05-091-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | These are needed for aapt to find javadoc comments that contain "@removed" in order to skip them when printing styleable docs. Bug: 28663748 Change-Id: I8866d2167c41e11d6c2586da369560d5815fd13e
* | | system/core: Make Thread::run threadName argument requiredBrian Carlstrom2016-03-141-2/+2
|\| | | | | | | | | | | | | | | | | | | | am: e71b914775 * commit 'e71b9147756ab4da306e4c16461ad23936769603': system/core: Make Thread::run threadName argument required
| * | system/core: Make Thread::run threadName argument requiredBrian Carlstrom2016-03-121-2/+2
| | | | | | | | | | | | | | | Bug: 27557176 Change-Id: Iae83a1e5489c86c2858fc8481f246b8480f0eec4
* | | Merge "system/core/lib[c]utils: Fix signedness comparison warnings." am: ↵James Hawkins2016-03-011-2/+2
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | bba2151b29 am: 65df16b05f * commit '65df16b05f8d590e1fccc19e9a28833d6a71567d': system/core/lib[c]utils: Fix signedness comparison warnings.
| * system/core/lib[c]utils: Fix signedness comparison warnings.James Hawkins2016-03-011-2/+2
| | | | | | | | | | | | | | | | * Store the output of a length variable in size_t. * Annotate unsigned constant values as such. Bug: 27384813 Change-Id: I8504c0a8f5840d4d42e5c0df797a4e5d02d13eb9
* | Merge "libutils: fix cache removal when callback invalidates the key" am: ↵Sergio Giro2015-11-201-0/+38
|\| | | | | | | | | | | | | | | | | b0df9dca7c am: e483305e47 am: a96cd36afb * commit 'a96cd36afbff682e24365092dd85bbe9c9165afc': libutils: fix cache removal when callback invalidates the key
| * libutils: fix cache removal when callback invalidates the keySergio Giro2015-11-201-0/+38
| | | | | | | | | | Bug: 24785286 Change-Id: I9d17d2247258a56ef7776b3a701389e825a9c533
* | Merge "Teach sp<> how to std::move" am: 518d043c86 am: bb12b91ae1John Reck2015-11-032-0/+59
|\| | | | | | | | | | | | | am: a573d6b186 * commit 'a573d6b18686266667c8efd9d7291ecd28efa67c': Teach sp<> how to std::move
| * Merge "Teach sp<> how to std::move"John Reck2015-11-022-0/+59
| |\ | | | | | | | | | | | | | | | | | | am: 518d043c86 * commit '518d043c8693835061b02ecbbee4b82fc61a776e': Teach sp<> how to std::move
| | * Teach sp<> how to std::moveJohn Reck2015-10-292-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | Arguably we should migrate to std::shared_ptr but for now make std::vector<sp<>> a bit less horrible Change-Id: Ia458a2daff0b656b2f3310b3ea100565ec844c69
* | | am 51209a8b: am 9443fd94: am f8376607: Merge "system/core: fix iterator for ↵Sergio Giro2015-10-131-0/+106
|\| | | | | | | | | | | | | | | | | | | | LruCache" * commit '51209a8b93d85f8b7f3b6a106c41c1aa03190f2c': system/core: fix iterator for LruCache
| * | am f8376607: Merge "system/core: fix iterator for LruCache"Sergio Giro2015-10-131-0/+106
| |\| | | | | | | | | | | | | * commit 'f83766079e248e04065103a4720364c0193777ee': system/core: fix iterator for LruCache
| | * system/core: fix iterator for LruCacheSergio Giro2015-10-121-0/+106
| | | | | | | | | | | | | | | | | | Was failing to return the first element Change-Id: Ic803f5d463a56519212014d0d190407cf4b859cf
| * | am bdae9bf2: resolved conflicts for 70808827 to stage-aosp-masterSergio Giro2015-10-012-583/+0
| |\| | | | | | | | | | | | | * commit 'bdae9bf2ec3bbf8e33a34caa412bd8fd7bc2d434': system/core: remove BasicHashtable
* | | system/core: remove BasicHashtableSergio Giro2015-10-012-583/+0
| | | | | | | | | | | | | | | | | | | | | Towards deprecation of SharedBuffer Change-Id: Id6d1c8637583df38b6f28398b6804d9c1e96472a (cherry picked from commit f84a4906fa950a238e8775a8c931e07632f6023d)
* | | Revert "resolved conflicts for 70808827 to stage-aosp-master"Sergio Giro2015-10-012-0/+583
| | | | | | | | | | | | | | | | | | This reverts commit 5cf2d5c9cc7d3a582154c93ebc4fd7fc7584ded0. Change-Id: Ifcffff034d4610c0d318cf67b0d98a28551c9605
* | | resolved conflicts for 70808827 to stage-aosp-masterSergio Giro2015-10-012-583/+0
|\ \ \ | | |/ | |/| | | | Change-Id: I5e5030a20f2be3bd15b9fec8192dd22ec5a34d87
| * | system/core: remove BasicHashtableSergio Giro2015-10-012-583/+0
| | | | | | | | | | | | | | | | | | Towards deprecation of SharedBuffer Change-Id: Id6d1c8637583df38b6f28398b6804d9c1e96472a
* | | am fbb259e8: am 8e2c8208: am 730fdbb1: Merge "system/core: change LruCache ↵Sergio Giro2015-09-301-1/+1
|\ \ \ | | |/ | |/| | | | | | | | | | | | | to use unordered_set instead of BasicHashTable" * commit 'fbb259e83633c35c5e6ede1d5f55f5672ab433d0': system/core: change LruCache to use unordered_set instead of BasicHashTable