summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorJaesung Chung <jaesung@google.com>2017-06-23 01:59:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-06-23 01:59:28 +0000
commit1dcee842942e0351e825d4967396a0e0e78cc011 (patch)
tree44809766ade42f4ff254afe41caa63721649266b /debuggerd
parent7ff1eb698c0c5660d85bf5a1e737e273c4d4c235 (diff)
parentcde2b524f14cf5a382242ca2c6e08cdec492cbf0 (diff)
downloadcore-1dcee842942e0351e825d4967396a0e0e78cc011.tar.gz
core-1dcee842942e0351e825d4967396a0e0e78cc011.tar.bz2
core-1dcee842942e0351e825d4967396a0e0e78cc011.zip
Merge "crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices"
Diffstat (limited to 'debuggerd')
-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);