am b48ca46d: Merge "Force cts to only run one test at a time."

* commit 'b48ca46d88d9e664763eff39604f772a57d8e2fb':
  Force cts to only run one test at a time.
This commit is contained in:
Christopher Ferris 2015-09-25 22:11:46 +00:00 committed by Android Git Automerger
commit c1d4ba88cf
2 changed files with 13 additions and 4 deletions

View file

@ -253,7 +253,12 @@ libBionicCtsGtestMain_src_files := gtest_main.cpp
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_tag := optional

View file

@ -69,7 +69,7 @@ using testing::internal::COLOR_GREEN;
using testing::internal::COLOR_YELLOW;
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;
// The time each test can run before killed for the reason of timeout.
@ -877,8 +877,12 @@ static bool RunTestInSeparateProc(int argc, char** argv, std::vector<TestCase>&
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));
#endif
}
static void AddPathSeparatorInTestProgramPath(std::vector<char*>& args) {
@ -988,7 +992,7 @@ static bool PickOptions(std::vector<char*>& args, IsolationTestOptions& 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_warnline_ms = DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS;
options.gtest_color = testing::GTEST_FLAG(color);