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

Unified Diff: content/public/test/test_launcher.cc

Issue 1406973006: Make retries in content (and above) test launcher really serial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_launcher.cc
diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc
index 4a2889107d754f20f098268162f7dc9d136a678a..597818dde3bee0fddbad6a82a4b30ca1b47bfc44 100644
--- a/content/public/test/test_launcher.cc
+++ b/content/public/test/test_launcher.cc
@@ -130,8 +130,8 @@ class WrapperTestLauncherDelegate : public base::TestLauncherDelegate {
const std::vector<std::string>& test_names) override;
private:
- void DoRunTest(base::TestLauncher* test_launcher,
- const std::string& test_name);
+ void DoRunTests(base::TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names);
// Launches test named |test_name| using parallel launcher,
// given result of PRE_ test |pre_test_result|.
@@ -142,6 +142,7 @@ class WrapperTestLauncherDelegate : public base::TestLauncherDelegate {
// Callback to receive result of a test.
void GTestCallback(
base::TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names,
const std::string& test_name,
int exit_code,
const base::TimeDelta& elapsed_time,
@@ -254,7 +255,9 @@ size_t WrapperTestLauncherDelegate::RunTests(
while (ContainsKey(reverse_dependent_test_map_, full_name))
full_name = GetPreTestName(full_name);
- DoRunTest(test_launcher, full_name);
+ std::vector<std::string> test_list;
+ test_list.push_back(full_name);
+ DoRunTests(test_launcher, test_list);
}
return test_names.size() + additional_tests_to_run_count;
@@ -316,14 +319,21 @@ size_t WrapperTestLauncherDelegate::RetryTests(
tests_to_run_now.push_back(full_name);
}
- for (size_t i = 0; i < tests_to_run_now.size(); i++)
- DoRunTest(test_launcher, tests_to_run_now[i]);
+ DoRunTests(test_launcher, tests_to_run_now);
return test_names_set.size();
}
-void WrapperTestLauncherDelegate::DoRunTest(base::TestLauncher* test_launcher,
- const std::string& test_name) {
+void WrapperTestLauncherDelegate::DoRunTests(
+ base::TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names) {
+ if (test_names.empty())
+ return;
+
+ std::string test_name(test_names.front());
+ std::vector<std::string> test_names_copy(
+ test_names.begin() + 1, test_names.end());
+
std::string test_name_no_pre(RemoveAnyPrePrefixes(test_name));
base::CommandLine cmd_line(*base::CommandLine::ForCurrentProcess());
@@ -359,6 +369,7 @@ void WrapperTestLauncherDelegate::DoRunTest(base::TestLauncher* test_launcher,
base::Bind(&WrapperTestLauncherDelegate::GTestCallback,
base::Unretained(this),
test_launcher,
+ test_names_copy,
test_name));
}
@@ -368,7 +379,9 @@ void WrapperTestLauncherDelegate::RunDependentTest(
const base::TestResult& pre_test_result) {
if (pre_test_result.status == base::TestResult::TEST_SUCCESS) {
// Only run the dependent test if PRE_ test succeeded.
- DoRunTest(test_launcher, test_name);
+ std::vector<std::string> test_list;
+ test_list.push_back(test_name);
+ DoRunTests(test_launcher, test_list);
} else {
// Otherwise skip the test.
base::TestResult test_result;
@@ -386,6 +399,7 @@ void WrapperTestLauncherDelegate::RunDependentTest(
void WrapperTestLauncherDelegate::GTestCallback(
base::TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names,
const std::string& test_name,
int exit_code,
const base::TimeDelta& elapsed_time,
@@ -422,6 +436,8 @@ void WrapperTestLauncherDelegate::GTestCallback(
}
test_launcher->OnTestFinished(result);
+
+ DoRunTests(test_launcher, test_names);
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698