| 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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
| 9 #include "OverwriteLine.h" | 9 #include "OverwriteLine.h" |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| 11 #include "SkCommandLineFlags.h" | 11 #include "SkCommonFlags.h" |
| 12 #include "SkGraphics.h" | 12 #include "SkGraphics.h" |
| 13 #include "SkOSFile.h" | 13 #include "SkOSFile.h" |
| 14 #include "SkTArray.h" | 14 #include "SkTArray.h" |
| 15 #include "SkTemplates.h" | 15 #include "SkTemplates.h" |
| 16 #include "SkThreadPool.h" | 16 #include "SkThreadPool.h" |
| 17 #include "SkTime.h" | 17 #include "SkTime.h" |
| 18 #include "Test.h" | 18 #include "Test.h" |
| 19 | 19 |
| 20 #if SK_SUPPORT_GPU | 20 #if SK_SUPPORT_GPU |
| 21 #include "GrContext.h" | 21 #include "GrContext.h" |
| 22 #include "GrContextFactory.h" | 22 #include "GrContextFactory.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 using namespace skiatest; | 25 using namespace skiatest; |
| 26 | 26 |
| 27 DEFINE_string2(match, m, NULL, "[~][^]substring[$] [...] of test name to run.\n"
\ | |
| 28 "Multiple matches may be separated by spaces.\n"
\ | |
| 29 "~ causes a matching test to always be skipped\n"
\ | |
| 30 "^ requires the start of the test to match\n" \ | |
| 31 "$ requires the end of the test to match\n" \ | |
| 32 "^ and $ requires an exact match\n" \ | |
| 33 "If a test does not match any list entry,\n" \ | |
| 34 "it is skipped unless some list entry starts with
~"); | |
| 35 DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); | 27 DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); |
| 36 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); | |
| 37 DEFINE_bool2(single, z, false, "run tests on a single thread internally."); | |
| 38 DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver."); | |
| 39 DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose."); | |
| 40 DEFINE_bool(cpu, true, "whether or not to run CPU tests."); | |
| 41 DEFINE_bool(gpu, true, "whether or not to run GPU tests."); | |
| 42 DEFINE_int32(threads, SkThreadPool::kThreadPerCore, | |
| 43 "Run threadsafe tests on a threadpool with this many threads."); | |
| 44 | 28 |
| 45 // need to explicitly declare this, or we get some weird infinite loop llist | 29 // need to explicitly declare this, or we get some weird infinite loop llist |
| 46 template TestRegistry* TestRegistry::gHead; | 30 template TestRegistry* TestRegistry::gHead; |
| 47 | 31 |
| 48 class Iter { | 32 class Iter { |
| 49 public: | 33 public: |
| 50 Iter() { this->reset(); } | 34 Iter() { this->reset(); } |
| 51 void reset() { fReg = TestRegistry::Head(); } | 35 void reset() { fReg = TestRegistry::Head(); } |
| 52 | 36 |
| 53 Test* next(Reporter* r) { | 37 Test* next(Reporter* r) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 108 } |
| 125 if (!FLAGS_cpu && !isGPUTest) { | 109 if (!FLAGS_cpu && !isGPUTest) { |
| 126 return false; | 110 return false; |
| 127 } | 111 } |
| 128 if (!FLAGS_gpu && isGPUTest) { | 112 if (!FLAGS_gpu && isGPUTest) { |
| 129 return false; | 113 return false; |
| 130 } | 114 } |
| 131 return true; | 115 return true; |
| 132 } | 116 } |
| 133 | 117 |
| 134 int tool_main(int argc, char** argv); | 118 int test_main(); |
| 135 int tool_main(int argc, char** argv) { | 119 int test_main() { |
| 136 SetupCrashHandler(); | 120 SetupCrashHandler(); |
| 137 SkCommandLineFlags::SetUsage(""); | |
| 138 SkCommandLineFlags::Parse(argc, argv); | |
| 139 | 121 |
| 140 #if SK_ENABLE_INST_COUNT | 122 #if SK_ENABLE_INST_COUNT |
| 141 if (FLAGS_leaks) { | 123 if (FLAGS_leaks) { |
| 142 gPrintInstCount = true; | 124 gPrintInstCount = true; |
| 143 } | 125 } |
| 144 #endif | 126 #endif |
| 145 | 127 |
| 146 SkGraphics::Init(); | 128 SkGraphics::Init(); |
| 147 | 129 |
| 148 { | 130 { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 SkDebugf("\nFinished %d tests, %d failures, %d skipped. (%d internal tes
ts)", | 210 SkDebugf("\nFinished %d tests, %d failures, %d skipped. (%d internal tes
ts)", |
| 229 toRun, failCount, skipCount, reporter.countTests()); | 211 toRun, failCount, skipCount, reporter.countTests()); |
| 230 } | 212 } |
| 231 SkGraphics::Term(); | 213 SkGraphics::Term(); |
| 232 | 214 |
| 233 SkDebugf("\n"); | 215 SkDebugf("\n"); |
| 234 return (failCount == 0) ? 0 : 1; | 216 return (failCount == 0) ? 0 : 1; |
| 235 } | 217 } |
| 236 | 218 |
| 237 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 219 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 238 int main(int argc, char * const argv[]) { | 220 int main(int argc, char** argv) { |
| 239 return tool_main(argc, (char**) argv); | 221 SkCommandLineFlags::Parse(argc, argv); |
| 222 return test_main(); |
| 240 } | 223 } |
| 241 #endif | 224 #endif |
| OLD | NEW |