From 008f1ea5812f6ebe42623c99b5e77dca423a4f1c Mon Sep 17 00:00:00 2001 From: mtklein Date: Wed, 19 Nov 2014 13:36:19 -0800 Subject: [PATCH] Store DM failures in an array, not a single string. This should fix the problem where a repeatedly failing test causes this assertion: ../../src/core/SkString.cpp:572: failed assertion "length >= 0 && length < SkToInt(kBufferSize)" Example output: 0 GMs x 7 configs, 2 tests, 0 pictures 0 tasks left, 100 failed Failures: test RTree: ../../tests/RTreeTest.cpp:77 0 != rtree.getCount() test RTree: ../../tests/RTreeTest.cpp:77 0 != rtree.getCount() test RTree: ../../tests/RTreeTest.cpp:77 0 != rtree.getCount() test RTree: ../../tests/RTreeTest.cpp:77 0 != rtree.getCount() < 95 lines elided > test RTree: ../../tests/RTreeTest.cpp:77 0 != rtree.getCount() 100 failures. BUG=skia: Review URL: https://codereview.chromium.org/741833002 --- dm/DMTestTask.cpp | 10 ++++++++-- dm/DMTestTask.h | 10 +++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dm/DMTestTask.cpp b/dm/DMTestTask.cpp index ad0c3fb4f3..366087c351 100644 --- a/dm/DMTestTask.cpp +++ b/dm/DMTestTask.cpp @@ -35,7 +35,10 @@ void CpuTestTask::draw() { fTest->setReporter(&fTestReporter); fTest->run(); if (!fTest->passed()) { - this->fail(fTestReporter.failure()); + const SkTArray& failures = fTestReporter.failures(); + for (int i = 0; i < failures.count(); i++) { + this->fail(failures[i].c_str()); + } } } @@ -44,7 +47,10 @@ void GpuTestTask::draw(GrContextFactory* grFactory) { fTest->setReporter(&fTestReporter); fTest->run(); if (!fTest->passed()) { - this->fail(fTestReporter.failure()); + const SkTArray& failures = fTestReporter.failures(); + for (int i = 0; i < failures.count(); i++) { + this->fail(failures[i].c_str()); + } } } diff --git a/dm/DMTestTask.h b/dm/DMTestTask.h index 9a47b35f60..2ca31e38b5 100644 --- a/dm/DMTestTask.h +++ b/dm/DMTestTask.h @@ -16,7 +16,7 @@ class TestReporter : public skiatest::Reporter { public: TestReporter() {} - const char* failure() const { return fFailure.c_str(); } + const SkTArray& failures() const { return fFailures; } private: virtual bool allowExtendedTest() const SK_OVERRIDE; @@ -27,14 +27,10 @@ private: SkString newFailure; failure.getFailureString(&newFailure); - // TODO: Better to store an array of failures? - if (!fFailure.isEmpty()) { - fFailure.append("\n\t\t"); - } - fFailure.append(newFailure); + fFailures.push_back(newFailure); } - SkString fFailure; + SkTArray fFailures; }; class CpuTestTask : public CpuTask {