summaryrefslogtreecommitdiff
path: root/debuggerd/client/debuggerd_client_test.cpp
diff options
context:
space:
mode:
authorJaesung Chung <jaesung@google.com>2017-06-22 14:12:38 +0900
committerJaesung Chung <jaesung@google.com>2017-06-23 08:59:22 +0900
commitcde2b524f14cf5a382242ca2c6e08cdec492cbf0 (patch)
treeac309231d48f5da47d400f8d9c9d1463baf8b791 /debuggerd/client/debuggerd_client_test.cpp
parent72ca50359e5b0ad4930fbc7e0762285e317e7f85 (diff)
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
Diffstat (limited to 'debuggerd/client/debuggerd_client_test.cpp')
-rw-r--r--debuggerd/client/debuggerd_client_test.cpp15
1 files changed, 14 insertions, 1 deletions
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 <gtest/gtest.h>
#include <android-base/file.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
@@ -36,8 +37,20 @@
using namespace std::chrono_literals;
using android::base::unique_fd;
+static int getThreadCount() {
+ int threadCount = 1024;
+ std::vector<std::string> 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);