Index: base/test/launcher/test_launcher.cc |
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc |
index e6880fa54f5f462acb4c3050e78b2f3f143a8885..fae0307287adc6e9369b1bf7e1d8b3e07072b683 100644 |
--- a/base/test/launcher/test_launcher.cc |
+++ b/base/test/launcher/test_launcher.cc |
@@ -90,6 +90,10 @@ const int kOutputTimeoutSeconds = 15; |
// the infrastructure. |
const size_t kOutputSnippetLinesLimit = 5000; |
+// Limit of output snippet size. Exceeding this limit |
+// results in truncating the output and failing the test. |
+const size_t kOutputSnippetBytesLimit = 10 * 1024 * 1024; |
+ |
// 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 |
@@ -568,9 +572,17 @@ void TestLauncher::LaunchChildGTestProcess( |
launched_callback)); |
} |
-void TestLauncher::OnTestFinished(const TestResult& result) { |
+void TestLauncher::OnTestFinished(const TestResult& original_result) { |
++test_finished_count_; |
+ TestResult result(original_result); |
+ |
+ if (result.output_snippet.length() > kOutputSnippetBytesLimit) { |
+ if (result.status == TestResult::TEST_SUCCESS) |
+ result.status = TestResult::TEST_EXCESSIVE_OUTPUT; |
+ result.output_snippet = "<truncated>\n"; |
Dirk Pranke
2016/10/12 23:33:27
Maybe this should include at least some of the sni
Paweł Hajdan Jr.
2016/10/13 14:55:59
Done.
|
+ } |
+ |
bool print_snippet = false; |
std::string print_test_stdio("auto"); |
if (CommandLine::ForCurrentProcess()->HasSwitch( |