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

Unified Diff: dm/DMJsonWriter.cpp

Issue 694703005: When running DM, write test failures to json. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use "" instead of NULL Created 6 years, 1 month 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
« no previous file with comments | « dm/DMJsonWriter.h ('k') | dm/DMTestTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMJsonWriter.cpp
diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp
index f86264715bcd65367eb9c1430e798fa33f495a1a..a2de38bb31033ba39d58dbe1f36156870b72260c 100644
--- a/dm/DMJsonWriter.cpp
+++ b/dm/DMJsonWriter.cpp
@@ -24,6 +24,14 @@ void JsonWriter::AddBitmapResult(const BitmapResult& result) {
gBitmapResults.push_back(result);
}
+SkTArray<skiatest::Failure> gFailures;
+SK_DECLARE_STATIC_MUTEX(gFailureLock);
+
+void JsonWriter::AddTestFailure(const skiatest::Failure& failure) {
+ SkAutoMutexAcquire lock(gFailureLock);
+ gFailures.push_back(failure);
+}
+
void JsonWriter::DumpJson() {
if (FLAGS_writePath.isEmpty()) {
return;
@@ -52,6 +60,19 @@ void JsonWriter::DumpJson() {
}
}
+ {
+ SkAutoMutexAcquire lock(gFailureLock);
+ for (int i = 0; i < gFailures.count(); i++) {
+ Json::Value result;
+ result["file_name"] = gFailures[i].fileName;
+ result["line_no"] = gFailures[i].lineNo;
+ result["condition"] = gFailures[i].condition;
+ result["message"] = gFailures[i].message.c_str();
+
+ root["test_results"]["failures"].append(result);
+ }
+ }
+
SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json");
SkFILEWStream stream(path.c_str());
stream.writeText(Json::StyledWriter().write(root).c_str());
« no previous file with comments | « dm/DMJsonWriter.h ('k') | dm/DMTestTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698