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

Unified Diff: base/test/gtest_xml_unittest_result_printer.cc

Issue 2846673004: Set limit for number of failed EXPECTs per test in test launcher output. (Closed)
Patch Set: Created 3 years, 8 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
Index: base/test/gtest_xml_unittest_result_printer.cc
diff --git a/base/test/gtest_xml_unittest_result_printer.cc b/base/test/gtest_xml_unittest_result_printer.cc
index 31ac4ad39c70490f810083f6622021a2a34e1b9f..23d7112f02ee5a1a84cd7786174090f3e9941bd3 100644
--- a/base/test/gtest_xml_unittest_result_printer.cc
+++ b/base/test/gtest_xml_unittest_result_printer.cc
@@ -11,9 +11,14 @@
namespace base {
-XmlUnitTestResultPrinter::XmlUnitTestResultPrinter() : output_file_(NULL) {
+namespace {
+const int kDefaultTestPartResultsLimit = 10;
}
+XmlUnitTestResultPrinter::XmlUnitTestResultPrinter()
+ : output_file_(NULL),
+ test_part_results_limit_(kDefaultTestPartResultsLimit) {}
+
XmlUnitTestResultPrinter::~XmlUnitTestResultPrinter() {
if (output_file_) {
fprintf(output_file_, "</testsuites>\n");
@@ -73,12 +78,18 @@ void XmlUnitTestResultPrinter::OnTestEnd(const testing::TestInfo& test_info) {
fprintf(output_file_,
" <failure message=\"\" type=\"\"></failure>\n");
}
- for (int i = 0; i < test_info.result()->total_part_count(); ++i) {
+
+ int limit = test_info.result()->total_part_count();
+ if (has_test_part_results_limit())
+ limit = std::min(limit, test_part_results_limit());
+
+ for (int i = 0; i < limit; ++i) {
Paweł Hajdan Jr. 2017/05/05 17:33:03 We need to add something in case the limit is exce
alex-ac 2017/05/07 12:07:24 Done.
const auto& test_part_result = test_info.result()->GetTestPartResult(i);
WriteTestPartResult(test_part_result.file_name(),
test_part_result.line_number(), test_part_result.type(),
test_part_result.summary(), test_part_result.message());
}
+
fprintf(output_file_, " </testcase>\n");
fflush(output_file_);
}

Powered by Google App Engine
This is Rietveld 408576698