| 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 "LazyDecodeBitmap.h" | 5 #include "LazyDecodeBitmap.h" |
| 6 #include "SkCommonFlags.h" | 6 #include "SkCommonFlags.h" |
| 7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "SkPicture.h" | 9 #include "SkPicture.h" |
| 10 #include "SkString.h" | 10 #include "SkString.h" |
| 11 #include "SkTaskGroup.h" | |
| 12 #include "Test.h" | 11 #include "Test.h" |
| 13 #include "gm.h" | 12 #include "gm.h" |
| 14 #include "sk_tool_utils.h" | 13 #include "sk_tool_utils.h" |
| 15 #include "sk_tool_utils_flags.h" | 14 #include "sk_tool_utils_flags.h" |
| 16 | 15 |
| 17 #include "DMCpuGMTask.h" | 16 #include "DMCpuGMTask.h" |
| 18 #include "DMGpuGMTask.h" | 17 #include "DMGpuGMTask.h" |
| 19 #include "DMGpuSupport.h" | 18 #include "DMGpuSupport.h" |
| 20 #include "DMPDFTask.h" | 19 #include "DMPDFTask.h" |
| 21 #include "DMReporter.h" | 20 #include "DMReporter.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 #include <ctype.h> | 34 #include <ctype.h> |
| 36 | 35 |
| 37 using skiagm::GM; | 36 using skiagm::GM; |
| 38 using skiagm::GMRegistry; | 37 using skiagm::GMRegistry; |
| 39 using skiatest::Test; | 38 using skiatest::Test; |
| 40 using skiatest::TestRegistry; | 39 using skiatest::TestRegistry; |
| 41 | 40 |
| 42 static const char kGpuAPINameGL[] = "gl"; | 41 static const char kGpuAPINameGL[] = "gl"; |
| 43 static const char kGpuAPINameGLES[] = "gles"; | 42 static const char kGpuAPINameGLES[] = "gles"; |
| 44 | 43 |
| 44 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
| 45 DEFINE_string2(expectations, r, "", | 45 DEFINE_string2(expectations, r, "", |
| 46 "If a directory, compare generated images against images under th
is path. " | 46 "If a directory, compare generated images against images under th
is path. " |
| 47 "If a file, compare generated images against JSON expectations at
this path." | 47 "If a file, compare generated images against JSON expectations at
this path." |
| 48 ); | 48 ); |
| 49 | 49 |
| 50 DEFINE_bool(gms, true, "Run GMs?"); | 50 DEFINE_bool(gms, true, "Run GMs?"); |
| 51 DEFINE_bool(tests, true, "Run tests?"); | 51 DEFINE_bool(tests, true, "Run tests?"); |
| 52 DEFINE_bool(reportUsedChars, false, "Output test font construction data to be pa
sted into" | 52 DEFINE_bool(reportUsedChars, false, "Output test font construction data to be pa
sted into" |
| 53 " create_test_font.cpp."); | 53 " create_test_font.cpp."); |
| 54 | 54 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { | 185 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { |
| 186 *out->append() = reg->factory(); | 186 *out->append() = reg->factory(); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 int dm_main(); | 191 int dm_main(); |
| 192 int dm_main() { | 192 int dm_main() { |
| 193 SetupCrashHandler(); | 193 SetupCrashHandler(); |
| 194 SkAutoGraphics ag; | 194 SkAutoGraphics ag; |
| 195 SkTaskGroup::Enabler enabled(FLAGS_threads); | |
| 196 | 195 |
| 197 if (FLAGS_dryRun) { | 196 if (FLAGS_dryRun) { |
| 198 FLAGS_verbose = true; | 197 FLAGS_verbose = true; |
| 199 } | 198 } |
| 200 #if SK_ENABLE_INST_COUNT | 199 #if SK_ENABLE_INST_COUNT |
| 201 gPrintInstCount = FLAGS_leaks; | 200 gPrintInstCount = FLAGS_leaks; |
| 202 #endif | 201 #endif |
| 203 | 202 |
| 204 SkTArray<SkString> configs; | 203 SkTArray<SkString> configs; |
| 205 for (int i = 0; i < FLAGS_config.count(); i++) { | 204 for (int i = 0; i < FLAGS_config.count(); i++) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 227 if (FLAGS_tests) { | 226 if (FLAGS_tests) { |
| 228 append_matching_factories<Test>(TestRegistry::Head(), &tests); | 227 append_matching_factories<Test>(TestRegistry::Head(), &tests); |
| 229 } | 228 } |
| 230 | 229 |
| 231 SkTArray<SkString> skps; | 230 SkTArray<SkString> skps; |
| 232 find_skps(&skps); | 231 find_skps(&skps); |
| 233 | 232 |
| 234 SkDebugf("%d GMs x %d configs, %d tests, %d pictures\n", | 233 SkDebugf("%d GMs x %d configs, %d tests, %d pictures\n", |
| 235 gms.count(), configs.count(), tests.count(), skps.count()); | 234 gms.count(), configs.count(), tests.count(), skps.count()); |
| 236 DM::Reporter reporter; | 235 DM::Reporter reporter; |
| 237 | 236 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); |
| 238 DM::TaskRunner tasks; | |
| 239 kick_off_tests(tests, &reporter, &tasks); | 237 kick_off_tests(tests, &reporter, &tasks); |
| 240 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); | 238 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); |
| 241 kick_off_skps(skps, &reporter, &tasks); | 239 kick_off_skps(skps, &reporter, &tasks); |
| 242 tasks.wait(); | 240 tasks.wait(); |
| 243 | 241 |
| 244 SkDebugf("\n"); | 242 SkDebugf("\n"); |
| 245 #ifdef SK_DEBUG | 243 #ifdef SK_DEBUG |
| 246 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { | 244 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { |
| 247 sk_tool_utils::report_used_chars(); | 245 sk_tool_utils::report_used_chars(); |
| 248 } | 246 } |
| 249 #endif | 247 #endif |
| 250 | 248 |
| 251 SkTArray<SkString> failures; | 249 SkTArray<SkString> failures; |
| 252 reporter.getFailures(&failures); | 250 reporter.getFailures(&failures); |
| 253 report_failures(failures); | 251 report_failures(failures); |
| 254 return failures.count() > 0; | 252 return failures.count() > 0; |
| 255 } | 253 } |
| 256 | 254 |
| 257 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 255 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 258 int main(int argc, char** argv) { | 256 int main(int argc, char** argv) { |
| 259 SkCommandLineFlags::Parse(argc, argv); | 257 SkCommandLineFlags::Parse(argc, argv); |
| 260 return dm_main(); | 258 return dm_main(); |
| 261 } | 259 } |
| 262 #endif | 260 #endif |
| OLD | NEW |