Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: dm/DM.cpp

Issue 421713002: dm prints out number of matching skp files (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkCommonFlags.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"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (int i = 0; i < tests.count(); i++) { 112 for (int i = 0; i < tests.count(); i++) {
113 SkAutoTDelete<Test> test(tests[i](NULL)); 113 SkAutoTDelete<Test> test(tests[i](NULL));
114 if (test->isGPUTest()) { 114 if (test->isGPUTest()) {
115 tasks->add(SkNEW_ARGS(DM::GpuTestTask, (reporter, tasks, tests[i]))) ; 115 tasks->add(SkNEW_ARGS(DM::GpuTestTask, (reporter, tasks, tests[i]))) ;
116 } else { 116 } else {
117 tasks->add(SkNEW_ARGS(DM::CpuTestTask, (reporter, tasks, tests[i]))) ; 117 tasks->add(SkNEW_ARGS(DM::CpuTestTask, (reporter, tasks, tests[i]))) ;
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 static void kick_off_skps(DM::Reporter* reporter, DM::TaskRunner* tasks) { 122 static void find_skps(SkTArray<SkString>* skps) {
123 if (FLAGS_skps.isEmpty()) { 123 if (FLAGS_skps.isEmpty()) {
124 return; 124 return;
125 } 125 }
126 126
127 SkOSFile::Iter it(FLAGS_skps[0], ".skp"); 127 SkOSFile::Iter it(FLAGS_skps[0], ".skp");
128 SkString filename; 128 SkString filename;
129 while (it.next(&filename)) { 129 while (it.next(&filename)) {
130 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) { 130 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) {
131 continue; 131 skps->push_back(
132 SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str()));
132 } 133 }
134 }
135 }
133 136
134 const SkString path = SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str ()); 137 static void kick_off_skps(const SkTArray<SkString>& skps,
135 138 DM::Reporter* reporter, DM::TaskRunner* tasks) {
136 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path.c_str())); 139 for (int i = 0; i < skps.count(); ++i) {
140 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(skps[i].c_str()));
137 if (stream.get() == NULL) { 141 if (stream.get() == NULL) {
138 SkDebugf("Could not read %s.\n", path.c_str()); 142 SkDebugf("Could not read %s.\n", skps[i].c_str());
139 exit(1); 143 exit(1);
140 } 144 }
141 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream.get())); 145 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream.get()));
142 if (pic.get() == NULL) { 146 if (pic.get() == NULL) {
143 SkDebugf("Could not read %s as an SkPicture.\n", path.c_str()); 147 SkDebugf("Could not read %s as an SkPicture.\n", skps[i].c_str());
144 exit(1); 148 exit(1);
145 } 149 }
146 150
151 SkString filename = SkOSPath::SkBasename(skps[i].c_str());
147 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename))); 152 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename)));
148 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename, 153 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename,
149 RASTERIZE_PDF_PROC))); 154 RASTERIZE_PDF_PROC)));
150 } 155 }
151 } 156 }
152 157
153 static void report_failures(const SkTArray<SkString>& failures) { 158 static void report_failures(const SkTArray<SkString>& failures) {
154 if (failures.count() == 0) { 159 if (failures.count() == 0) {
155 return; 160 return;
156 } 161 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); 219 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path)));
215 } 220 }
216 } 221 }
217 } 222 }
218 223
219 SkTDArray<TestRegistry::Factory> tests; 224 SkTDArray<TestRegistry::Factory> tests;
220 if (FLAGS_tests) { 225 if (FLAGS_tests) {
221 append_matching_factories<Test>(TestRegistry::Head(), &tests); 226 append_matching_factories<Test>(TestRegistry::Head(), &tests);
222 } 227 }
223 228
224 SkDebugf("%d GMs x %d configs, %d tests\n", 229 SkTArray<SkString> skps;
225 gms.count(), configs.count(), tests.count()); 230 find_skps(&skps);
231
232 SkDebugf("%d GMs x %d configs, %d tests, %d pictures\n",
233 gms.count(), configs.count(), tests.count(), skps.count());
226 DM::Reporter reporter; 234 DM::Reporter reporter;
227 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); 235 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads);
228 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); 236 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks);
229 kick_off_tests(tests, &reporter, &tasks); 237 kick_off_tests(tests, &reporter, &tasks);
230 kick_off_skps(&reporter, &tasks); 238 kick_off_skps(skps, &reporter, &tasks);
231 tasks.wait(); 239 tasks.wait();
232 240
233 SkDebugf("\n"); 241 SkDebugf("\n");
234 242
235 SkTArray<SkString> failures; 243 SkTArray<SkString> failures;
236 reporter.getFailures(&failures); 244 reporter.getFailures(&failures);
237 report_failures(failures); 245 report_failures(failures);
238 return failures.count() > 0; 246 return failures.count() > 0;
239 } 247 }
240 248
241 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 249 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
242 int main(int argc, char** argv) { 250 int main(int argc, char** argv) {
243 SkCommandLineFlags::Parse(argc, argv); 251 SkCommandLineFlags::Parse(argc, argv);
244 return dm_main(); 252 return dm_main();
245 } 253 }
246 #endif 254 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698