summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-05-07 16:53:25 -0700
committerYabin Cui <yabinc@google.com>2015-05-18 10:31:20 -0700
commit2b5c2285c0679190b90b954d5e71f7ee8698adba (patch)
tree1b23d5316c5911b817064ac36715b9dc841b003f
parent8557eeb0add011ff37edc86f50f423ce681eeb2b (diff)
downloadbionic-2b5c2285c0679190b90b954d5e71f7ee8698adba.zip
bionic-2b5c2285c0679190b90b954d5e71f7ee8698adba.tar.gz
bionic-2b5c2285c0679190b90b954d5e71f7ee8698adba.tar.bz2
Remove pthread_detach_no_leak test.
This test has lost its purpose as we are using mmap/munmap for pthread_internal_t. And it is a flaky test. Bug: 21205574 Bug: 20860440 Change-Id: I7cbb6bc3fd8a2ca430415beab5ee27a856ce4ea7 (cherry picked from commit 2957cc5f1043adf0b9c0f1cdfff2d408952e40f5)
-rw-r--r--tests/pthread_test.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index cbbcada..201b8a9 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -458,42 +458,6 @@ TEST(pthread, pthread_detach__no_such_thread) {
ASSERT_EQ(ESRCH, pthread_detach(dead_thread));
}
-TEST(pthread, pthread_detach_no_leak) {
- size_t initial_bytes = 0;
- // Run this loop more than once since the first loop causes some memory
- // to be allocated permenantly. Run an extra loop to help catch any subtle
- // memory leaks.
- for (size_t loop = 0; loop < 3; loop++) {
- // Set the initial bytes on the second loop since the memory in use
- // should have stabilized.
- if (loop == 1) {
- initial_bytes = mallinfo().uordblks;
- }
-
- pthread_attr_t attr;
- ASSERT_EQ(0, pthread_attr_init(&attr));
- ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
-
- std::vector<pthread_t> threads;
- for (size_t i = 0; i < 32; ++i) {
- pthread_t t;
- ASSERT_EQ(0, pthread_create(&t, &attr, IdFn, NULL));
- threads.push_back(t);
- }
-
- sleep(1);
-
- for (size_t i = 0; i < 32; ++i) {
- ASSERT_EQ(0, pthread_detach(threads[i])) << i;
- }
- }
-
- size_t final_bytes = mallinfo().uordblks;
- int leaked_bytes = (final_bytes - initial_bytes);
-
- ASSERT_EQ(0, leaked_bytes);
-}
-
TEST(pthread, pthread_getcpuclockid__clock_gettime) {
SpinFunctionHelper spinhelper;