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
This commit is contained in:
mtklein 2014-11-19 13:36:19 -08:00 committed by Commit bot
parent c66d813c18
commit 008f1ea581
2 changed files with 11 additions and 9 deletions

View File

@ -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());
}
}
}

View File

@ -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 {