OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCommonFlags.h" | 8 #include "SkCommonFlags.h" |
9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
10 | 10 |
11 DEFINE_bool(cpu, true, "master switch for running CPU-bound work."); | 11 DEFINE_bool(cpu, true, "master switch for running CPU-bound work."); |
12 | 12 |
13 DEFINE_bool(dryRun, false, | 13 DEFINE_bool(dryRun, false, |
14 "just print the tests that would be run, without actually running th
em."); | 14 "just print the tests that would be run, without actually running th
em."); |
15 | 15 |
16 DEFINE_bool(gpu, true, "master switch for running GPU-bound work."); | 16 DEFINE_bool(gpu, true, "master switch for running GPU-bound work."); |
17 | 17 |
18 DEFINE_string(images, "", "List of images and/or directories to decode. A direct
ory with no images" | 18 DEFINE_string(images, "", "List of images and/or directories to decode. A direct
ory with no images" |
19 " is treated as a fatal error."); | 19 " is treated as a fatal error."); |
20 | 20 |
| 21 DEFINE_string(colorImages, "", "List of images and/or directories to decode with
color correction. " |
| 22 "A directory with no images is treated as a fatal
error."); |
| 23 |
21 DEFINE_string2(match, m, nullptr, | 24 DEFINE_string2(match, m, nullptr, |
22 "[~][^]substring[$] [...] of GM name to run.\n" | 25 "[~][^]substring[$] [...] of GM name to run.\n" |
23 "Multiple matches may be separated by spaces.\n" | 26 "Multiple matches may be separated by spaces.\n" |
24 "~ causes a matching GM to always be skipped\n" | 27 "~ causes a matching GM to always be skipped\n" |
25 "^ requires the start of the GM to match\n" | 28 "^ requires the start of the GM to match\n" |
26 "$ requires the end of the GM to match\n" | 29 "$ requires the end of the GM to match\n" |
27 "^ and $ requires an exact match\n" | 30 "^ and $ requires an exact match\n" |
28 "If a GM does not match any list entry,\n" | 31 "If a GM does not match any list entry,\n" |
29 "it is skipped unless some list entry starts with ~"); | 32 "it is skipped unless some list entry starts with ~"); |
30 | 33 |
(...skipping 17 matching lines...) Expand all Loading... |
48 DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose."); | 51 DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose."); |
49 | 52 |
50 DEFINE_string2(writePath, w, "", "If set, write bitmaps here as .pngs."); | 53 DEFINE_string2(writePath, w, "", "If set, write bitmaps here as .pngs."); |
51 | 54 |
52 DEFINE_string(key, "", | 55 DEFINE_string(key, "", |
53 "Space-separated key/value pairs to add to JSON identifying this b
uilder."); | 56 "Space-separated key/value pairs to add to JSON identifying this b
uilder."); |
54 DEFINE_string(properties, "", | 57 DEFINE_string(properties, "", |
55 "Space-separated key/value pairs to add to JSON identifying this r
un."); | 58 "Space-separated key/value pairs to add to JSON identifying this r
un."); |
56 DEFINE_bool2(pre_log, p, false, "Log before running each test. May be incomprehe
nsible when threading"); | 59 DEFINE_bool2(pre_log, p, false, "Log before running each test. May be incomprehe
nsible when threading"); |
57 | 60 |
58 bool CollectImages(SkTArray<SkString>* output) { | 61 bool CollectImages(SkCommandLineFlags::StringArray images, SkTArray<SkString>* o
utput) { |
59 SkASSERT(output); | 62 SkASSERT(output); |
60 | 63 |
61 static const char* const exts[] = { | 64 static const char* const exts[] = { |
62 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, | 65 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, |
63 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, | 66 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, |
64 #ifdef SK_CODEC_DECODES_RAW | 67 #ifdef SK_CODEC_DECODES_RAW |
65 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | 68 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", |
66 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | 69 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", |
67 #endif | 70 #endif |
68 }; | 71 }; |
69 | 72 |
70 for (int i = 0; i < FLAGS_images.count(); ++i) { | 73 for (int i = 0; i < images.count(); ++i) { |
71 const char* flag = FLAGS_images[i]; | 74 const char* flag = images[i]; |
72 if (!sk_exists(flag)) { | 75 if (!sk_exists(flag)) { |
73 SkDebugf("%s does not exist!\n", flag); | 76 SkDebugf("%s does not exist!\n", flag); |
74 return false; | 77 return false; |
75 } | 78 } |
76 | 79 |
77 if (sk_isdir(flag)) { | 80 if (sk_isdir(flag)) { |
78 // If the value passed in is a directory, add all the images | 81 // If the value passed in is a directory, add all the images |
79 bool foundAnImage = false; | 82 bool foundAnImage = false; |
80 for (const char* ext : exts) { | 83 for (const char* ext : exts) { |
81 SkOSFile::Iter it(flag, ext); | 84 SkOSFile::Iter it(flag, ext); |
82 SkString file; | 85 SkString file; |
83 while (it.next(&file)) { | 86 while (it.next(&file)) { |
84 foundAnImage = true; | 87 foundAnImage = true; |
85 output->push_back() = SkOSPath::Join(flag, file.c_str()); | 88 output->push_back() = SkOSPath::Join(flag, file.c_str()); |
86 } | 89 } |
87 } | 90 } |
88 if (!foundAnImage) { | 91 if (!foundAnImage) { |
89 SkDebugf("No supported images found in %s!\n", flag); | 92 SkDebugf("No supported images found in %s!\n", flag); |
90 return false; | 93 return false; |
91 } | 94 } |
92 } else { | 95 } else { |
93 // Also add the value if it is a single image | 96 // Also add the value if it is a single image |
94 output->push_back() = flag; | 97 output->push_back() = flag; |
95 } | 98 } |
96 } | 99 } |
97 return true; | 100 return true; |
98 } | 101 } |
OLD | NEW |