diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 10:29:11 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 10:29:11 +0000 |
commit | 5ee73cfe193770172cf78239f0ddbf8e3ea7bcf9 (patch) | |
tree | a07532dc70db6ce2e1aed146016b4f8eb8cfc185 /base/test | |
parent | dfcbd5a7b9210282d543cf32569b796c4f6fac00 (diff) | |
download | chromium_src-5ee73cfe193770172cf78239f0ddbf8e3ea7bcf9.zip chromium_src-5ee73cfe193770172cf78239f0ddbf8e3ea7bcf9.tar.gz chromium_src-5ee73cfe193770172cf78239f0ddbf8e3ea7bcf9.tar.bz2 |
Truncate huge output snippets in the test launcher before printing them
This avoids flooding the logs with lots of data that gums up
the infrastructure.
The summary contains the full snippet for debugging.
BUG=382648
R=sky@chromium.org
Review URL: https://codereview.chromium.org/324893004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/test')
-rw-r--r-- | base/test/launcher/test_launcher.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc index 8d62afa..d50bf0e 100644 --- a/base/test/launcher/test_launcher.cc +++ b/base/test/launcher/test_launcher.cc @@ -76,6 +76,11 @@ const char kUnreliableResultsTag[] = "UNRELIABLE_RESULTS"; // debugging in case the process hangs anyway. const int kOutputTimeoutSeconds = 15; +// Limit of output snippet lines when printing to stdout. +// Avoids flooding the logs with amount of output that gums up +// the infrastructure. +const size_t kOutputSnippetLinesLimit = 50; + // Set of live launch test processes with corresponding lock (it is allowed // for callers to launch processes on different threads). LazyInstance<std::map<ProcessHandle, CommandLine> > g_live_processes @@ -451,7 +456,16 @@ void TestLauncher::OnTestFinished(const TestResult& result) { << ": " << print_test_stdio; } if (print_snippet) { - fprintf(stdout, "%s", result.output_snippet.c_str()); + std::vector<std::string> snippet_lines; + SplitString(result.output_snippet, '\n', &snippet_lines); + if (snippet_lines.size() > kOutputSnippetLinesLimit) { + size_t truncated_size = snippet_lines.size() - kOutputSnippetLinesLimit; + snippet_lines.erase( + snippet_lines.begin(), + snippet_lines.begin() + truncated_size); + snippet_lines.insert(snippet_lines.begin(), "<truncated>"); + } + fprintf(stdout, "%s", JoinString(snippet_lines, "\n").c_str()); fflush(stdout); } |