summaryrefslogtreecommitdiff
path: root/libutils/tests
AgeCommit message (Collapse)Author
2019-02-11Clean up libcutils/libutils tests.Elliott Hughes
Move tests in the same directory as the corresponding code, so it's easier to see what is/isn't tested. Fix naming of libcutils_tests (plural) to match the singular that's more common (even though the plural makes more sense to me). Add these two to system/core/'s TEST_MAPPING. Remove obsolete AndroidTest.xml. Fix a flaky (timing-dependent) libcutils test. Test: ran tests Change-Id: I7e0a31ff45c8a152562bf66fc97161594249366e
2019-02-06MappedFile and FileMap should support zero-length mappings.Elliott Hughes
Bug: http://b/119818070 "app crashes when reading asset of zero length" Test: ran tests Change-Id: Idd2ad6f6e72c8e445aff78a460fac96dea41c950
2018-07-16[libutils] Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-02-16bpfmt.Elliott Hughes
Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2017-11-01Use -Werror in system/coreChih-Hung Hsieh
* Move -Wall -Werror from cppflags to cflags. * Fix/suppress warning on unused variables. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
2017-10-24libutils: Fix bug in strstr16.Branislav Rankov
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
2017-10-16Use target.linux for all linux kernel based targetsDan Willemsen
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
2017-10-02Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]Dan Willemsen
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
2017-09-29Remove default librariesDan Willemsen
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
2017-07-25Merge "Add thread safety analysis annotations."Siarhei Vishniakou
am: e7ce8c8485 Change-Id: I4963b623b6e5a190bfee1dcfec01fe009ba0e94f
2017-07-21Add thread safety analysis annotations.Siarhei Vishniakou
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
2017-03-10Remove BlobCAche from libutilsMathias Agopian
it has moved to libEGL which was the only client. Test: compiled & Run Bug: vndk-stable Change-Id: Ife18727fa1c48b1be6910058867016348b7f02c1
2017-02-28Add tests for multiton issueColin Cross
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
2017-02-24Make libutils test compile on the hostColin Cross
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
2017-02-24Revert "Make libutils test compile on the host"Richard Uhler
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
2017-02-23Make libutils test compile on the hostColin Cross
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests Change-Id: Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78
2017-02-23Fix ODR issue in StrongPointer_test.cppColin Cross
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
2017-02-06Make __android_log_assert behave more like libc asserts.Elliott Hughes
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
2016-09-30system/core Replace cutils/log.h with android/log.hMark Salyzyn
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
2016-08-25libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8Sergio Giro
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)
2016-08-25Unicode: specify destination length in utf8_to_utf16 methodsSergio Giro
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
2016-08-24Merge "Make RefBase more robust and debuggable"Hans Boehm
2016-08-13Make RefBase more robust and debuggableHans Boehm
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
2016-07-29Merge \"Fix google-explicit-constructor warnings in system/core.\"Chih-Hung Hsieh
am: 6dc68cb5f9 Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
2016-07-26Fix google-explicit-constructor warnings in system/core.Chih-Hung Hsieh
* 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
2016-07-20Merge \"LruCache: avoid copying keys in lookup\"Sergio Giro
am: 896c6b14ae Change-Id: If8223e90988510385378506cd3a05d382ab73fc9
2016-07-20LruCache: avoid copying keys in lookupSergio Giro
Create objects of type KeyedEntry for lookups that only have a key reference Bug: 27567036 Change-Id: I5e609a3db63d3b9277ff1547a3cca37dce70251c
2016-07-14Merge \"Add test for RefBase etc.\"Hans Boehm
am: dc9fbc3440 Change-Id: I77ead7f91c17ee8c5614da783152ac3478fc5342
2016-07-13Add test for RefBase etc.Hans Boehm
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
2016-07-12resolve merge conflicts of 41e82a3 to stage-aosp-masterColin Cross
Change-Id: I5a7faca3249f0c038914540b1dd29edf0084c0e1
2016-07-12Convert libbacktrace, libutils to SoongDan Willemsen
Change-Id: I8b578f671f92246aca61f98937d75a60b56bc5c6
2016-05-16Merge "SystemClock: add test" am: 282e8fb037Greg Hackmann
am: a91a1a990f * commit 'a91a1a990f1d629377dcd2c3f2b57ccab48dc8cf': SystemClock: add test Change-Id: I547a4c3422eb468530e3cdd02eb2bb157a444a15
2016-05-16Merge commit '8b452b876b90dcfff1dab9012b65b5e67c4531a4' into ↵Michael Wright
manual_merge_8b452b8 Change-Id: Iacdc2d521f669661b4979c03b0476512abdb37c7
2016-05-09Add String16#contains and strstr16 methods.Michael Wright
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
2016-05-02SystemClock: add testGreg Hackmann
Bug: 28357356 Change-Id: Idf66c048bda09cd8cb08adf89ed0edd3770c4e39 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-03-14system/core: Make Thread::run threadName argument requiredBrian Carlstrom
am: e71b914775 * commit 'e71b9147756ab4da306e4c16461ad23936769603': system/core: Make Thread::run threadName argument required
2016-03-12system/core: Make Thread::run threadName argument requiredBrian Carlstrom
Bug: 27557176 Change-Id: Iae83a1e5489c86c2858fc8481f246b8480f0eec4
2016-03-01Merge "system/core/lib[c]utils: Fix signedness comparison warnings." am: ↵James Hawkins
bba2151b29 am: 65df16b05f * commit '65df16b05f8d590e1fccc19e9a28833d6a71567d': system/core/lib[c]utils: Fix signedness comparison warnings.
2016-03-01system/core/lib[c]utils: Fix signedness comparison warnings.James Hawkins
* Store the output of a length variable in size_t. * Annotate unsigned constant values as such. Bug: 27384813 Change-Id: I8504c0a8f5840d4d42e5c0df797a4e5d02d13eb9
2015-11-20Merge "libutils: fix cache removal when callback invalidates the key" am: ↵Sergio Giro
b0df9dca7c am: e483305e47 am: a96cd36afb * commit 'a96cd36afbff682e24365092dd85bbe9c9165afc': libutils: fix cache removal when callback invalidates the key
2015-11-20libutils: fix cache removal when callback invalidates the keySergio Giro
Bug: 24785286 Change-Id: I9d17d2247258a56ef7776b3a701389e825a9c533
2015-11-03Merge "Teach sp<> how to std::move" am: 518d043c86 am: bb12b91ae1John Reck
am: a573d6b186 * commit 'a573d6b18686266667c8efd9d7291ecd28efa67c': Teach sp<> how to std::move
2015-11-02Merge "Teach sp<> how to std::move"John Reck
am: 518d043c86 * commit '518d043c8693835061b02ecbbee4b82fc61a776e': Teach sp<> how to std::move
2015-10-29Teach sp<> how to std::moveJohn Reck
Arguably we should migrate to std::shared_ptr but for now make std::vector<sp<>> a bit less horrible Change-Id: Ia458a2daff0b656b2f3310b3ea100565ec844c69
2015-10-13am 51209a8b: am 9443fd94: am f8376607: Merge "system/core: fix iterator for ↵Sergio Giro
LruCache" * commit '51209a8b93d85f8b7f3b6a106c41c1aa03190f2c': system/core: fix iterator for LruCache
2015-10-13am f8376607: Merge "system/core: fix iterator for LruCache"Sergio Giro
* commit 'f83766079e248e04065103a4720364c0193777ee': system/core: fix iterator for LruCache
2015-10-12system/core: fix iterator for LruCacheSergio Giro
Was failing to return the first element Change-Id: Ic803f5d463a56519212014d0d190407cf4b859cf
2015-10-01system/core: remove BasicHashtableSergio Giro
Towards deprecation of SharedBuffer Change-Id: Id6d1c8637583df38b6f28398b6804d9c1e96472a (cherry picked from commit f84a4906fa950a238e8775a8c931e07632f6023d)
2015-10-01am bdae9bf2: resolved conflicts for 70808827 to stage-aosp-masterSergio Giro
* commit 'bdae9bf2ec3bbf8e33a34caa412bd8fd7bc2d434': system/core: remove BasicHashtable
2015-10-01Revert "resolved conflicts for 70808827 to stage-aosp-master"Sergio Giro
This reverts commit 5cf2d5c9cc7d3a582154c93ebc4fd7fc7584ded0. Change-Id: Ifcffff034d4610c0d318cf67b0d98a28551c9605