Index: dm/DMJsonWriter.cpp |
diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp |
index f86264715bcd65367eb9c1430e798fa33f495a1a..bc87e68d876b9b28acdd51ad91648a859e6186e7 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,21 @@ void JsonWriter::DumpJson() { |
} |
} |
+ { |
+ const char* test_results = "test_results"; |
scroggo
2014/11/05 20:40:17
This block writes out the test results in the form
mtklein
2014/11/06 15:24:05
It's probably OK to just write "test_results" wher
mtklein
2014/11/06 15:24:05
You're adding this, so you tell us what's a good f
scroggo
2014/11/06 16:52:32
I was being cautious since I used it twice. I've r
|
+ SkAutoMutexAcquire lock(gFailureLock); |
+ root[test_results]["num_failures"] = gFailures.count(); |
mtklein
2014/11/06 15:24:05
Isn't this redundant? It's sort of clear from the
scroggo
2014/11/06 16:52:32
It is redundant, but I thought maybe it's easier t
|
+ for (int i = 0; i < gFailures.count(); i++) { |
+ Json::Value result; |
+ result["file_name"] = gFailures[i].fileName.c_str(); |
+ result["line_no"] = gFailures[i].lineNo; |
+ result["condition"] = gFailures[i].condition.c_str(); |
+ 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()); |