Random HWASan cleanups.
Makes CtsBionicTestCases pass under HWASan.
Bug: 193568145
Test: CtsBionicTestCases
Change-Id: I38ee8a8508827c0ffee61ce33bb8c6a3f40388c9
diff --git a/tests/leak_test.cpp b/tests/leak_test.cpp
index 80618e5..0a881e1 100644
--- a/tests/leak_test.cpp
+++ b/tests/leak_test.cpp
@@ -112,11 +112,17 @@
TEST(pthread_leak, join) {
SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
+ // Warm up. HWASan allocates an extra page on the first iteration, but never after.
+ pthread_t thread;
+ ASSERT_EQ(0, pthread_create(
+ &thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
+ ASSERT_EQ(0, pthread_join(thread, nullptr));
+
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_create(
+ &thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
ASSERT_EQ(0, pthread_join(thread, nullptr));
}
}