diff options
author | 2014-11-19 13:36:19 -0800 | |
---|---|---|
committer | 2014-11-19 13:36:19 -0800 | |
commit | 008f1ea5812f6ebe42623c99b5e77dca423a4f1c (patch) | |
tree | dd6d47ced165e45017eae6a076a5f44c4b8f705e /dm | |
parent | c66d813c18fcf8da7f044ade88e5819ac0003632 (diff) |
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
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DMTestTask.cpp | 10 | ||||
-rw-r--r-- | 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<SkString>& 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<SkString>& 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<SkString>& 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<SkString> fFailures; }; class CpuTestTask : public CpuTask { |