diff options
author | 2014-08-22 04:46:30 -0700 | |
---|---|---|
committer | 2014-08-22 04:46:30 -0700 | |
commit | 2529f2e72cddf87904c8ad4b613942cbef802cfb (patch) | |
tree | 0c2dc416fcfec3ce529cef029a8327728859313c /tools | |
parent | 85b438dfab7f6ec1fd46dbc19215ccf2171ad6ae (diff) |
Add ability to output ImageBaseGSUrl to render_picture and use in rebaseline server.
BUG=skia:2230
R=epoger@google.com
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/479613002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/image_expectations.cpp | 6 | ||||
-rw-r--r-- | tools/image_expectations.h | 8 | ||||
-rw-r--r-- | tools/render_pictures_main.cpp | 4 | ||||
-rwxr-xr-x | tools/tests/render_pictures_test.py | 10 |
4 files changed, 28 insertions, 0 deletions
diff --git a/tools/image_expectations.cpp b/tools/image_expectations.cpp index f0c9cfbbff..05a905dd58 100644 --- a/tools/image_expectations.cpp +++ b/tools/image_expectations.cpp @@ -30,6 +30,7 @@ const static char kJsonKey_ActualResults[] = "actual-results"; const static char kJsonKey_Descriptions[] = "descriptions"; const static char kJsonKey_ExpectedResults[] = "expected-results"; +const static char kJsonKey_ImageBaseGSUrl[] = "image-base-gs-url"; const static char kJsonKey_Header[] = "header"; const static char kJsonKey_Header_Type[] = "type"; const static char kJsonKey_Header_Revision[] = "revision"; @@ -198,6 +199,10 @@ namespace sk_tools { fDescriptions[key] = value; } + void ImageResultsAndExpectations::setImageBaseGSUrl(const char *imageBaseGSUrl) { + fImageBaseGSUrl = imageBaseGSUrl; + } + Expectation ImageResultsAndExpectations::getExpectation(const char *sourceName, const int *tileNumber) { if (fExpectedResults.isNull()) { @@ -228,6 +233,7 @@ namespace sk_tools { root[kJsonKey_ActualResults] = fActualResults; root[kJsonKey_Descriptions] = fDescriptions; root[kJsonKey_Header] = header; + root[kJsonKey_ImageBaseGSUrl] = fImageBaseGSUrl; std::string jsonStdString = root.toStyledString(); SkFILEWStream stream(filename); stream.write(jsonStdString.c_str(), jsonStdString.length()); diff --git a/tools/image_expectations.h b/tools/image_expectations.h index 2d58b92973..422c64d4ed 100644 --- a/tools/image_expectations.h +++ b/tools/image_expectations.h @@ -185,6 +185,13 @@ namespace sk_tools { void addDescription(const char *key, const char *value); /** + * Adds the image base Google Storage URL to the summary of results. + * + * @param imageBaseGSUrl the image base Google Storage URL + */ + void setImageBaseGSUrl(const char *imageBaseGSUrl); + + /** * Returns the Expectation for this test. * * @param sourceName name of the source file that generated this result @@ -217,6 +224,7 @@ namespace sk_tools { Json::Value fDescriptions; Json::Value fExpectedJsonRoot; Json::Value fExpectedResults; + Json::Value fImageBaseGSUrl; }; } // namespace sk_tools diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp index 595a78ee8c..d508510fea 100644 --- a/tools/render_pictures_main.cpp +++ b/tools/render_pictures_main.cpp @@ -30,6 +30,7 @@ DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi DECLARE_bool(deferImageDecoding); DEFINE_string(descriptions, "", "one or more key=value pairs to add to the descriptions section " "of the JSON summary."); +DEFINE_string(imageBaseGSUrl, "", "The Google Storage image base URL the images are stored in."); DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Components that differ " "by more than this amount are considered errors, though all diffs are reported. " "Requires --validate."); @@ -498,6 +499,9 @@ int tool_main(int argc, char** argv) { SkASSERT(tokens.count() == 2); jsonSummary.addDescription(tokens[0].c_str(), tokens[1].c_str()); } + if (FLAGS_imageBaseGSUrl.count() == 1) { + jsonSummary.setImageBaseGSUrl(FLAGS_imageBaseGSUrl[0]); + } jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); } return 0; diff --git a/tools/tests/render_pictures_test.py b/tools/tests/render_pictures_test.py index 9ff3226968..6daadd8b08 100755 --- a/tools/tests/render_pictures_test.py +++ b/tools/tests/render_pictures_test.py @@ -197,6 +197,7 @@ class RenderPicturesTest(base_unittest.TestCase): '--writeWholeImage']) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -233,6 +234,7 @@ class RenderPicturesTest(base_unittest.TestCase): modified_red_tiles[5]['comparisonResult'] = 'failure-ignored' expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -270,6 +272,7 @@ class RenderPicturesTest(base_unittest.TestCase): modified_red_tiles[5]['comparisonResult'] = 'no-comparison' expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -315,6 +318,7 @@ class RenderPicturesTest(base_unittest.TestCase): if expected_summary_dict == None: expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -340,6 +344,7 @@ class RenderPicturesTest(base_unittest.TestCase): pass expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -370,6 +375,7 @@ class RenderPicturesTest(base_unittest.TestCase): ]) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : { "builder": "builderName", "renderMode": "renderModeName", @@ -421,6 +427,7 @@ class RenderPicturesTest(base_unittest.TestCase): '--writeJsonSummaryPath', output_json_path]) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -449,6 +456,7 @@ class RenderPicturesTest(base_unittest.TestCase): '--writeJsonSummaryPath', output_json_path]) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -484,6 +492,7 @@ class RenderPicturesTest(base_unittest.TestCase): '--writeJsonSummaryPath', output_json_path]) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { @@ -515,6 +524,7 @@ class RenderPicturesTest(base_unittest.TestCase): '--writeJsonSummaryPath', output_json_path]) expected_summary_dict = { "header" : EXPECTED_HEADER_CONTENTS, + "image-base-gs-url" : None, "descriptions" : None, "actual-results" : { "red.skp": { |