OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 DebugfReporter reporter(FLAGS_extendedTest, !FLAGS_single, FLAGS_verbose); | 203 DebugfReporter reporter(FLAGS_extendedTest, !FLAGS_single, FLAGS_verbose); |
204 Iter iter(&reporter); | 204 Iter iter(&reporter); |
205 | 205 |
206 // Count tests first. | 206 // Count tests first. |
207 int total = 0; | 207 int total = 0; |
208 int toRun = 0; | 208 int toRun = 0; |
209 Test* test; | 209 Test* test; |
210 | 210 |
211 SkTDArray<const char*> matchStrs; | |
212 for(int i = 0; i < FLAGS_match.count(); ++i) { | |
213 matchStrs.push(FLAGS_match[i]); | |
214 } | |
215 | |
216 while ((test = iter.next()) != NULL) { | 211 while ((test = iter.next()) != NULL) { |
217 SkAutoTDelete<Test> owned(test); | 212 SkAutoTDelete<Test> owned(test); |
218 | 213 |
219 if(!SkCommandLineFlags::ShouldSkip(matchStrs, test->getName())) { | 214 if(!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) { |
220 toRun++; | 215 toRun++; |
221 } | 216 } |
222 total++; | 217 total++; |
223 } | 218 } |
224 reporter.setTotal(toRun); | 219 reporter.setTotal(toRun); |
225 | 220 |
226 // Now run them. | 221 // Now run them. |
227 iter.reset(); | 222 iter.reset(); |
228 int32_t failCount = 0; | 223 int32_t failCount = 0; |
229 int skipCount = 0; | 224 int skipCount = 0; |
230 | 225 |
231 SkAutoTDelete<SkThreadPool> threadpool(SkNEW_ARGS(SkThreadPool, (FLAGS_threa
ds))); | 226 SkAutoTDelete<SkThreadPool> threadpool(SkNEW_ARGS(SkThreadPool, (FLAGS_threa
ds))); |
232 SkTArray<Test*> unsafeTests; // Always passes ownership to an SkTestRunnabl
e | 227 SkTArray<Test*> unsafeTests; // Always passes ownership to an SkTestRunnabl
e |
233 for (int i = 0; i < total; i++) { | 228 for (int i = 0; i < total; i++) { |
234 SkAutoTDelete<Test> test(iter.next()); | 229 SkAutoTDelete<Test> test(iter.next()); |
235 if (SkCommandLineFlags::ShouldSkip(matchStrs, test->getName())) { | 230 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) { |
236 ++skipCount; | 231 ++skipCount; |
237 } else if (!test->isThreadsafe()) { | 232 } else if (!test->isThreadsafe()) { |
238 unsafeTests.push_back() = test.detach(); | 233 unsafeTests.push_back() = test.detach(); |
239 } else { | 234 } else { |
240 threadpool->add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCoun
t))); | 235 threadpool->add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCoun
t))); |
241 } | 236 } |
242 } | 237 } |
243 | 238 |
244 // Run the tests that aren't threadsafe. | 239 // Run the tests that aren't threadsafe. |
245 for (int i = 0; i < unsafeTests.count(); i++) { | 240 for (int i = 0; i < unsafeTests.count(); i++) { |
(...skipping 23 matching lines...) Expand all Loading... |
269 GpuTest::DestroyContexts(); | 264 GpuTest::DestroyContexts(); |
270 | 265 |
271 return (failCount == 0) ? 0 : 1; | 266 return (failCount == 0) ? 0 : 1; |
272 } | 267 } |
273 | 268 |
274 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 269 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
275 int main(int argc, char * const argv[]) { | 270 int main(int argc, char * const argv[]) { |
276 return tool_main(argc, (char**) argv); | 271 return tool_main(argc, (char**) argv); |
277 } | 272 } |
278 #endif | 273 #endif |
OLD | NEW |