Merge changes from topic "skip_with_native_bridge"
* changes: Skip pthread_leak* tests with native_bridge Add util to skip tests with native_bridge
This commit is contained in:
commit
b1a2529546
2 changed files with 28 additions and 12 deletions
|
@ -109,23 +109,21 @@ std::ostream& operator<<(std::ostream& os, const LeakChecker& lc) {
|
|||
|
||||
// http://b/36045112
|
||||
TEST(pthread_leak, join) {
|
||||
SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
|
||||
|
||||
LeakChecker lc;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// http://b/36045112
|
||||
TEST(pthread_leak, detach) {
|
||||
SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
|
||||
|
||||
LeakChecker lc;
|
||||
|
||||
// Ancient devices with only 2 cores need a lower limit.
|
||||
|
@ -158,8 +156,7 @@ TEST(pthread_leak, detach) {
|
|||
|
||||
WaitUntilAllThreadsExited(tids, thread_count);
|
||||
|
||||
// A native bridge implementation might need a warm up pass to reach a steady state.
|
||||
// http://b/37920774.
|
||||
// TODO(b/158573595): the test is flaky without the warmup pass.
|
||||
if (pass == 0) lc.Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__BIONIC__)
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
|
||||
#if defined(__BIONIC__)
|
||||
#include <bionic/macros.h>
|
||||
#else
|
||||
|
@ -72,6 +76,21 @@ static inline bool running_with_hwasan() {
|
|||
|
||||
#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
|
||||
|
||||
static inline bool running_with_native_bridge() {
|
||||
#if defined(__BIONIC__)
|
||||
#if defined(__arm__)
|
||||
static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm");
|
||||
return pi != nullptr;
|
||||
#elif defined(__aarch64__)
|
||||
static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm64");
|
||||
return pi != nullptr;
|
||||
#endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#define SKIP_WITH_NATIVE_BRIDGE if (running_with_native_bridge()) GTEST_SKIP()
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include <sys/sysmacros.h>
|
||||
|
|
Loading…
Reference in a new issue