diff options
author | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-13 14:18:40 +0000 |
---|---|---|
committer | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-13 14:18:40 +0000 |
commit | 5efdd0cb9cdf4c2017dc6ad70b2503bf04234d9b (patch) | |
tree | 87c0e8196b0b8453fdde805b791b27ee3ab0a10b /gm/gm_expectations.h | |
parent | 530efc808544e9ff79814f61678bd919b168cb21 (diff) |
gm: write all messages to stdout/stderr with "GM:" preamble to distinguish from various debug messages coming from elsewhere
Review URL: https://codereview.chromium.org/12691009
git-svn-id: http://skia.googlecode.com/svn/trunk@8126 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/gm_expectations.h')
-rw-r--r-- | gm/gm_expectations.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h index acff9d478b..2efdd4b043 100644 --- a/gm/gm_expectations.h +++ b/gm/gm_expectations.h @@ -7,6 +7,7 @@ #ifndef gm_expectations_DEFINED #define gm_expectations_DEFINED +#include <stdarg.h> #include "gm.h" #include "SkBitmap.h" #include "SkBitmapChecksummer.h" @@ -53,6 +54,14 @@ namespace skiagm { return jsonValue.asUInt64(); } + static void gm_fprintf(FILE *stream, const char format[], ...) { + va_list args; + va_start(args, format); + fprintf(stream, "GM: "); + vfprintf(stream, format, args); + va_end(args); + } + static SkString make_filename(const char path[], const char renderModeDescriptor[], const char *name, @@ -103,9 +112,10 @@ namespace skiagm { if (ignoreFailure.isNull()) { fIgnoreFailure = kDefaultIgnoreFailure; } else if (!ignoreFailure.isBool()) { - fprintf(stderr, "found non-boolean json value for key '%s' in element '%s'\n", - kJsonKey_ExpectedResults_IgnoreFailure, - jsonElement.toStyledString().c_str()); + gm_fprintf(stderr, "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 { @@ -116,16 +126,18 @@ namespace skiagm { if (allowedChecksums.isNull()) { // ok, we'll just assume there aren't any expected checksums to compare against } else if (!allowedChecksums.isArray()) { - fprintf(stderr, "found non-array json value for key '%s' in element '%s'\n", - kJsonKey_ExpectedResults_Checksums, - jsonElement.toStyledString().c_str()); + gm_fprintf(stderr, "found non-array json value" + " for key '%s' in element '%s'\n", + kJsonKey_ExpectedResults_Checksums, + jsonElement.toStyledString().c_str()); DEBUGFAIL_SEE_STDERR; } else { for (Json::ArrayIndex i=0; i<allowedChecksums.size(); i++) { Json::Value checksumElement = allowedChecksums[i]; if (!checksumElement.isIntegral()) { - fprintf(stderr, "found non-integer checksum in json element '%s'\n", - jsonElement.toStyledString().c_str()); + gm_fprintf(stderr, "found non-integer checksum" + " in json element '%s'\n", + jsonElement.toStyledString().c_str()); DEBUGFAIL_SEE_STDERR; } else { fAllowedChecksums.push_back() = asChecksum(checksumElement); @@ -233,7 +245,7 @@ namespace skiagm { return Expectations(referenceBitmap); } else { if (fNotifyOfMissingFiles) { - fprintf(stderr, "FAILED to read %s\n", path.c_str()); + gm_fprintf(stderr, "FAILED to read %s\n", path.c_str()); } return Expectations(); } @@ -331,14 +343,14 @@ namespace skiagm { static bool parse(const char *jsonPath, Json::Value *jsonRoot) { SkFILEStream inFile(jsonPath); if (!inFile.isValid()) { - fprintf(stderr, "unable to read JSON file %s\n", jsonPath); + gm_fprintf(stderr, "unable to read JSON file %s\n", jsonPath); DEBUGFAIL_SEE_STDERR; return false; } SkAutoDataUnref dataRef(readFileIntoSkData(inFile)); if (NULL == dataRef.get()) { - fprintf(stderr, "error reading JSON file %s\n", jsonPath); + gm_fprintf(stderr, "error reading JSON file %s\n", jsonPath); DEBUGFAIL_SEE_STDERR; return false; } @@ -347,7 +359,7 @@ namespace skiagm { size_t size = dataRef.get()->size(); Json::Reader reader; if (!reader.parse(bytes, bytes+size, *jsonRoot)) { - fprintf(stderr, "error parsing JSON file %s\n", jsonPath); + gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); DEBUGFAIL_SEE_STDERR; return false; } |