Merge "crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices" am: 1dcee84294
am: 2dae23b0a7
Change-Id: I718e11efa5bf29b760647298dcca468248c4d7cb
This commit is contained in:
commit
87c76bea38
1 changed files with 14 additions and 1 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
|
#include <android-base/properties.h>
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <android-base/unique_fd.h>
|
#include <android-base/unique_fd.h>
|
||||||
|
|
@ -36,8 +37,20 @@
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using android::base::unique_fd;
|
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) {
|
TEST(debuggerd_client, race) {
|
||||||
static constexpr int THREAD_COUNT = 1024;
|
static int THREAD_COUNT = getThreadCount();
|
||||||
pid_t forkpid = fork();
|
pid_t forkpid = fork();
|
||||||
|
|
||||||
ASSERT_NE(-1, forkpid);
|
ASSERT_NE(-1, forkpid);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue