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

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

Issue 886463003: iOS gtest launcher: retry tests in one big batch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: C++11 Created 5 years, 11 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 | « base/test/launcher/unit_test_launcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/unit_test_launcher.cc
diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc
index 1ded4641996db34e3c218cffe1ed74738c0a9f9d..1b3a162c661ac25f419ed477764f5d935b467221 100644
--- a/base/test/launcher/unit_test_launcher.cc
+++ b/base/test/launcher/unit_test_launcher.cc
@@ -121,6 +121,18 @@ class DefaultUnitTestPlatformDelegate : public UnitTestPlatformDelegate {
return std::string();
}
+ void RelaunchTests(TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names,
+ int launch_flags) override {
+ // Relaunch requested tests in parallel, but only use single
+ // test per batch for more precise results (crashes, etc).
+ for (const std::string& test_name : test_names) {
+ std::vector<std::string> batch;
+ batch.push_back(test_name);
+ RunUnitTestsBatch(test_launcher, this, batch, launch_flags);
+ }
+ }
+
DISALLOW_COPY_AND_ASSIGN(DefaultUnitTestPlatformDelegate);
};
@@ -302,24 +314,10 @@ bool ProcessTestResults(
if (!has_non_success_test && exit_code != 0) {
// This is a bit surprising case: all tests are marked as successful,
// but the exit code was not zero. This can happen e.g. under memory
- // tools that report leaks this way.
-
- if (final_results.size() == 1) {
- // Easy case. One test only so we know the non-zero exit code
- // was caused by that one test.
- final_results[0].status = TestResult::TEST_FAILURE_ON_EXIT;
- } else {
- // Harder case. Discard the results and request relaunching all
- // tests without batching. This will trigger above branch on
- // relaunch leading to more precise results.
- LOG(WARNING) << "Not sure which test caused non-zero exit code, "
- << "relaunching all of them without batching.";
-
- for (size_t i = 0; i < final_results.size(); i++)
- tests_to_relaunch->push_back(final_results[i].full_name);
-
- return false;
- }
+ // tools that report leaks this way. Mark all tests as a failure on exit,
+ // and for more precise info they'd need to be retried serially.
+ for (size_t i = 0; i < final_results.size(); i++)
+ final_results[i].status = TestResult::TEST_FAILURE_ON_EXIT;
}
for (size_t i = 0; i < final_results.size(); i++) {
@@ -373,16 +371,11 @@ void GTestCallback(
callback_state.output_file, output, exit_code, was_timeout,
&tests_to_relaunch);
- // Relaunch requested tests in parallel, but only use single
- // test per batch for more precise results (crashes, test passes
- // but non-zero exit codes etc).
- for (size_t i = 0; i < tests_to_relaunch.size(); i++) {
- std::vector<std::string> batch;
- batch.push_back(tests_to_relaunch[i]);
- RunUnitTestsBatch(callback_state.test_launcher,
- callback_state.platform_delegate,
- batch,
- callback_state.launch_flags);
+ if (!tests_to_relaunch.empty()) {
+ callback_state.platform_delegate->RelaunchTests(
+ callback_state.test_launcher,
+ tests_to_relaunch,
+ callback_state.launch_flags);
}
// The temporary file's directory is also temporary.
« no previous file with comments | « base/test/launcher/unit_test_launcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698