Compare commits
3 Commits
marshmallo
...
marshmallo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2010fb6722 | ||
|
|
4f80102935 | ||
|
|
93a91f0cf4 |
@@ -241,7 +241,12 @@ libBionicCtsGtestMain_src_files := gtest_main.cpp
|
|||||||
|
|
||||||
libBionicCtsGtestMain_cflags := $(test_cflags)
|
libBionicCtsGtestMain_cflags := $(test_cflags)
|
||||||
|
|
||||||
libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT
|
libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT \
|
||||||
|
|
||||||
|
# Temporarily fix the job count to 1 for CTS since on some devices the
|
||||||
|
# number of online cores is incorrectly read as the total number of cores
|
||||||
|
# in the system. When b/24376925 is fixed, this should be removed.
|
||||||
|
libBionicCtsGtestMain_cppflags += -DJOB_COUNT_FIXED=1
|
||||||
|
|
||||||
module := libBionicCtsGtestMain
|
module := libBionicCtsGtestMain
|
||||||
module_tag := optional
|
module_tag := optional
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ using testing::internal::COLOR_GREEN;
|
|||||||
using testing::internal::COLOR_YELLOW;
|
using testing::internal::COLOR_YELLOW;
|
||||||
using testing::internal::ColoredPrintf;
|
using testing::internal::ColoredPrintf;
|
||||||
|
|
||||||
constexpr int DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS = 60000;
|
constexpr int DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS = 90000;
|
||||||
constexpr int DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS = 2000;
|
constexpr int DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS = 2000;
|
||||||
|
|
||||||
// The time each test can run before killed for the reason of timeout.
|
// The time each test can run before killed for the reason of timeout.
|
||||||
@@ -839,8 +839,12 @@ static bool RunTestInSeparateProc(int argc, char** argv, std::vector<TestCase>&
|
|||||||
return all_tests_passed;
|
return all_tests_passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t GetProcessorCount() {
|
static size_t GetDefaultJobCount() {
|
||||||
|
#if defined(JOB_COUNT_FIXED)
|
||||||
|
return JOB_COUNT_FIXED;
|
||||||
|
#else
|
||||||
return static_cast<size_t>(sysconf(_SC_NPROCESSORS_ONLN));
|
return static_cast<size_t>(sysconf(_SC_NPROCESSORS_ONLN));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddPathSeparatorInTestProgramPath(std::vector<char*>& args) {
|
static void AddPathSeparatorInTestProgramPath(std::vector<char*>& args) {
|
||||||
@@ -950,7 +954,7 @@ static bool PickOptions(std::vector<char*>& args, IsolationTestOptions& options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init default isolation test options.
|
// Init default isolation test options.
|
||||||
options.job_count = GetProcessorCount();
|
options.job_count = GetDefaultJobCount();
|
||||||
options.test_deadline_ms = DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS;
|
options.test_deadline_ms = DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS;
|
||||||
options.test_warnline_ms = DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS;
|
options.test_warnline_ms = DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS;
|
||||||
options.gtest_color = testing::GTEST_FLAG(color);
|
options.gtest_color = testing::GTEST_FLAG(color);
|
||||||
|
|||||||
7
tests/pthread_test.cpp
Normal file → Executable file
7
tests/pthread_test.cpp
Normal file → Executable file
@@ -1244,8 +1244,11 @@ TEST(pthread, pthread_attr_getstack_18908062) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__BIONIC__)
|
#if defined(__BIONIC__)
|
||||||
|
static pthread_mutex_t gettid_mutex;
|
||||||
static void* pthread_gettid_np_helper(void* arg) {
|
static void* pthread_gettid_np_helper(void* arg) {
|
||||||
|
pthread_mutex_lock(&gettid_mutex);
|
||||||
*reinterpret_cast<pid_t*>(arg) = gettid();
|
*reinterpret_cast<pid_t*>(arg) = gettid();
|
||||||
|
pthread_mutex_unlock(&gettid_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1256,11 +1259,15 @@ TEST(pthread, pthread_gettid_np) {
|
|||||||
|
|
||||||
pid_t t_gettid_result;
|
pid_t t_gettid_result;
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
|
pthread_mutex_init(&gettid_mutex, NULL);
|
||||||
|
pthread_mutex_lock(&gettid_mutex);
|
||||||
pthread_create(&t, NULL, pthread_gettid_np_helper, &t_gettid_result);
|
pthread_create(&t, NULL, pthread_gettid_np_helper, &t_gettid_result);
|
||||||
|
|
||||||
pid_t t_pthread_gettid_np_result = pthread_gettid_np(t);
|
pid_t t_pthread_gettid_np_result = pthread_gettid_np(t);
|
||||||
|
pthread_mutex_unlock(&gettid_mutex);
|
||||||
|
|
||||||
pthread_join(t, NULL);
|
pthread_join(t, NULL);
|
||||||
|
pthread_mutex_destroy(&gettid_mutex);
|
||||||
|
|
||||||
ASSERT_EQ(t_gettid_result, t_pthread_gettid_np_result);
|
ASSERT_EQ(t_gettid_result, t_pthread_gettid_np_result);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user