| OLD | NEW |
| 1 // Main binary for DM. | 1 // Main binary for DM. |
| 2 // For a high-level overview, please see dm/README. | 2 // For a high-level overview, please see dm/README. |
| 3 | 3 |
| 4 #include "CrashHandler.h" | 4 #include "CrashHandler.h" |
| 5 #include "SkCommandLineFlags.h" | 5 #include "SkCommonFlags.h" |
| 6 #include "SkForceLinking.h" | 6 #include "SkForceLinking.h" |
| 7 #include "SkGraphics.h" | 7 #include "SkGraphics.h" |
| 8 #include "SkPicture.h" | 8 #include "SkPicture.h" |
| 9 #include "SkString.h" | 9 #include "SkString.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| 11 #include "gm.h" | 11 #include "gm.h" |
| 12 | 12 |
| 13 #include "DMCpuGMTask.h" | 13 #include "DMCpuGMTask.h" |
| 14 #include "DMGpuGMTask.h" | 14 #include "DMGpuGMTask.h" |
| 15 #include "DMGpuSupport.h" | 15 #include "DMGpuSupport.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 31 #include <ctype.h> | 31 #include <ctype.h> |
| 32 | 32 |
| 33 using skiagm::GM; | 33 using skiagm::GM; |
| 34 using skiagm::GMRegistry; | 34 using skiagm::GMRegistry; |
| 35 using skiatest::Test; | 35 using skiatest::Test; |
| 36 using skiatest::TestRegistry; | 36 using skiatest::TestRegistry; |
| 37 | 37 |
| 38 static const char kGpuAPINameGL[] = "gl"; | 38 static const char kGpuAPINameGL[] = "gl"; |
| 39 static const char kGpuAPINameGLES[] = "gles"; | 39 static const char kGpuAPINameGLES[] = "gles"; |
| 40 | 40 |
| 41 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); | |
| 42 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); | 41 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
| 43 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " | |
| 44 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " | |
| 45 "Defaults to empty string, which selects the API native to the " | |
| 46 "system."); | |
| 47 DEFINE_string2(expectations, r, "", | 42 DEFINE_string2(expectations, r, "", |
| 48 "If a directory, compare generated images against images under th
is path. " | 43 "If a directory, compare generated images against images under th
is path. " |
| 49 "If a file, compare generated images against JSON expectations at
this path." | 44 "If a file, compare generated images against JSON expectations at
this path." |
| 50 ); | 45 ); |
| 51 DEFINE_string2(resources, i, "resources", "Path to resources directory."); | 46 |
| 52 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" | |
| 53 "Multiple matches may be separated by spaces.\n" | |
| 54 "~ causes a matching GM to always be skipped\n" | |
| 55 "^ requires the start of the GM to match\n" | |
| 56 "$ requires the end of the GM to match\n" | |
| 57 "^ and $ requires an exact match\n" | |
| 58 "If a GM does not match any list entry,\n" | |
| 59 "it is skipped unless some list entry starts with ~"); | |
| 60 DEFINE_string(config, "565 8888 pdf gpu nonrendering", | |
| 61 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp
rmsaa16 " | |
| 62 "gpunull gpudebug angle mesa"); | |
| 63 DEFINE_bool(dryRun, false, | |
| 64 "Just print the tests that would be run, without actually running th
em."); | |
| 65 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); | |
| 66 DEFINE_string(skps, "", "Directory to read skps from."); | 47 DEFINE_string(skps, "", "Directory to read skps from."); |
| 67 | 48 |
| 68 DEFINE_bool(gms, true, "Run GMs?"); | 49 DEFINE_bool(gms, true, "Run GMs?"); |
| 69 DEFINE_bool(tests, true, "Run tests?"); | 50 DEFINE_bool(tests, true, "Run tests?"); |
| 70 | 51 |
| 71 DECLARE_bool(verbose); | |
| 72 | |
| 73 __SK_FORCE_IMAGE_DECODER_LINKING; | 52 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 74 | 53 |
| 75 // "FooBar" -> "foobar". Obviously, ASCII only. | 54 // "FooBar" -> "foobar". Obviously, ASCII only. |
| 76 static SkString lowercase(SkString s) { | 55 static SkString lowercase(SkString s) { |
| 77 for (size_t i = 0; i < s.size(); i++) { | 56 for (size_t i = 0; i < s.size(); i++) { |
| 78 s[i] = tolower(s[i]); | 57 s[i] = tolower(s[i]); |
| 79 } | 58 } |
| 80 return s; | 59 return s; |
| 81 } | 60 } |
| 82 | 61 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 template <typename T, typename Registry> | 175 template <typename T, typename Registry> |
| 197 static void append_matching_factories(Registry* head, SkTDArray<typename Registr
y::Factory>* out) { | 176 static void append_matching_factories(Registry* head, SkTDArray<typename Registr
y::Factory>* out) { |
| 198 for (const Registry* reg = head; reg != NULL; reg = reg->next()) { | 177 for (const Registry* reg = head; reg != NULL; reg = reg->next()) { |
| 199 SkAutoTDelete<T> forName(reg->factory()(NULL)); | 178 SkAutoTDelete<T> forName(reg->factory()(NULL)); |
| 200 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { | 179 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { |
| 201 *out->append() = reg->factory(); | 180 *out->append() = reg->factory(); |
| 202 } | 181 } |
| 203 } | 182 } |
| 204 } | 183 } |
| 205 | 184 |
| 206 int tool_main(int argc, char** argv); | 185 int dm_main(); |
| 207 int tool_main(int argc, char** argv) { | 186 int dm_main() { |
| 208 SetupCrashHandler(); | 187 SetupCrashHandler(); |
| 209 SkAutoGraphics ag; | 188 SkAutoGraphics ag; |
| 210 SkCommandLineFlags::Parse(argc, argv); | |
| 211 | 189 |
| 212 if (FLAGS_dryRun) { | 190 if (FLAGS_dryRun) { |
| 213 FLAGS_verbose = true; | 191 FLAGS_verbose = true; |
| 214 } | 192 } |
| 215 #if SK_ENABLE_INST_COUNT | 193 #if SK_ENABLE_INST_COUNT |
| 216 gPrintInstCount = FLAGS_leaks; | 194 gPrintInstCount = FLAGS_leaks; |
| 217 #endif | 195 #endif |
| 218 | 196 |
| 219 SkTArray<SkString> configs; | 197 SkTArray<SkString> configs; |
| 220 for (int i = 0; i < FLAGS_config.count(); i++) { | 198 for (int i = 0; i < FLAGS_config.count(); i++) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 SkDebugf("\n"); | 233 SkDebugf("\n"); |
| 256 | 234 |
| 257 SkTArray<SkString> failures; | 235 SkTArray<SkString> failures; |
| 258 reporter.getFailures(&failures); | 236 reporter.getFailures(&failures); |
| 259 report_failures(failures); | 237 report_failures(failures); |
| 260 return failures.count() > 0; | 238 return failures.count() > 0; |
| 261 } | 239 } |
| 262 | 240 |
| 263 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 241 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 264 int main(int argc, char** argv) { | 242 int main(int argc, char** argv) { |
| 265 return tool_main(argc, argv); | 243 SkCommandLineFlags::Parse(argc, argv); |
| 244 return dm_main(); |
| 266 } | 245 } |
| 267 #endif | 246 #endif |
| OLD | NEW |