Add a warm up pass to pthread_leak.join test

Bug: 73105445
Bug: 37920774
Test: bionic-unit-tests --gtest_filter=pthread_leak*
Change-Id: I227c999ecc13ee0a2136ff6b00a722f135dd48fe
(cherry picked from commit 775fb09621)
This commit is contained in:
Evgeny Eltsin 2018-05-04 20:08:37 +02:00
parent 7eb976e00d
commit 284c4fdc39

View file

@ -107,10 +107,17 @@ std::ostream& operator<<(std::ostream& os, const LeakChecker& lc) {
// http://b/36045112
TEST(pthread_leak, join) {
LeakChecker lc;
for (int i = 0; i < 100; ++i) {
pthread_t thread;
ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
ASSERT_EQ(0, pthread_join(thread, nullptr));
for (size_t pass = 0; pass < 2; ++pass) {
for (int i = 0; i < 100; ++i) {
pthread_t thread;
ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
ASSERT_EQ(0, pthread_join(thread, nullptr));
}
// A native bridge implementation might need a warm up pass to reach a steady state.
// http://b/37920774.
if (pass == 0) lc.Reset();
}
}
@ -145,9 +152,8 @@ TEST(pthread_leak, detach) {
WaitUntilAllExited(tids, arraysize(tids));
// houdini keeps a thread pool, so we ignore the first pass while the
// pool fills, but then on the second pass require that the "pool" isn't
// actually an unbounded leak. https://issuetracker.google.com/37920774.
// A native bridge implementation might need a warm up pass to reach a steady state.
// http://b/37920774.
if (pass == 0) lc.Reset();
}
}