| Index: gm/gm_expectations.cpp
|
| diff --git a/gm/gm_expectations.cpp b/gm/gm_expectations.cpp
|
| index c7bab920442605a2b8593b7405ed6863b421d6b8..f46a572458f4439a950c5e0d7af6cf6df87b1708 100644
|
| --- a/gm/gm_expectations.cpp
|
| +++ b/gm/gm_expectations.cpp
|
| @@ -27,18 +27,6 @@ const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5";
|
|
|
|
|
| namespace skiagm {
|
| - void gm_fprintf(FILE *stream, const char format[], ...) {
|
| - va_list args;
|
| - va_start(args, format);
|
| - fprintf(stream, "GM: ");
|
| - vfprintf(stream, format, args);
|
| -#ifdef SK_BUILD_FOR_WIN
|
| - if (stderr == stream || stdout == stream) {
|
| - fflush(stream);
|
| - }
|
| -#endif
|
| - va_end(args);
|
| - }
|
|
|
| Json::Value CreateJsonTree(Json::Value expectedResults,
|
| Json::Value actualResultsFailed,
|
| @@ -66,21 +54,20 @@ namespace skiagm {
|
| GmResultDigest::GmResultDigest(const Json::Value &jsonTypeValuePair) {
|
| fIsValid = false;
|
| if (!jsonTypeValuePair.isArray()) {
|
| - gm_fprintf(stderr, "found non-array json value when parsing GmResultDigest: %s\n",
|
| - jsonTypeValuePair.toStyledString().c_str());
|
| + SkDebugf("found non-array json value when parsing GmResultDigest: %s\n",
|
| + jsonTypeValuePair.toStyledString().c_str());
|
| DEBUGFAIL_SEE_STDERR;
|
| } else if (2 != jsonTypeValuePair.size()) {
|
| - gm_fprintf(stderr, "found json array with wrong size when parsing GmResultDigest: %s\n",
|
| - jsonTypeValuePair.toStyledString().c_str());
|
| + SkDebugf("found json array with wrong size when parsing GmResultDigest: %s\n",
|
| + jsonTypeValuePair.toStyledString().c_str());
|
| DEBUGFAIL_SEE_STDERR;
|
| } else {
|
| // TODO(epoger): The current implementation assumes that the
|
| // result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
|
| Json::Value jsonHashValue = jsonTypeValuePair[1];
|
| if (!jsonHashValue.isIntegral()) {
|
| - gm_fprintf(stderr,
|
| - "found non-integer jsonHashValue when parsing GmResultDigest: %s\n",
|
| - jsonTypeValuePair.toStyledString().c_str());
|
| + SkDebugf("found non-integer jsonHashValue when parsing GmResultDigest: %s\n",
|
| + jsonTypeValuePair.toStyledString().c_str());
|
| DEBUGFAIL_SEE_STDERR;
|
| } else {
|
| fHashDigest = jsonHashValue.asUInt64();
|
| @@ -153,10 +140,9 @@ namespace skiagm {
|
| if (ignoreFailure.isNull()) {
|
| fIgnoreFailure = kDefaultIgnoreFailure;
|
| } else if (!ignoreFailure.isBool()) {
|
| - gm_fprintf(stderr, "found non-boolean json value"
|
| - " for key '%s' in element '%s'\n",
|
| - kJsonKey_ExpectedResults_IgnoreFailure,
|
| - jsonElement.toStyledString().c_str());
|
| + SkDebugf("found non-boolean json value for key '%s' in element '%s'\n",
|
| + kJsonKey_ExpectedResults_IgnoreFailure,
|
| + jsonElement.toStyledString().c_str());
|
| DEBUGFAIL_SEE_STDERR;
|
| fIgnoreFailure = kDefaultIgnoreFailure;
|
| } else {
|
| @@ -167,10 +153,9 @@ namespace skiagm {
|
| if (allowedDigests.isNull()) {
|
| // ok, we'll just assume there aren't any AllowedDigests to compare against
|
| } else if (!allowedDigests.isArray()) {
|
| - gm_fprintf(stderr, "found non-array json value"
|
| - " for key '%s' in element '%s'\n",
|
| - kJsonKey_ExpectedResults_AllowedDigests,
|
| - jsonElement.toStyledString().c_str());
|
| + SkDebugf("found non-array json value for key '%s' in element '%s'\n",
|
| + kJsonKey_ExpectedResults_AllowedDigests,
|
| + jsonElement.toStyledString().c_str());
|
| DEBUGFAIL_SEE_STDERR;
|
| } else {
|
| for (Json::ArrayIndex i=0; i<allowedDigests.size(); i++) {
|
| @@ -255,14 +240,14 @@ namespace skiagm {
|
| /*static*/ bool JsonExpectationsSource::Parse(const char *jsonPath, Json::Value *jsonRoot) {
|
| SkFILEStream inFile(jsonPath);
|
| if (!inFile.isValid()) {
|
| - gm_fprintf(stderr, "unable to read JSON file %s\n", jsonPath);
|
| + SkDebugf("unable to read JSON file %s\n", jsonPath);
|
| DEBUGFAIL_SEE_STDERR;
|
| return false;
|
| }
|
|
|
| SkAutoDataUnref dataRef(ReadFileIntoSkData(inFile));
|
| if (NULL == dataRef.get()) {
|
| - gm_fprintf(stderr, "error reading JSON file %s\n", jsonPath);
|
| + SkDebugf("error reading JSON file %s\n", jsonPath);
|
| DEBUGFAIL_SEE_STDERR;
|
| return false;
|
| }
|
| @@ -271,7 +256,7 @@ namespace skiagm {
|
| size_t size = dataRef.get()->size();
|
| Json::Reader reader;
|
| if (!reader.parse(bytes, bytes+size, *jsonRoot)) {
|
| - gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath);
|
| + SkDebugf("error parsing JSON file %s\n", jsonPath);
|
| DEBUGFAIL_SEE_STDERR;
|
| return false;
|
| }
|
|
|