GM: now that we use MD5 instead of CityHash, the JSON should say so
authorepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 7 May 2013 15:51:54 +0000 (15:51 +0000)
committerepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 7 May 2013 15:51:54 +0000 (15:51 +0000)
(this should have been part of https://code.google.com/p/skia/source/detail?r=8992 )

R=bungeman@google.com

Review URL: https://codereview.chromium.org/14758003

git-svn-id: http://skia.googlecode.com/svn/trunk@9038 2bbb7eff-a529-9590-31e7-b0007b416f81

14 files changed:
gm/gm_expectations.cpp
gm/gm_expectations.h
gm/tests/outputs/compared-against-different-pixels-images/output-expected/json-summary.txt
gm/tests/outputs/compared-against-different-pixels-json/output-expected/json-summary.txt
gm/tests/outputs/compared-against-empty-dir/output-expected/json-summary.txt
gm/tests/outputs/compared-against-identical-bytes-images/output-expected/json-summary.txt
gm/tests/outputs/compared-against-identical-bytes-json/output-expected/json-summary.txt
gm/tests/outputs/compared-against-identical-pixels-images/output-expected/json-summary.txt
gm/tests/outputs/compared-against-identical-pixels-json/output-expected/json-summary.txt
gm/tests/outputs/ignore-expectations-mismatch/output-expected/json-summary.txt
gm/tests/outputs/intentionally-skipped-tests/output-expected/json-summary.txt
gm/tests/outputs/no-readpath/output-expected/json-summary.txt
gm/tests/outputs/nonverbose/output-expected/json-summary.txt
gm/tests/outputs/pipe-playback-failure/output-expected/json-summary.txt

index 1aa1ef4..16e655e 100644 (file)
@@ -16,20 +16,28 @@ const static char kJsonKey_ActualResults_Failed[]        = "failed";
 const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored";
 const static char kJsonKey_ActualResults_NoComparison[]  = "no-comparison";
 const static char kJsonKey_ActualResults_Succeeded[]     = "succeeded";
-const static char kJsonKey_ActualResults_AnyStatus_BitmapCityhash[]  = "bitmap-cityhash";
+#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
+const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[]  = "bitmap-64bitMD5";
+#else
+const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[]  = "bitmap-cityhash";
+#endif
 
 const static char kJsonKey_ExpectedResults[] = "expected-results";
-const static char kJsonKey_ExpectedResults_AllowedBitmapCityhashes[] = "allowed-bitmap-cityhashes";
+#ifdef BITMAPHASHER_USES_TRUNCATED_MD5
+const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-64bitMD5s";
+#else
+const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitmap-cityhashes";
+#endif
 const static char kJsonKey_ExpectedResults_IgnoreFailure[]           = "ignore-failure";
 
 namespace skiagm {
 
     // TODO(epoger): This currently assumes that the result SkHashDigest was
-    // generated as a CityHash of an SkBitmap.  We'll need to allow for other
-    // hash types to cover non-bitmaps, MD5 instead of CityHash, etc.
+    // generated as an SkHashDigest of an SkBitmap.  We'll need to allow for other
+    // hash types to cover non-bitmaps.
     Json::Value ActualResultAsJsonValue(const SkHashDigest& result) {
         Json::Value jsonValue;
-        jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapCityhash] = asJsonValue(result);
+        jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(result);
         return jsonValue;
     }
 
@@ -65,7 +73,7 @@ namespace skiagm {
         if (!SkBitmapHasher::ComputeDigest(bitmap, &digest)) {
             digest = 0;
         }
-        fAllowedBitmapCityhashes.push_back() = digest;
+        fAllowedBitmapChecksums.push_back() = digest;
     }
 
     Expectations::Expectations(Json::Value jsonElement) {
@@ -87,13 +95,13 @@ namespace skiagm {
             }
 
             Json::Value allowedChecksums =
-                jsonElement[kJsonKey_ExpectedResults_AllowedBitmapCityhashes];
+                jsonElement[kJsonKey_ExpectedResults_AllowedBitmapHashes];
             if (allowedChecksums.isNull()) {
                 // ok, we'll just assume there aren't any expected checksums to compare against
             } else if (!allowedChecksums.isArray()) {
                 gm_fprintf(stderr, "found non-array json value"
                            " for key '%s' in element '%s'\n",
-                           kJsonKey_ExpectedResults_AllowedBitmapCityhashes,
+                           kJsonKey_ExpectedResults_AllowedBitmapHashes,
                            jsonElement.toStyledString().c_str());
                 DEBUGFAIL_SEE_STDERR;
             } else {
@@ -105,7 +113,7 @@ namespace skiagm {
                                    jsonElement.toStyledString().c_str());
                         DEBUGFAIL_SEE_STDERR;
                     } else {
-                        fAllowedBitmapCityhashes.push_back() = asChecksum(checksumElement);
+                        fAllowedBitmapChecksums.push_back() = asChecksum(checksumElement);
                     }
                 }
             }
@@ -113,8 +121,8 @@ namespace skiagm {
     }
 
     bool Expectations::match(Checksum actualChecksum) const {
-        for (int i=0; i < this->fAllowedBitmapCityhashes.count(); i++) {
-            Checksum allowedChecksum = this->fAllowedBitmapCityhashes[i];
+        for (int i=0; i < this->fAllowedBitmapChecksums.count(); i++) {
+            Checksum allowedChecksum = this->fAllowedBitmapChecksums[i];
             if (allowedChecksum == actualChecksum) {
                 return true;
             }
@@ -124,15 +132,15 @@ namespace skiagm {
 
     Json::Value Expectations::asJsonValue() const {
         Json::Value allowedChecksumArray;
-        if (!this->fAllowedBitmapCityhashes.empty()) {
-            for (int i=0; i < this->fAllowedBitmapCityhashes.count(); i++) {
-                Checksum allowedChecksum = this->fAllowedBitmapCityhashes[i];
+        if (!this->fAllowedBitmapChecksums.empty()) {
+            for (int i=0; i < this->fAllowedBitmapChecksums.count(); i++) {
+                Checksum allowedChecksum = this->fAllowedBitmapChecksums[i];
                 allowedChecksumArray.append(Json::UInt64(allowedChecksum));
             }
         }
 
         Json::Value jsonValue;
-        jsonValue[kJsonKey_ExpectedResults_AllowedBitmapCityhashes] = allowedChecksumArray;
+        jsonValue[kJsonKey_ExpectedResults_AllowedBitmapHashes] = allowedChecksumArray;
         jsonValue[kJsonKey_ExpectedResults_IgnoreFailure] = this->ignoreFailure();
         return jsonValue;
     }
index df99c6e..2506a98 100644 (file)
@@ -101,7 +101,7 @@ namespace skiagm {
         /**
          * Returns true iff there are no allowed checksums.
          */
-        bool empty() const { return this->fAllowedBitmapCityhashes.empty(); }
+        bool empty() const { return this->fAllowedBitmapChecksums.empty(); }
 
         /**
          * Returns true iff actualChecksum matches any allowedChecksum,
@@ -128,7 +128,7 @@ namespace skiagm {
     private:
         const static bool kDefaultIgnoreFailure = false;
 
-        SkTArray<Checksum> fAllowedBitmapCityhashes;
+        SkTArray<Checksum> fAllowedBitmapChecksums;
         bool fIgnoreFailure;
         SkBitmap fBitmap;
     };
index b8d43a3..1bc40b7 100644 (file)
@@ -2,10 +2,10 @@
    "actual-results" : {
       "failed" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "failure-ignored" : null,
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+         "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+         "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
          "ignore-failure" : false
       }
    }
index b8d43a3..1bc40b7 100644 (file)
@@ -2,10 +2,10 @@
    "actual-results" : {
       "failed" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "failure-ignored" : null,
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+         "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+         "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
          "ignore-failure" : false
       }
    }
index e55c38c..c5edc8a 100644 (file)
@@ -4,21 +4,21 @@
       "failure-ignored" : null,
       "no-comparison" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "succeeded" : null
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : null,
+         "allowed-bitmap-64bitMD5s" : null,
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : null,
+         "allowed-bitmap-64bitMD5s" : null,
          "ignore-failure" : false
       }
    }
index e050124..52256f4 100644 (file)
@@ -5,20 +5,20 @@
       "no-comparison" : null,
       "succeeded" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       }
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+         "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       }
    }
index e050124..52256f4 100644 (file)
@@ -5,20 +5,20 @@
       "no-comparison" : null,
       "succeeded" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       }
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+         "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       }
    }
index e050124..52256f4 100644 (file)
@@ -5,20 +5,20 @@
       "no-comparison" : null,
       "succeeded" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       }
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+         "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       }
    }
index e050124..52256f4 100644 (file)
@@ -5,20 +5,20 @@
       "no-comparison" : null,
       "succeeded" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       }
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+         "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       }
    }
index b8d43a3..1bc40b7 100644 (file)
@@ -2,10 +2,10 @@
    "actual-results" : {
       "failed" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "failure-ignored" : null,
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 8863920166200910451 ],
+         "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 13451349865803053525 ],
+         "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ],
          "ignore-failure" : false
       }
    }
index 3d3e1e4..8865b0c 100644 (file)
@@ -4,16 +4,16 @@
       "failure-ignored" : null,
       "no-comparison" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "565/selftest2" : {
-            "bitmap-cityhash" : 8863920166200910451
+            "bitmap-64bitMD5" : 8863920166200910451
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          },
          "8888/selftest2" : {
-            "bitmap-cityhash" : 13451349865803053525
+            "bitmap-64bitMD5" : 13451349865803053525
          }
       },
       "succeeded" : null
index 5140616..1009e92 100644 (file)
@@ -4,10 +4,10 @@
       "failure-ignored" : null,
       "no-comparison" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "succeeded" : null
index e55c38c..c5edc8a 100644 (file)
@@ -4,21 +4,21 @@
       "failure-ignored" : null,
       "no-comparison" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       },
       "succeeded" : null
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : null,
+         "allowed-bitmap-64bitMD5s" : null,
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : null,
+         "allowed-bitmap-64bitMD5s" : null,
          "ignore-failure" : false
       }
    }
index 506191d..5c12f9e 100644 (file)
@@ -2,31 +2,31 @@
    "actual-results" : {
       "failed" : {
          "comparison/selftest1-pipe" : {
-            "bitmap-cityhash" : 6140979239232854774
+            "bitmap-64bitMD5" : 6140979239232854774
          }
       },
       "failure-ignored" : null,
       "no-comparison" : null,
       "succeeded" : {
          "565/selftest1" : {
-            "bitmap-cityhash" : 12927999507540085554
+            "bitmap-64bitMD5" : 12927999507540085554
          },
          "8888/selftest1" : {
-            "bitmap-cityhash" : 1209453360120438698
+            "bitmap-64bitMD5" : 1209453360120438698
          }
       }
    },
    "expected-results" : {
       "565/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 12927999507540085554 ],
+         "allowed-bitmap-64bitMD5s" : [ 12927999507540085554 ],
          "ignore-failure" : false
       },
       "8888/selftest1" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       },
       "comparison/selftest1-pipe" : {
-         "allowed-bitmap-cityhashes" : [ 1209453360120438698 ],
+         "allowed-bitmap-64bitMD5s" : [ 1209453360120438698 ],
          "ignore-failure" : false
       }
    }