Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: base/test/launcher/test_launcher.cc

Issue 469533002: Change gtest launcher to run in parallel and retry failures by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: enable parallel jobs by default as well Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/test/test_switches.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index e6c1507250d14eb90ac80b770e75e0060f8f269e..38157f0fa03da3c98b67ac91ef6b4d672bc08f31 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -201,16 +201,6 @@ bool UnsetEnvironmentVariableIfExists(const std::string& name) {
return env->UnSetVar(name.c_str());
}
-// Returns true if bot mode has been requested, i.e. defaults optimized
-// for continuous integration bots. This way developers don't have to remember
-// special command-line flags.
-bool BotModeEnabled() {
- scoped_ptr<Environment> env(Environment::Create());
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kTestLauncherBotMode) ||
- env->HasVar("CHROMIUM_TEST_LAUNCHER_BOT_MODE");
-}
-
void RunCallback(
const TestLauncher::LaunchChildGTestProcessCallback& callback,
int exit_code,
@@ -336,20 +326,6 @@ TestLauncher::TestLauncher(TestLauncherDelegate* launcher_delegate,
this,
&TestLauncher::OnOutputTimeout),
parallel_jobs_(parallel_jobs) {
- if (BotModeEnabled()) {
- fprintf(stdout,
- "Enabling defaults optimized for continuous integration bots.\n");
- fflush(stdout);
-
- // Enable test retries by default for bots. This can be still overridden
- // from command line using --test-launcher-retry-limit flag.
- retry_limit_ = 3;
- } else {
- // Default to serial test execution if not running on a bot. This makes it
- // possible to disable stdio redirection and can still be overridden with
- // --test-launcher-jobs flag.
- parallel_jobs_ = 1;
- }
}
TestLauncher::~TestLauncher() {
@@ -420,7 +396,7 @@ void TestLauncher::LaunchChildGTestProcess(
// When running in parallel mode we need to redirect stdio to avoid mixed-up
// output. We also always redirect on the bots to get the test output into
Paweł Hajdan Jr. 2014/08/13 09:36:37 Please see this comment. It's important behavior:
Dirk Pranke 2014/08/13 16:56:04 Ah, okay. I will restore this and BotModeEnabled()
// JSON summary.
- bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled();
+ bool redirect_stdio = (parallel_jobs_ > 1);
worker_pool_owner_->pool()->PostWorkerTask(
FROM_HERE,
@@ -650,6 +626,9 @@ bool TestLauncher::Init() {
}
retry_limit_ = retry_limit;
+ } else if (!CommandLine::ForCurrentProcess()->HasSwitch(kGTestFilterFlag)) {
+ // Retry failures 3 times by default if we are running all of the tests.
+ retry_limit_ = 3;
}
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -663,7 +642,12 @@ bool TestLauncher::Init() {
}
parallel_jobs_ = jobs;
+ } else if (CommandLine::ForCurrentProcess()->HasSwitch(kGTestFilterFlag)) {
+ // Do not run jobs in parallel by default if we are running a subset of
+ // the tests.
+ parallel_jobs_ = 1;
}
+
fprintf(stdout, "Using %" PRIuS " parallel jobs.\n", parallel_jobs_);
fflush(stdout);
worker_pool_owner_.reset(
« no previous file with comments | « no previous file | base/test/test_switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698