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

Unified Diff: tools/skimage_main.cpp

Issue 22301006: Do not fail skimage on missing expectations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skimage_main.cpp
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index ef5c133fc6ba55e8b1003efb5faa261e622cebc8..ad3f2048dc5a6f6efcd131d3b8cef456aeff6d97 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -97,6 +97,10 @@ static SkTArray<SkString, false> gEncodeFailures;
static SkTArray<SkString, false> gSuccessfulDecodes;
static SkTArray<SkString, false> gSuccessfulSubsetDecodes;
static SkTArray<SkString, false> gFailedSubsetDecodes;
+// Files/subsets that do not have expectations. Not reported as a failure of the test so
+// the bots will not turn red with each new image test.
+static SkTArray<SkString, false> gMissingExpectations;
+static SkTArray<SkString, false> gMissingSubsetExpectations;
// Expections read from a file specified by readExpectationsPath. The expectations must have been
// previously written using createExpectationsPath.
@@ -179,6 +183,8 @@ static bool expect_to_fail(const char* filename) {
* Compare against an expectation for this filename, if there is one.
* @param bitmap SkBitmap to compare to the expected value.
* @param filename String used to find the expected value.
+ * @param failureArray Array to add a failure message to on failure.
+ * @param missingArray Array to add missing expectation to on failure.
* @return bool True in any of these cases:
* - the bitmap matches the expectation.
* False in any of these cases:
@@ -188,7 +194,8 @@ static bool expect_to_fail(const char* filename) {
* - expectation could not be computed from the bitmap.
*/
static bool compare_to_expectations_if_necessary(const SkBitmap& bitmap, const char* filename,
- SkTArray<SkString, false>* failureArray) {
+ SkTArray<SkString, false>* failureArray,
+ SkTArray<SkString, false>* missingArray) {
skiagm::GmResultDigest resultDigest(bitmap);
if (!resultDigest.isValid()) {
if (failureArray != NULL) {
@@ -204,8 +211,8 @@ static bool compare_to_expectations_if_necessary(const SkBitmap& bitmap, const c
skiagm::Expectations jsExpectation = gJsonExpectations->get(filename);
if (jsExpectation.empty()) {
- if (failureArray != NULL) {
- failureArray->push_back().printf("decoded %s, but could not find expectation.",
+ if (missingArray != NULL) {
+ missingArray->push_back().printf("decoded %s, but could not find expectation.",
filename);
}
return false;
@@ -343,7 +350,9 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
}
}
- if (compare_to_expectations_if_necessary(bitmap, filename, &gDecodeFailures)) {
+ if (compare_to_expectations_if_necessary(bitmap, filename,
+ &gDecodeFailures,
+ &gMissingExpectations)) {
gSuccessfulDecodes.push_back().printf("%s [%d %d]", srcPath, bitmap.width(),
bitmap.height());
} else if (!FLAGS_mismatchPath.isEmpty()) {
@@ -388,7 +397,8 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
SkString subsetName = SkStringPrintf("%s_%s", filename, subsetDim.c_str());
if (compare_to_expectations_if_necessary(bitmapFromDecodeSubset,
subsetName.c_str(),
- &gFailedSubsetDecodes)) {
+ &gFailedSubsetDecodes,
+ &gMissingSubsetExpectations)) {
gSuccessfulSubsetDecodes.push_back().printf("Decoded subset %s from %s",
subsetDim.c_str(), srcPath);
} else if (!FLAGS_mismatchPath.isEmpty()) {
@@ -589,10 +599,12 @@ int tool_main(int argc, char** argv) {
failed |= print_strings("Failed to decode", gDecodeFailures);
failed |= print_strings("Failed to encode", gEncodeFailures);
print_strings("Decoded", gSuccessfulDecodes);
+ print_strings("Missing expectations", gMissingExpectations);
if (FLAGS_testSubsetDecoding) {
failed |= print_strings("Failed subset decodes", gFailedSubsetDecodes);
print_strings("Decoded subsets", gSuccessfulSubsetDecodes);
+ print_strings("Missing subset expectations", gMissingSubsetExpectations);
}
return failed ? -1 : 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698