summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 23:01:00 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 23:01:00 +0000
commit29033ea9ed6cc32c934d27ceebe77fdfb7735603 (patch)
treea33e8ede9a101530fa6a2015f9278365f4dc3e26
parent28d69d96b2153f7b41cdcd186745135b80e33622 (diff)
downloadchromium_src-29033ea9ed6cc32c934d27ceebe77fdfb7735603.zip
chromium_src-29033ea9ed6cc32c934d27ceebe77fdfb7735603.tar.gz
chromium_src-29033ea9ed6cc32c934d27ceebe77fdfb7735603.tar.bz2
GTTF: Add a flag controlling handling of test stdio by the new launcher.
Pass --test-launcher-test-stdio=always to always include test stdio in test launcher's standard output. BUG=236893 R=hubbe@chromium.org Review URL: https://codereview.chromium.org/46043019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231665 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/test/launcher/test_launcher.cc25
-rw-r--r--base/test/test_switches.cc5
-rw-r--r--base/test/test_switches.h1
3 files changed, 28 insertions, 3 deletions
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 9c06a1a..1b2e79a 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -269,13 +269,32 @@ bool TestLauncher::Run(int argc, char** argv) {
void TestLauncher::OnTestFinished(const TestResult& result) {
++test_finished_count_;
+ bool print_snippet = false;
+ std::string print_test_stdio("auto");
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kTestLauncherPrintTestStdio)) {
+ print_test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kTestLauncherPrintTestStdio);
+ }
+ if (print_test_stdio == "auto") {
+ print_snippet = (result.status != TestResult::TEST_SUCCESS);
+ } else if (print_test_stdio == "always") {
+ print_snippet = true;
+ } else if (print_test_stdio == "never") {
+ print_snippet = false;
+ } else {
+ LOG(WARNING) << "Invalid value of " << switches::kTestLauncherPrintTestStdio
+ << ": " << print_test_stdio;
+ }
+ if (print_snippet) {
+ fprintf(stdout, "%s", result.output_snippet.c_str());
+ fflush(stdout);
+ }
+
if (result.status == TestResult::TEST_SUCCESS) {
++test_success_count_;
} else {
tests_to_retry_.insert(result.full_name);
-
- fprintf(stdout, "%s", result.output_snippet.c_str());
- fflush(stdout);
}
results_tracker_.AddTestResult(result);
diff --git a/base/test/test_switches.cc b/base/test/test_switches.cc
index b02e9f4..18b4881 100644
--- a/base/test/test_switches.cc
+++ b/base/test/test_switches.cc
@@ -21,6 +21,11 @@ const char switches::kTestLauncherOutput[] = "test-launcher-output";
const char switches::kTestLauncherSummaryOutput[] =
"test-launcher-summary-output";
+// Flag controlling when test stdio is displayed as part of the launcher's
+// standard output.
+const char switches::kTestLauncherPrintTestStdio[] =
+ "test-launcher-print-test-stdio";
+
// Time (in milliseconds) that the tests should wait before timing out.
const char switches::kTestLauncherTimeout[] = "test-launcher-timeout";
// TODO(phajdan.jr): Clean up the switch names.
diff --git a/base/test/test_switches.h b/base/test/test_switches.h
index 15c7f9f..330b925 100644
--- a/base/test/test_switches.h
+++ b/base/test/test_switches.h
@@ -14,6 +14,7 @@ extern const char kTestLauncherBatchLimit[];
extern const char kTestLauncherJobs[];
extern const char kTestLauncherOutput[];
extern const char kTestLauncherSummaryOutput[];
+extern const char kTestLauncherPrintTestStdio[];
extern const char kTestLauncherTimeout[];
extern const char kTestTinyTimeout[];
extern const char kUiTestActionTimeout[];