aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-19 15:58:00 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-19 15:58:00 +0000
commit628de5f1f496d96b6f58d3139319be0f42e41269 (patch)
treed7cf298d812769e068d1b8d3ac2cffcac21b071f
parent6324ac5d811e2554f78d61f0dfd918c678c395ba (diff)
Reverting r9682, which broke on some compilers
git-svn-id: http://skia.googlecode.com/svn/trunk@9684 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/gm_expectations.cpp17
-rw-r--r--gm/gm_expectations.h21
-rw-r--r--gm/gmmain.cpp75
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/command_line1
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/json-summary.txt25
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_1209453360120438698.png1
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_12927999507540085554.png1
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/return_value1
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/stderr0
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/stdout17
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_1209453360120438698.png1
-rw-r--r--gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_12927999507540085554.png1
-rwxr-xr-xgm/tests/run.sh4
13 files changed, 22 insertions, 143 deletions
diff --git a/gm/gm_expectations.cpp b/gm/gm_expectations.cpp
index a9293e4746..2f921201fa 100644
--- a/gm/gm_expectations.cpp
+++ b/gm/gm_expectations.cpp
@@ -109,23 +109,6 @@ namespace skiagm {
return jsonTypeValuePair;
}
- SkString GmResultDigest::getHashType() const {
- // TODO(epoger): The current implementation assumes that the
- // result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
- return SkString(kJsonKey_Hashtype_Bitmap_64bitMD5);
- }
-
- SkString GmResultDigest::getDigestValue() const {
- // TODO(epoger): The current implementation assumes that the
- // result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
- //
- // TODO(epoger): If SkString had an appendU64() method, it would be
- // more efficient to use that here... but it doesn't.
- SkString retval;
- retval.printf("%lu", fHashDigest);
- return retval;
- }
-
// Expectations class...
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h
index ec6899794a..55122d4ab8 100644
--- a/gm/gm_expectations.h
+++ b/gm/gm_expectations.h
@@ -76,33 +76,12 @@ namespace skiagm {
*/
Json::Value asJsonTypeValuePair() const;
- /**
- * Returns the hashtype, such as "bitmap-64bitMD5", as an SkString.
- */
- SkString getHashType() const;
-
- /**
- * Returns the hash digest value, such as "12345", as an SkString.
- */
- SkString getDigestValue() const;
-
private:
bool fIsValid; // always check this first--if it's false, other fields are meaningless
uint64_t fHashDigest;
};
/**
- * Encapsulates an SkBitmap and its GmResultDigest, guaranteed to keep them in sync.
- */
- class BitmapAndDigest {
- public:
- BitmapAndDigest(const SkBitmap &bitmap) : fBitmap(bitmap), fDigest(bitmap) {}
-
- const SkBitmap fBitmap;
- const GmResultDigest fDigest;
- };
-
- /**
* Test expectations (allowed image results, etc.)
*/
class Expectations {
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 42b7bdaefa..443a26bfbc 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -191,8 +191,7 @@ const static ErrorCombination kDefaultIgnorableErrorTypes = ErrorCombination()
class GMMain {
public:
- GMMain() : fUseFileHierarchy(false), fWriteChecksumBasedFilenames(false),
- fIgnorableErrorTypes(kDefaultIgnorableErrorTypes),
+ GMMain() : fUseFileHierarchy(false), fIgnorableErrorTypes(kDefaultIgnorableErrorTypes),
fMismatchPath(NULL), fTestsRun(0), fRenderModesEncountered(1) {}
/**
@@ -229,30 +228,6 @@ public:
return SkOSPath::SkPathJoin(path, filename.c_str());
}
- /**
- * Assemble filename suitable for writing out an SkBitmap.
- */
- SkString make_bitmap_filename(const char *path,
- const char *shortName,
- const char *configName,
- const char *renderModeDescriptor,
- const GmResultDigest &bitmapDigest) {
- if (fWriteChecksumBasedFilenames) {
- SkString filename;
- filename.append(bitmapDigest.getHashType());
- filename.appendUnichar('_');
- filename.append(shortName);
- filename.appendUnichar('_');
- filename.append(bitmapDigest.getDigestValue());
- filename.appendUnichar('.');
- filename.append(kPNG_FileExtension);
- return SkOSPath::SkPathJoin(path, filename.c_str());
- } else {
- return make_filename(path, shortName, configName, renderModeDescriptor,
- kPNG_FileExtension);
- }
- }
-
/* since PNG insists on unpremultiplying our alpha, we take no
precision chances and force all pixels to be 100% opaque,
otherwise on compare we may not get a perfect match.
@@ -662,8 +637,7 @@ public:
ErrorCombination write_reference_image(const ConfigData& gRec, const char writePath [],
const char renderModeDescriptor [],
- const char *shortName,
- const BitmapAndDigest& bitmapAndDigest,
+ const char *shortName, SkBitmap& bitmap,
SkDynamicMemoryWStream* document) {
SkString path;
bool success = false;
@@ -671,9 +645,9 @@ public:
gRec.fBackend == kGPU_Backend ||
(gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) {
- path = make_bitmap_filename(writePath, shortName, gRec.fName, renderModeDescriptor,
- bitmapAndDigest.fDigest);
- success = write_bitmap(path, bitmapAndDigest.fBitmap);
+ path = make_filename(writePath, shortName, gRec.fName, renderModeDescriptor,
+ kPNG_FileExtension);
+ success = write_bitmap(path, bitmap);
}
if (kPDF_Backend == gRec.fBackend) {
path = make_filename(writePath, shortName, gRec.fName, renderModeDescriptor,
@@ -769,7 +743,7 @@ public:
* actual bitmap will be written out to a file within fMismatchPath.
*
* @param expectations what expectations to compare actualBitmap against
- * @param actualBitmapAndDigest the SkBitmap we actually generated, and its GmResultDigest
+ * @param actualBitmap the image we actually generated
* @param shortName name of test, e.g. "selftest1"
* @param configName name of config, e.g. "8888"
* @param renderModeDescriptor e.g., "-rtree", "-deferred"
@@ -781,11 +755,12 @@ public:
* See https://codereview.chromium.org/13650002/ )
*/
ErrorCombination compare_to_expectations(Expectations expectations,
- const BitmapAndDigest& actualBitmapAndDigest,
+ const SkBitmap& actualBitmap,
const char *shortName, const char *configName,
const char *renderModeDescriptor,
bool addToJsonSummary) {
ErrorCombination errors;
+ GmResultDigest actualResultDigest(actualBitmap);
SkString shortNamePlusConfig = make_shortname_plus_config(shortName, configName);
SkString completeNameString(shortNamePlusConfig);
completeNameString.append(renderModeDescriptor);
@@ -795,7 +770,7 @@ public:
if (expectations.empty()) {
errors.add(kMissingExpectations_ErrorType);
- } else if (!expectations.match(actualBitmapAndDigest.fDigest)) {
+ } else if (!expectations.match(actualResultDigest)) {
addToJsonSummary = true;
// The error mode we record depends on whether this was running
// in a non-standard renderMode.
@@ -808,24 +783,23 @@ public:
// Write out the "actuals" for any mismatches, if we have
// been directed to do so.
if (fMismatchPath) {
- SkString path = make_bitmap_filename(fMismatchPath, shortName, configName,
- renderModeDescriptor,
- actualBitmapAndDigest.fDigest);
- write_bitmap(path, actualBitmapAndDigest.fBitmap);
+ SkString path =
+ make_filename(fMismatchPath, shortName, configName, renderModeDescriptor,
+ kPNG_FileExtension);
+ write_bitmap(path, actualBitmap);
}
// If we have access to a single expected bitmap, log more
// detail about the mismatch.
const SkBitmap *expectedBitmapPtr = expectations.asBitmap();
if (NULL != expectedBitmapPtr) {
- report_bitmap_diffs(*expectedBitmapPtr, actualBitmapAndDigest.fBitmap,
- completeName);
+ report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeName);
}
}
RecordTestResults(errors, shortNamePlusConfig, renderModeDescriptor);
if (addToJsonSummary) {
- add_actual_results_to_json_summary(completeName, actualBitmapAndDigest.fDigest, errors,
+ add_actual_results_to_json_summary(completeName, actualResultDigest, errors,
expectations.ignoreFailure());
add_expected_results_to_json_summary(completeName, expectations);
}
@@ -900,7 +874,6 @@ public:
GM* gm, const ConfigData& gRec, const char writePath[],
SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) {
- BitmapAndDigest actualBitmapAndDigest(actualBitmap);
SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(), gRec.fName);
SkString nameWithExtension(shortNamePlusConfig);
nameWithExtension.append(".");
@@ -923,13 +896,13 @@ public:
* See comments above complete_bitmap() for more detail.
*/
Expectations expectations = expectationsSource->get(nameWithExtension.c_str());
- errors.add(compare_to_expectations(expectations, actualBitmapAndDigest,
+ errors.add(compare_to_expectations(expectations, actualBitmap,
gm->shortName(), gRec.fName, "", true));
} else {
// If we are running without expectations, we still want to
// record the actual results.
- add_actual_results_to_json_summary(nameWithExtension.c_str(),
- actualBitmapAndDigest.fDigest,
+ GmResultDigest actualResultDigest(actualBitmap);
+ add_actual_results_to_json_summary(nameWithExtension.c_str(), actualResultDigest,
ErrorCombination(kMissingExpectations_ErrorType),
false);
RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType),
@@ -942,7 +915,7 @@ public:
// renderModes of all tests! That would be a lot of files.
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
errors.add(write_reference_image(gRec, writePath, "", gm->shortName(),
- actualBitmapAndDigest, pdf));
+ actualBitmap, pdf));
}
return errors;
@@ -963,8 +936,7 @@ public:
SkASSERT(referenceBitmap);
Expectations expectations(*referenceBitmap);
- BitmapAndDigest actualBitmapAndDigest(actualBitmap);
- return compare_to_expectations(expectations, actualBitmapAndDigest, shortName,
+ return compare_to_expectations(expectations, actualBitmap, shortName,
configName, renderModeDescriptor, false);
}
@@ -1174,7 +1146,7 @@ public:
// They are public for now, to allow easier setting by tool_main().
//
- bool fUseFileHierarchy, fWriteChecksumBasedFilenames;
+ bool fUseFileHierarchy;
ErrorCombination fIgnorableErrorTypes;
const char* fMismatchPath;
@@ -1334,11 +1306,9 @@ DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay.");
DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture.");
DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale "
"factors to be used for tileGrid playback testing. Default value: 1.0");
+DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file.");
DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more info about "
"each test).");
-DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
- "based filenames, as rebaseline.py will use when downloading them from Google Storage");
-DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file.");
DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.");
DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, "
@@ -1795,7 +1765,6 @@ int tool_main(int argc, char** argv) {
SkCommandLineFlags::Parse(argc, argv);
gmmain.fUseFileHierarchy = FLAGS_hierarchy;
- gmmain.fWriteChecksumBasedFilenames = FLAGS_writeChecksumBasedFilenames;
if (FLAGS_mismatchPath.count() == 1) {
gmmain.fMismatchPath = FLAGS_mismatchPath[0];
}
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/command_line b/gm/tests/outputs/checksum-based-filenames/output-expected/command_line
deleted file mode 100644
index 3e4ddb944f..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/command_line
+++ /dev/null
@@ -1 +0,0 @@
-out/Debug/gm --verbose --writeChecksumBasedFilenames --match selftest1 --config 8888 565 -r gm/tests/inputs/json/different-pixels-no-hierarchy.json --writeJsonSummaryPath gm/tests/outputs/checksum-based-filenames/output-actual/json-summary.txt --writePath gm/tests/outputs/checksum-based-filenames/output-actual/writePath --mismatchPath gm/tests/outputs/checksum-based-filenames/output-actual/mismatchPath
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/json-summary.txt b/gm/tests/outputs/checksum-based-filenames/output-expected/json-summary.txt
deleted file mode 100644
index b3e2a8150f..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/json-summary.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "actual-results" : {
- "failed" : {
- "selftest1_565.png" : [ "bitmap-64bitMD5", 12927999507540085554 ],
- "selftest1_8888.png" : [ "bitmap-64bitMD5", 1209453360120438698 ]
- },
- "failure-ignored" : null,
- "no-comparison" : null,
- "succeeded" : null
- },
- "expected-results" : {
- "selftest1_565.png" : {
- "allowed-digests" : [
- [ "bitmap-64bitMD5", 8863920166200910451 ]
- ],
- "ignore-failure" : false
- },
- "selftest1_8888.png" : {
- "allowed-digests" : [
- [ "bitmap-64bitMD5", 13451349865803053525 ]
- ],
- "ignore-failure" : false
- }
- }
-}
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_1209453360120438698.png b/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_1209453360120438698.png
deleted file mode 100644
index bd5820f02e..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_1209453360120438698.png
+++ /dev/null
@@ -1 +0,0 @@
-[contents of gm/tests/outputs/checksum-based-filenames/output-actual/mismatchPath/bitmap-64bitMD5_selftest1_1209453360120438698.png]
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_12927999507540085554.png b/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_12927999507540085554.png
deleted file mode 100644
index b1ab39e5bc..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/mismatchPath/bitmap-64bitMD5_selftest1_12927999507540085554.png
+++ /dev/null
@@ -1 +0,0 @@
-[contents of gm/tests/outputs/checksum-based-filenames/output-actual/mismatchPath/bitmap-64bitMD5_selftest1_12927999507540085554.png]
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/return_value b/gm/tests/outputs/checksum-based-filenames/output-expected/return_value
deleted file mode 100644
index ace9d03621..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/return_value
+++ /dev/null
@@ -1 +0,0 @@
-255
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/stderr b/gm/tests/outputs/checksum-based-filenames/output-expected/stderr
deleted file mode 100644
index e69de29bb2..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/stderr
+++ /dev/null
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/stdout b/gm/tests/outputs/checksum-based-filenames/output-expected/stdout
deleted file mode 100644
index 656d6958b1..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/stdout
+++ /dev/null
@@ -1,17 +0,0 @@
-GM: These configs will be run: 8888 565
-GM: reading expectations from JSON summary file gm/tests/inputs/json/different-pixels-no-hierarchy.json
-GM: writing to gm/tests/outputs/checksum-based-filenames/output-actual/writePath
-GM: writing mismatches to gm/tests/outputs/checksum-based-filenames/output-actual/mismatchPath
-GM: drawing... selftest1 [300 200]
-GM: Ran 1 GMs
-GM: ... over 2 configs ["8888", "565"]
-GM: ... and 7 modes ["pipe", "pipe cross-process", "pipe cross-process, shared address", "replay", "rtree", "serialize", "tilegrid"]
-GM: ... so there should be a total of 9 tests.
-GM: Ran 9 tests: NoGpuContext=0 IntentionallySkipped=0 RenderModeMismatch=0 ExpectationsMismatch=2 MissingExpectations=0 WritingReferenceImage=0
-GM: [*] 0 NoGpuContext:
-GM: [ ] 0 IntentionallySkipped:
-GM: [*] 0 RenderModeMismatch:
-GM: [*] 2 ExpectationsMismatch: selftest1_8888 selftest1_565
-GM: [ ] 0 MissingExpectations:
-GM: [*] 0 WritingReferenceImage:
-GM: (results marked with [*] will cause nonzero return value)
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_1209453360120438698.png b/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_1209453360120438698.png
deleted file mode 100644
index e13581c69f..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_1209453360120438698.png
+++ /dev/null
@@ -1 +0,0 @@
-[contents of gm/tests/outputs/checksum-based-filenames/output-actual/writePath/bitmap-64bitMD5_selftest1_1209453360120438698.png]
diff --git a/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_12927999507540085554.png b/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_12927999507540085554.png
deleted file mode 100644
index 0a719f7670..0000000000
--- a/gm/tests/outputs/checksum-based-filenames/output-expected/writePath/bitmap-64bitMD5_selftest1_12927999507540085554.png
+++ /dev/null
@@ -1 +0,0 @@
-[contents of gm/tests/outputs/checksum-based-filenames/output-actual/writePath/bitmap-64bitMD5_selftest1_12927999507540085554.png]
diff --git a/gm/tests/run.sh b/gm/tests/run.sh
index ab930a1c1b..809c7d038d 100755
--- a/gm/tests/run.sh
+++ b/gm/tests/run.sh
@@ -216,10 +216,6 @@ gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar
# Test non-hierarchical mode.
gm_test "--verbose --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels-no-hierarchy.json" "$GM_OUTPUTS/no-hierarchy"
-# Try writing out actual images using checksum-based filenames, like we do when
-# uploading to Google Storage.
-gm_test "--verbose --writeChecksumBasedFilenames --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels-no-hierarchy.json" "$GM_OUTPUTS/checksum-based-filenames"
-
# Exercise display_json_results.py
PASSING_CASES="compared-against-identical-bytes-json compared-against-identical-pixels-json"
FAILING_CASES="compared-against-different-pixels-json"