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

Unified Diff: base/test/gtest_xml_unittest_result_printer.h

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.h
diff --git a/base/test/gtest_xml_unittest_result_printer.h b/base/test/gtest_xml_unittest_result_printer.h
index cce5e88023a045f0de48486ee35de995a980d3df..fee39e82f30bef74a2eb89c69be25ea3e300af7b 100644
--- a/base/test/gtest_xml_unittest_result_printer.h
+++ b/base/test/gtest_xml_unittest_result_printer.h
@@ -22,6 +22,19 @@ class XmlUnitTestResultPrinter : public testing::EmptyTestEventListener {
XmlUnitTestResultPrinter();
~XmlUnitTestResultPrinter() override;
+ // Some tests may contain broken EXPECT with a large message inside a loop
+ // with several thousands iterations and produce huge output (several
+ // gigabytes). Limit number of serialized test result parts to prevent it.
+ // Zero value disables test part results.
+ // Negative value disables limit.
+ void set_test_part_results_limit(int limit) {
Paweł Hajdan Jr. 2017/05/05 17:33:03 Instead of a setter, can we make this class read c
alex-ac 2017/05/07 12:07:24 Done.
+ test_part_results_limit_ = limit;
+ }
+ int test_part_results_limit() const { return test_part_results_limit_; }
+ bool has_test_part_results_limit() const {
+ return test_part_results_limit_ >= 0;
+ }
+
// Must be called before adding as a listener. Returns true on success.
bool Initialize(const FilePath& output_file_path) WARN_UNUSED_RESULT;
@@ -45,6 +58,7 @@ class XmlUnitTestResultPrinter : public testing::EmptyTestEventListener {
const std::string& message);
FILE* output_file_;
+ int test_part_results_limit_;
DISALLOW_COPY_AND_ASSIGN(XmlUnitTestResultPrinter);
};
« no previous file with comments | « no previous file | base/test/gtest_xml_unittest_result_printer.cc » ('j') | base/test/gtest_xml_unittest_result_printer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698