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 "SkOSFile.h" |
9 #include "SkPicture.h" | 10 #include "SkPicture.h" |
10 #include "SkString.h" | 11 #include "SkString.h" |
11 #include "SkTaskGroup.h" | 12 #include "SkTaskGroup.h" |
12 #include "Test.h" | 13 #include "Test.h" |
13 #include "gm.h" | 14 #include "gm.h" |
14 #include "sk_tool_utils.h" | 15 #include "sk_tool_utils.h" |
15 #include "sk_tool_utils_flags.h" | 16 #include "sk_tool_utils_flags.h" |
16 | 17 |
17 #include "DMCpuGMTask.h" | 18 #include "DMCpuGMTask.h" |
18 #include "DMGpuGMTask.h" | 19 #include "DMGpuGMTask.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 gPrintInstCount = FLAGS_leaks; | 202 gPrintInstCount = FLAGS_leaks; |
202 #endif | 203 #endif |
203 | 204 |
204 SkTArray<SkString> configs; | 205 SkTArray<SkString> configs; |
205 for (int i = 0; i < FLAGS_config.count(); i++) { | 206 for (int i = 0; i < FLAGS_config.count(); i++) { |
206 SkStrSplit(FLAGS_config[i], ", ", &configs); | 207 SkStrSplit(FLAGS_config[i], ", ", &configs); |
207 } | 208 } |
208 | 209 |
209 GrGLStandard gpuAPI = get_gl_standard(); | 210 GrGLStandard gpuAPI = get_gl_standard(); |
210 | 211 |
211 SkTDArray<GMRegistry::Factory> gms; | 212 SkAutoTDelete<DM::Expectations> expectations(SkNEW(DM::Expectations)); |
212 SkAutoTDelete<DM::Expectations> expectations(SkNEW(DM::NoExpectations)); | 213 if (FLAGS_expectations.count() > 0) { |
213 if (FLAGS_gms) { | 214 expectations.reset(DM::WriteTask::Expectations::Create(FLAGS_expectation
s[0])); |
214 append_matching_factories<GM>(GMRegistry::Head(), &gms); | 215 if (!expectations.get()) { |
215 | 216 return 1; |
216 if (FLAGS_expectations.count() > 0) { | |
217 const char* path = FLAGS_expectations[0]; | |
218 if (sk_isdir(path)) { | |
219 expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path
))); | |
220 } else { | |
221 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); | |
222 } | |
223 } | 217 } |
224 } | 218 } |
225 | 219 |
| 220 SkTDArray<GMRegistry::Factory> gms; |
| 221 if (FLAGS_gms) { |
| 222 append_matching_factories<GM>(GMRegistry::Head(), &gms); |
| 223 } |
| 224 |
226 SkTDArray<TestRegistry::Factory> tests; | 225 SkTDArray<TestRegistry::Factory> tests; |
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 |
238 DM::TaskRunner tasks; | 237 DM::TaskRunner tasks; |
239 kick_off_tests(tests, &reporter, &tasks); | 238 kick_off_tests(tests, &reporter, &tasks); |
240 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); | 239 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); |
241 kick_off_skps(skps, &reporter, &tasks); | 240 kick_off_skps(skps, &reporter, &tasks); |
242 tasks.wait(); | 241 tasks.wait(); |
243 | 242 |
| 243 DM::WriteTask::DumpJson(); |
| 244 |
244 SkDebugf("\n"); | 245 SkDebugf("\n"); |
245 #ifdef SK_DEBUG | 246 #ifdef SK_DEBUG |
246 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { | 247 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { |
247 sk_tool_utils::report_used_chars(); | 248 sk_tool_utils::report_used_chars(); |
248 } | 249 } |
249 #endif | 250 #endif |
250 | 251 |
251 SkTArray<SkString> failures; | 252 SkTArray<SkString> failures; |
252 reporter.getFailures(&failures); | 253 reporter.getFailures(&failures); |
253 report_failures(failures); | 254 report_failures(failures); |
254 return failures.count() > 0; | 255 return failures.count() > 0; |
255 } | 256 } |
256 | 257 |
257 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 258 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
258 int main(int argc, char** argv) { | 259 int main(int argc, char** argv) { |
259 SkCommandLineFlags::Parse(argc, argv); | 260 SkCommandLineFlags::Parse(argc, argv); |
260 return dm_main(); | 261 return dm_main(); |
261 } | 262 } |
262 #endif | 263 #endif |
OLD | NEW |