Chromium Code Reviews| Index: gm/gmmain.cpp |
| =================================================================== |
| --- gm/gmmain.cpp (revision 8579) |
| +++ gm/gmmain.cpp (working copy) |
| @@ -298,9 +298,40 @@ |
| } |
| /** |
| + * Display the summary of results with this ErrorType. |
| + * |
| + * @param type which ErrorType |
| + * @param verbose whether to be all verbose about it |
| + */ |
| + void DisplayResultTypeSummary(ErrorType type, bool verbose) { |
| + bool isIgnorableType = fIgnorableErrorCombination.includes(type); |
| + |
| + SkString line; |
| + if (isIgnorableType) { |
| + line.append("[ ] "); |
| + } else { |
| + line.append("[*] "); |
| + } |
| + |
| + SkTArray<SkString> *failedTestsOfThisType = &fFailedTests[type]; |
| + int count = failedTestsOfThisType->count(); |
| + line.appendf("%d %s", count, getErrorTypeName(type)); |
| + if (!isIgnorableType || verbose) { |
|
epoger
2013/04/09 20:19:50
Patchset 2 changes gm's behavior: only write out t
|
| + line.append(":"); |
| + for (int i = 0; i < count; ++i) { |
| + line.append(" "); |
| + line.append((*failedTestsOfThisType)[i]); |
| + } |
| + } |
| + gm_fprintf(stdout, "%s\n", line.c_str()); |
| + } |
| + |
| + /** |
| * List contents of fFailedTests to stdout. |
| + * |
| + * @param verbose whether to be all verbose about it |
| */ |
| - void ListErrors() { |
| + void ListErrors(bool verbose) { |
| // First, print a single summary line. |
| SkString summary; |
| summary.appendf("Ran %d tests:", fTestsRun); |
| @@ -312,22 +343,7 @@ |
| // Now, for each failure type, list the tests that failed that way. |
| for (int typeInt = 0; typeInt <= kLast_ErrorType; typeInt++) { |
| - SkString line; |
| - ErrorType type = static_cast<ErrorType>(typeInt); |
| - if (fIgnorableErrorCombination.includes(type)) { |
| - line.append("[ ] "); |
| - } else { |
| - line.append("[*] "); |
| - } |
| - |
| - SkTArray<SkString> *failedTestsOfThisType = &fFailedTests[type]; |
| - int count = failedTestsOfThisType->count(); |
| - line.appendf("%d %s:", count, getErrorTypeName(type)); |
| - for (int i = 0; i < count; ++i) { |
| - line.append(" "); |
| - line.append((*failedTestsOfThisType)[i]); |
| - } |
| - gm_fprintf(stdout, "%s\n", line.c_str()); |
| + this->DisplayResultTypeSummary(static_cast<ErrorType>(typeInt), verbose); |
| } |
| gm_fprintf(stdout, "(results marked with [*] will cause nonzero return value)\n"); |
| } |
| @@ -1645,15 +1661,6 @@ |
| GrContextFactory* grFactory = NULL; |
| #endif |
| - if (FLAGS_verbose) { |
| - SkString str; |
| - str.printf("%d configs:", configs.count()); |
| - for (int i = 0; i < configs.count(); ++i) { |
| - str.appendf(" %s", gRec[configs[i]].fName); |
| - } |
| - gm_fprintf(stderr, "%s\n", str.c_str()); |
| - } |
| - |
| if (FLAGS_resourcePath.count() == 1) { |
| GM::SetResourcePath(FLAGS_resourcePath[0]); |
| } |
| @@ -1755,12 +1762,14 @@ |
| gmmain.GetRenderModesEncountered(modes); |
| // Output summary to stdout. |
| - gm_fprintf(stdout, "Ran %d GMs\n", gmsRun); |
| - gm_fprintf(stdout, "... over %2d configs [%s]\n", configs.count(), |
| - list_all_config_names(configs).c_str()); |
| - gm_fprintf(stdout, "... and %2d modes [%s]\n", modes.count(), list_all(modes).c_str()); |
| - gm_fprintf(stdout, "... so there should be a total of %d tests.\n", |
| - gmsRun * (configs.count() + modes.count())); |
| + if (FLAGS_verbose) { |
| + gm_fprintf(stdout, "Ran %d GMs\n", gmsRun); |
| + gm_fprintf(stdout, "... over %2d configs [%s]\n", configs.count(), |
| + list_all_config_names(configs).c_str()); |
| + gm_fprintf(stdout, "... and %2d modes [%s]\n", modes.count(), list_all(modes).c_str()); |
| + gm_fprintf(stdout, "... so there should be a total of %d tests.\n", |
| + gmsRun * (configs.count() + modes.count())); |
| + } |
| // TODO(epoger): Ultimately, we should signal an error if the |
| // expected total number of tests (displayed above) does not match |
| @@ -1770,7 +1779,7 @@ |
| // GM). Later on, we should record tests like that using some new |
| // ErrorType, like kIntentionallySkipped_ErrorType. Then we could |
| // signal an error if the totals didn't match up. |
| - gmmain.ListErrors(); |
| + gmmain.ListErrors(FLAGS_verbose); |
| if (FLAGS_writeJsonSummaryPath.count() == 1) { |
| Json::Value actualResults; |