DM: support non-fatal errors
Tasks that produce a non-fatal error will bail out before writing their output to
disk and hash to dm.json, but not count as failures.
This also makes true failures bail out before writing their results. If the DM
program failed, we probably don't want to triage that image result.
We use this new feature first to skip image subset decoding when we detect it's
not supported. Here's a snippet of an example run, where in this case only
.webp are subset decodable:
...
( 15MB 12) 172µs 8888 subset color_wheel.jpg (skipped: Subset decoding not supported.)
( 15MB 11) 9.05ms 8888 subset randPixels.webp
( 16MB 10) 863µs 8888 subset baby_tux.png (skipped: Subset decoding not supported.)
...
Only outputs corresponding to the .webp show up, both on disk and in the .json.
BUG=skia:
Review URL: https://codereview.chromium.org/980333002
diff --git a/dm/DM.cpp b/dm/DM.cpp
index f9c2ff7..4ab5da9 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -186,7 +186,7 @@
SkDynamicMemoryWStream stream;
SkString log;
Error err = sink->draw(noop, &bitmap, &stream, &log);
- if (!err.isEmpty()) {
+ if (err.isFatal()) {
SkDebugf("Skipping %s: %s\n", tag, err.c_str());
return;
}
@@ -326,11 +326,18 @@
SkDynamicMemoryWStream stream;
Error err = task->sink->draw(*task->src, &bitmap, &stream, &log);
if (!err.isEmpty()) {
- fail(SkStringPrintf("%s %s %s: %s",
- task->sink.tag,
- task->src.tag,
- name.c_str(),
- err.c_str()));
+ timer.end();
+ if (err.isFatal()) {
+ fail(SkStringPrintf("%s %s %s: %s",
+ task->sink.tag,
+ task->src.tag,
+ name.c_str(),
+ err.c_str()));
+ } else {
+ name.appendf(" (skipped: %s)", err.c_str());
+ }
+ done(timer.fWall, task->sink.tag, task->src.tag, name, log);
+ return;
}
SkAutoTDelete<SkStreamAsset> data(stream.detachAsStream());