diff options
author | 2016-01-29 14:41:55 -0800 | |
---|---|---|
committer | 2016-01-29 14:41:55 -0800 | |
commit | ad38ed6003ad89a21e40d76987db4bba7d42f3d0 (patch) | |
tree | bc88455e3b2202f9a0f4d64b34ee778bdc5604a5 /dm | |
parent | e82a6c7e71090c218e773fd2f7af6622490d892a (diff) |
Revert of Treat bad values passed to --images as a fatal error (patchset #17 id:320001 of https://codereview.chromium.org/1611323004/ )
Reason for revert:
Speculative to fix windows bots
Original issue's description:
> Treat bad values passed to --images as a fatal error
>
> If an option is passed to --images that is either a non-existent path or
> a folder with no images matching the supported types, assume this is
> an error and exit, so they can supply a valid path instead.
>
> Share code between DM and nanobench in SkCommonFlags.
>
> nanobench now behaves more like DM - it will check a directory for
> images that match the supported extensions.
>
> Only consider image paths ending in RAW suffixes as images if
> SK_CODE_DECODES_RAW is defined. This prevents us from seeing failure
> to decode errors on platforms that cannot decode it.
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1611323004
>
> Committed: https://skia.googlesource.com/skia/+/7579786f3bd5a8fda84a1abc45b16213c3371f93
TBR=mtklein@google.com,borenet@google.com,msarett@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
# Not skipping CQ checks because original CL landed more than 1 days ago.
Review URL: https://codereview.chromium.org/1653543002
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DM.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
@@ -519,7 +519,7 @@ static bool brd_supported(const char* ext) { return false; } -static bool gather_srcs() { +static void gather_srcs() { for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->next()) { push_src("gm", "", new GMSrc(r->factory())); } @@ -534,25 +534,31 @@ static bool gather_srcs() { push_src("skp", "", new SKPSrc(path)); } } - - SkTArray<SkString> images; - if (!CollectImages(&images)) { - return false; - } - - for (auto image : images) { - push_codec_srcs(image); - const char* ext = ""; - int index = image.findLastOf('.'); - if (index >= 0 && (size_t) ++index < image.size()) { - ext = &image.c_str()[index]; - } - if (brd_supported(ext)) { - push_brd_srcs(image); + static const char* const exts[] = { + "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico", + "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO", + "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", + "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", + }; + for (int i = 0; i < FLAGS_images.count(); i++) { + const char* flag = FLAGS_images[i]; + if (sk_isdir(flag)) { + for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { + SkOSFile::Iter it(flag, exts[j]); + for (SkString file; it.next(&file); ) { + SkString path = SkOSPath::Join(flag, file.c_str()); + push_codec_srcs(path); + if (brd_supported(exts[j])) { + push_brd_srcs(path); + } + } + } + } else if (sk_exists(flag)) { + // assume that FLAGS_images[i] is a valid image if it is a file. + push_codec_srcs(flag); + push_brd_srcs(flag); } } - - return true; } static void push_sink(const SkCommandLineConfig& config, Sink* s) { @@ -1100,9 +1106,7 @@ int dm_main() { gather_gold(); gather_uninteresting_hashes(); - if (!gather_srcs()) { - return 1; - } + gather_srcs(); gather_sinks(); gather_tests(); |