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 "SkBenchmark.h" | 4 #include "SkBenchmark.h" |
5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.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 "DMBenchTask.h" | 13 #include "DMBenchTask.h" |
14 #include "DMCpuGMTask.h" | 14 #include "DMCpuGMTask.h" |
15 #include "DMGpuGMTask.h" | 15 #include "DMGpuGMTask.h" |
16 #include "DMGpuSupport.h" | 16 #include "DMGpuSupport.h" |
17 #include "DMReporter.h" | 17 #include "DMReporter.h" |
18 #include "DMSKPTask.h" | 18 #include "DMSKPTask.h" |
19 #include "DMTask.h" | 19 #include "DMTask.h" |
20 #include "DMTaskRunner.h" | 20 #include "DMTaskRunner.h" |
21 #include "DMTestTask.h" | 21 #include "DMTestTask.h" |
22 #include "DMWriteTask.h" | 22 #include "DMWriteTask.h" |
23 | 23 |
24 #include <string.h> | 24 #include <ctype.h> |
25 | 25 |
26 using skiagm::GM; | 26 using skiagm::GM; |
27 using skiagm::GMRegistry; | 27 using skiagm::GMRegistry; |
28 using skiatest::Test; | 28 using skiatest::Test; |
29 using skiatest::TestRegistry; | 29 using skiatest::TestRegistry; |
30 | 30 |
31 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); | 31 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); |
32 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); | 32 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
33 DEFINE_string2(expectations, r, "", | 33 DEFINE_string2(expectations, r, "", |
34 "If a directory, compare generated images against images under th
is path. " | 34 "If a directory, compare generated images against images under th
is path. " |
35 "If a file, compare generated images against JSON expectations at
this path."); | 35 #ifdef SK_BUILD_JSON_WRITER |
| 36 "If a file, compare generated images against JSON expectations at
this path." |
| 37 #endif |
| 38 ); |
36 DEFINE_string2(resources, i, "resources", "Path to resources directory."); | 39 DEFINE_string2(resources, i, "resources", "Path to resources directory."); |
37 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" | 40 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" |
38 "Multiple matches may be separated by spaces.\n" | 41 "Multiple matches may be separated by spaces.\n" |
39 "~ causes a matching GM to always be skipped\n" | 42 "~ causes a matching GM to always be skipped\n" |
40 "^ requires the start of the GM to match\n" | 43 "^ requires the start of the GM to match\n" |
41 "$ requires the end of the GM to match\n" | 44 "$ requires the end of the GM to match\n" |
42 "^ and $ requires an exact match\n" | 45 "^ and $ requires an exact match\n" |
43 "If a GM does not match any list entry,\n" | 46 "If a GM does not match any list entry,\n" |
44 "it is skipped unless some list entry starts with ~"); | 47 "it is skipped unless some list entry starts with ~"); |
45 DEFINE_string(config, "565 8888 gpu nonrendering", | 48 DEFINE_string(config, "565 8888 gpu nonrendering", |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 SkTDArray<GMRegistry::Factory> gms; | 221 SkTDArray<GMRegistry::Factory> gms; |
219 SkAutoTDelete<DM::Expectations> expectations(SkNEW(DM::NoExpectations)); | 222 SkAutoTDelete<DM::Expectations> expectations(SkNEW(DM::NoExpectations)); |
220 if (FLAGS_gms) { | 223 if (FLAGS_gms) { |
221 append_matching_factories<GM>(GMRegistry::Head(), &gms); | 224 append_matching_factories<GM>(GMRegistry::Head(), &gms); |
222 | 225 |
223 if (FLAGS_expectations.count() > 0) { | 226 if (FLAGS_expectations.count() > 0) { |
224 const char* path = FLAGS_expectations[0]; | 227 const char* path = FLAGS_expectations[0]; |
225 if (sk_isdir(path)) { | 228 if (sk_isdir(path)) { |
226 expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path
))); | 229 expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path
))); |
227 } else { | 230 } else { |
| 231 #ifdef SK_BUILD_JSON_WRITER |
228 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); | 232 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); |
| 233 #endif |
229 } | 234 } |
230 } | 235 } |
231 } | 236 } |
232 | 237 |
233 SkTDArray<BenchRegistry::Factory> benches; | 238 SkTDArray<BenchRegistry::Factory> benches; |
234 if (FLAGS_benches) { | 239 if (FLAGS_benches) { |
235 append_matching_factories<SkBenchmark>(BenchRegistry::Head(), &benches); | 240 append_matching_factories<SkBenchmark>(BenchRegistry::Head(), &benches); |
236 } | 241 } |
237 | 242 |
238 SkTDArray<TestRegistry::Factory> tests; | 243 SkTDArray<TestRegistry::Factory> tests; |
(...skipping 17 matching lines...) Expand all Loading... |
256 SkGraphics::Term(); | 261 SkGraphics::Term(); |
257 | 262 |
258 return reporter.failed() > 0; | 263 return reporter.failed() > 0; |
259 } | 264 } |
260 | 265 |
261 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 266 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
262 int main(int argc, char** argv) { | 267 int main(int argc, char** argv) { |
263 return tool_main(argc, argv); | 268 return tool_main(argc, argv); |
264 } | 269 } |
265 #endif | 270 #endif |
OLD | NEW |