From cde2b524f14cf5a382242ca2c6e08cdec492cbf0 Mon Sep 17 00:00:00 2001 From: Jaesung Chung Date: Thu, 22 Jun 2017 14:12:38 +0900 Subject: [PATCH] crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices The debuggerd_client.race tests the crash_dump process to finalize the killed process within 2 seconds. The 2 seconds timeout for finalizing a process, which has 1024 threads, is bit small for low-speed devices. This CL lowers the bar in order to make such devices pass the test. Wraping up 128 threads within 2 seconds looks safe. Bug: 62600479 Test: debuggerd_test passes on low-speed devices. Change-Id: I3089415961422e6933405d2c872913273425caff --- debuggerd/client/debuggerd_client_test.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/debuggerd/client/debuggerd_client_test.cpp b/debuggerd/client/debuggerd_client_test.cpp index 8420f038f..9c2f0d632 100644 --- a/debuggerd/client/debuggerd_client_test.cpp +++ b/debuggerd/client/debuggerd_client_test.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -36,8 +37,20 @@ using namespace std::chrono_literals; using android::base::unique_fd; +static int getThreadCount() { + int threadCount = 1024; + std::vector characteristics = + android::base::Split(android::base::GetProperty("ro.build.characteristics", ""), ","); + if (std::find(characteristics.begin(), characteristics.end(), "embedded") + != characteristics.end()) { + // 128 is the realistic number for iot devices. + threadCount = 128; + } + return threadCount; +} + TEST(debuggerd_client, race) { - static constexpr int THREAD_COUNT = 1024; + static int THREAD_COUNT = getThreadCount(); pid_t forkpid = fork(); ASSERT_NE(-1, forkpid);