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

Side by Side Diff: base/test/launcher/test_launcher.cc

Issue 46043019: GTTF: Add a flag controlling handling of test stdio by the new launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/test/test_switches.h » ('j') | base/test/test_switches.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/launcher/test_launcher.h" 5 #include "base/test/launcher/test_launcher.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #endif 9 #endif
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 LOG(ERROR) << "Failed to save test launcher output summary."; 262 LOG(ERROR) << "Failed to save test launcher output summary.";
263 } 263 }
264 } 264 }
265 265
266 return run_result_; 266 return run_result_;
267 } 267 }
268 268
269 void TestLauncher::OnTestFinished(const TestResult& result) { 269 void TestLauncher::OnTestFinished(const TestResult& result) {
270 ++test_finished_count_; 270 ++test_finished_count_;
271 271
272 bool print_snippet = false;
273 std::string test_stdio("auto");
274 if (CommandLine::ForCurrentProcess()->HasSwitch(
275 switches::kTestLauncherTestStdio)) {
276 test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
277 switches::kTestLauncherTestStdio);
278 }
279 if (test_stdio == "auto") {
280 print_snippet = (result.status != TestResult::TEST_SUCCESS);
281 } else if (test_stdio == "always") {
282 print_snippet = true;
283 } else if (test_stdio == "never") {
284 print_snippet = false;
285 } else {
286 LOG(WARNING) << "Invalid value of " << switches::kTestLauncherTestStdio
287 << ": " << test_stdio;
288 }
289 if (print_snippet) {
290 fprintf(stdout, "%s", result.output_snippet.c_str());
291 fflush(stdout);
292 }
293
272 if (result.status == TestResult::TEST_SUCCESS) { 294 if (result.status == TestResult::TEST_SUCCESS) {
273 ++test_success_count_; 295 ++test_success_count_;
274 } else { 296 } else {
275 tests_to_retry_.insert(result.full_name); 297 tests_to_retry_.insert(result.full_name);
276
277 fprintf(stdout, "%s", result.output_snippet.c_str());
278 fflush(stdout);
279 } 298 }
280 299
281 results_tracker_.AddTestResult(result); 300 results_tracker_.AddTestResult(result);
282 301
283 // TODO(phajdan.jr): Align counter (padding). 302 // TODO(phajdan.jr): Align counter (padding).
284 std::string status_line( 303 std::string status_line(
285 StringPrintf("[%" PRIuS "/%" PRIuS "] %s ", 304 StringPrintf("[%" PRIuS "/%" PRIuS "] %s ",
286 test_finished_count_, 305 test_finished_count_,
287 test_started_count_, 306 test_started_count_,
288 result.full_name.c_str())); 307 result.full_name.c_str()));
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 668
650 g_live_process_handles.Get().erase(process_handle); 669 g_live_process_handles.Get().erase(process_handle);
651 } 670 }
652 671
653 base::CloseProcessHandle(process_handle); 672 base::CloseProcessHandle(process_handle);
654 673
655 return exit_code; 674 return exit_code;
656 } 675 }
657 676
658 } // namespace base 677 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/test/test_switches.h » ('j') | base/test/test_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698