Generate gm/Android.mk, minus JSON.
When running gyp_to_android.py, generate the makefile for gm. For now, remove json functionality and do not depend on json. This allows us to build and run until solving skbug.com/2448. gm/gm_expectations.cpp: gm/gm_expectations.h: gm/gmmain.cpp: Remove all json functionality when SK_BUILD_JSON_WRITER is not defined. This flag is not defined when SK_BUILD_FOR_ANDROID is defined. gyp/gm.gyp: Depend on skia and cutils. platform_tools/android/bin/gyp_to_android.py: Generate gm/Android.mk. platform_tools/android/gyp_gen/makefile_writer.py: Build gm/Android.mk when building external/skia. Depends on https://codereview.chromium.org/282053002/ BUG=skia:2447 BUG=skia:2448 R=epoger@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/281303003 git-svn-id: http://skia.googlecode.com/svn/trunk@14767 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
a783559c26
commit
25c1066e4d
@ -31,6 +31,7 @@ const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5";
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Json::Value CreateJsonTree(Json::Value expectedResults,
|
||||
Json::Value actualResultsFailed,
|
||||
Json::Value actualResultsFailureIgnored,
|
||||
@ -46,7 +47,7 @@ namespace skiagm {
|
||||
root[kJsonKey_ExpectedResults] = expectedResults;
|
||||
return root;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// GmResultDigest class...
|
||||
|
||||
@ -54,6 +55,7 @@ namespace skiagm {
|
||||
fIsValid = SkBitmapHasher::ComputeDigest(bitmap, &fHashDigest);
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
GmResultDigest::GmResultDigest(const Json::Value &jsonTypeValuePair) {
|
||||
fIsValid = false;
|
||||
if (!jsonTypeValuePair.isArray()) {
|
||||
@ -78,6 +80,7 @@ namespace skiagm {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GmResultDigest::isValid() const {
|
||||
return fIsValid;
|
||||
@ -89,6 +92,7 @@ namespace skiagm {
|
||||
return (this->fIsValid && other.fIsValid && (this->fHashDigest == other.fHashDigest));
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Json::Value GmResultDigest::asJsonTypeValuePair() const {
|
||||
// TODO(epoger): The current implementation assumes that the
|
||||
// result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
|
||||
@ -101,6 +105,7 @@ namespace skiagm {
|
||||
}
|
||||
return jsonTypeValuePair;
|
||||
}
|
||||
#endif
|
||||
|
||||
SkString GmResultDigest::getHashType() const {
|
||||
// TODO(epoger): The current implementation assumes that the
|
||||
@ -135,6 +140,7 @@ namespace skiagm {
|
||||
fAllowedResultDigests.push_back(bitmapAndDigest.fDigest);
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Expectations::Expectations(Json::Value jsonElement) {
|
||||
if (jsonElement.empty()) {
|
||||
fIgnoreFailure = kDefaultIgnoreFailure;
|
||||
@ -167,6 +173,7 @@ namespace skiagm {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Expectations::match(GmResultDigest actualGmResultDigest) const {
|
||||
for (int i=0; i < this->fAllowedResultDigests.count(); i++) {
|
||||
@ -178,6 +185,7 @@ namespace skiagm {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Json::Value Expectations::asJsonValue() const {
|
||||
Json::Value allowedDigestArray;
|
||||
if (!this->fAllowedResultDigests.empty()) {
|
||||
@ -191,7 +199,7 @@ namespace skiagm {
|
||||
jsonExpectations[kJsonKey_ExpectedResults_IgnoreFailure] = this->ignoreFailure();
|
||||
return jsonExpectations;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// IndividualImageExpectationsSource class...
|
||||
|
||||
@ -211,6 +219,7 @@ namespace skiagm {
|
||||
}
|
||||
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
// JsonExpectationsSource class...
|
||||
|
||||
JsonExpectationsSource::JsonExpectationsSource(const char *jsonPath) {
|
||||
@ -240,5 +249,5 @@ namespace skiagm {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -22,12 +22,13 @@
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Json::Value CreateJsonTree(Json::Value expectedResults,
|
||||
Json::Value actualResultsFailed,
|
||||
Json::Value actualResultsFailureIgnored,
|
||||
Json::Value actualResultsNoComparison,
|
||||
Json::Value actualResultsSucceeded);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* The digest of a GM test result.
|
||||
*
|
||||
@ -41,12 +42,14 @@ namespace skiagm {
|
||||
*/
|
||||
explicit GmResultDigest(const SkBitmap &bitmap);
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
/**
|
||||
* Create a ResultDigest representing an allowed result
|
||||
* checksum within JSON expectations file, in the form
|
||||
* ["bitmap-64bitMD5", 12345].
|
||||
*/
|
||||
explicit GmResultDigest(const Json::Value &jsonTypeValuePair);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns true if this GmResultDigest was fully and successfully
|
||||
@ -60,11 +63,13 @@ namespace skiagm {
|
||||
*/
|
||||
bool equals(const GmResultDigest &other) const;
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
/**
|
||||
* Returns a JSON type/value pair representing this result,
|
||||
* such as ["bitmap-64bitMD5", 12345].
|
||||
*/
|
||||
Json::Value asJsonTypeValuePair() const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the hashtype, such as "bitmap-64bitMD5", as an SkString.
|
||||
@ -113,6 +118,7 @@ namespace skiagm {
|
||||
*/
|
||||
explicit Expectations(const BitmapAndDigest& bitmapAndDigest);
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
/**
|
||||
* Create Expectations from a JSON element as found within the
|
||||
* kJsonKey_ExpectedResults section.
|
||||
@ -121,6 +127,7 @@ namespace skiagm {
|
||||
* don't have any expectations.
|
||||
*/
|
||||
explicit Expectations(Json::Value jsonElement);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns true iff we want to ignore failed expectations.
|
||||
@ -154,10 +161,12 @@ namespace skiagm {
|
||||
return (SkBitmap::kNo_Config == fBitmap.config()) ? NULL : &fBitmap;
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
/**
|
||||
* Return a JSON representation of the expectations.
|
||||
*/
|
||||
Json::Value asJsonValue() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
const static bool kDefaultIgnoreFailure = false;
|
||||
@ -200,6 +209,7 @@ namespace skiagm {
|
||||
const SkString fRootDir;
|
||||
};
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
/**
|
||||
* Return Expectations based on JSON summary file.
|
||||
*/
|
||||
@ -227,6 +237,7 @@ namespace skiagm {
|
||||
Json::Value fJsonRoot;
|
||||
Json::Value fJsonExpectedResults;
|
||||
};
|
||||
#endif // SK_BUILD_JSON_WRITER
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -869,6 +869,7 @@ public:
|
||||
const GmResultDigest &actualResultDigest,
|
||||
ErrorCombination errors,
|
||||
bool ignoreFailure) {
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair();
|
||||
Json::Value *resultCollection = NULL;
|
||||
|
||||
@ -900,6 +901,7 @@ public:
|
||||
if (resultCollection) {
|
||||
(*resultCollection)[testName] = jsonActualResults;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -907,7 +909,9 @@ public:
|
||||
*/
|
||||
void add_expected_results_to_json_summary(const char testName[],
|
||||
Expectations expectations) {
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
this->fJsonExpectedResults[testName] = expectations.asJsonValue();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1267,13 +1271,14 @@ public:
|
||||
// If unset, we don't do comparisons.
|
||||
SkAutoTUnref<ExpectationsSource> fExpectationsSource;
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
// JSON summaries that we generate as we go (just for output).
|
||||
Json::Value fJsonExpectedResults;
|
||||
Json::Value fJsonActualResults_Failed;
|
||||
Json::Value fJsonActualResults_FailureIgnored;
|
||||
Json::Value fJsonActualResults_NoComparison;
|
||||
Json::Value fJsonActualResults_Succeeded;
|
||||
|
||||
#endif
|
||||
}; // end of GMMain class definition
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
@ -1473,7 +1478,9 @@ DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i
|
||||
"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");
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file.");
|
||||
#endif
|
||||
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, "
|
||||
@ -2198,10 +2205,12 @@ static bool parse_flags_gmmain_paths(GMMain* gmmain) {
|
||||
gmmain->fExpectationsSource.reset(SkNEW_ARGS(
|
||||
IndividualImageExpectationsSource, (readPath)));
|
||||
} else {
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
if (FLAGS_verbose) {
|
||||
SkDebugf("reading expectations from JSON summary file %s\n", readPath);
|
||||
}
|
||||
gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -2408,6 +2417,7 @@ int tool_main(int argc, char** argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_BUILD_JSON_WRITER
|
||||
if (FLAGS_writeJsonSummaryPath.count() == 1) {
|
||||
Json::Value root = CreateJsonTree(
|
||||
gmmain.fJsonExpectedResults,
|
||||
@ -2417,6 +2427,7 @@ int tool_main(int argc, char** argv) {
|
||||
SkFILEWStream stream(FLAGS_writeJsonSummaryPath[0]);
|
||||
stream.write(jsonStdString.c_str(), jsonStdString.length());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
|
@ -52,6 +52,12 @@
|
||||
'pdf.gyp:pdf',
|
||||
],
|
||||
'conditions': [
|
||||
['skia_android_framework', {
|
||||
'libraries': [
|
||||
'-lskia',
|
||||
'-lcutils',
|
||||
],
|
||||
}],
|
||||
['skia_run_pdfviewer_in_gm or skia_poppler_enabled', {
|
||||
'sources': [
|
||||
'../src/utils/SkPDFRasterizer.cpp',
|
||||
|
@ -144,6 +144,14 @@ def main(target_dir=None, require_sk_user_config=False):
|
||||
local_module_tags=['tests'],
|
||||
place_in_local_tmp=True)
|
||||
|
||||
tool_makefile_writer.generate_tool(gyp_dir=tmp_folder,
|
||||
target_file='gm.gyp',
|
||||
skia_trunk=target_dir,
|
||||
dest_dir='gm',
|
||||
skia_lib_var_dict=common,
|
||||
local_module_name='skia_gm',
|
||||
local_module_tags=['optional'])
|
||||
|
||||
# Now that the defines have been written to SkUserConfig and they've been
|
||||
# used to skip adding them to the tools makefiles, they are not needed in
|
||||
# Android.mk. Reset DEFINES.
|
||||
|
@ -120,7 +120,7 @@ SKIA_TOOLS = (
|
||||
include $(BASE_PATH)/bench/Android.mk
|
||||
|
||||
# golden-master (fidelity / regression test)
|
||||
#include $(BASE_PATH)/gm/Android.mk
|
||||
include $(BASE_PATH)/gm/Android.mk
|
||||
|
||||
# unit-tests
|
||||
include $(BASE_PATH)/tests/Android.mk
|
||||
|
Loading…
Reference in New Issue
Block a user