| 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 14 matching lines...) Expand all Loading... |
| 25 "Multiple matches may be separated by spaces.\n"
\ | 25 "Multiple matches may be separated by spaces.\n"
\ |
| 26 "~ causes a matching test to always be skipped\n"
\ | 26 "~ causes a matching test to always be skipped\n"
\ |
| 27 "^ requires the start of the test to match\n" \ | 27 "^ requires the start of the test to match\n" \ |
| 28 "$ requires the end of the test to match\n" \ | 28 "$ requires the end of the test to match\n" \ |
| 29 "^ and $ requires an exact match\n" \ | 29 "^ and $ requires an exact match\n" \ |
| 30 "If a test does not match any list entry,\n" \ | 30 "If a test does not match any list entry,\n" \ |
| 31 "it is skipped unless some list entry starts with
~"); | 31 "it is skipped unless some list entry starts with
~"); |
| 32 DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use."); | 32 DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use."); |
| 33 DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); | 33 DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); |
| 34 DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); | 34 DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); |
| 35 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); |
| 35 DEFINE_bool2(single, z, false, "run tests on a single thread internally."); | 36 DEFINE_bool2(single, z, false, "run tests on a single thread internally."); |
| 36 DEFINE_bool2(verbose, v, false, "enable verbose output."); | 37 DEFINE_bool2(verbose, v, false, "enable verbose output."); |
| 37 DEFINE_int32(threads, SkThreadPool::kThreadPerCore, | 38 DEFINE_int32(threads, SkThreadPool::kThreadPerCore, |
| 38 "Run threadsafe tests on a threadpool with this many threads."); | 39 "Run threadsafe tests on a threadpool with this many threads."); |
| 39 | 40 |
| 40 // need to explicitly declare this, or we get some weird infinite loop llist | 41 // need to explicitly declare this, or we get some weird infinite loop llist |
| 41 template TestRegistry* TestRegistry::gHead; | 42 template TestRegistry* TestRegistry::gHead; |
| 42 | 43 |
| 43 class Iter { | 44 class Iter { |
| 44 public: | 45 public: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SkAutoTDelete<Test> fTest; | 123 SkAutoTDelete<Test> fTest; |
| 123 int32_t* fFailCount; | 124 int32_t* fFailCount; |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 int tool_main(int argc, char** argv); | 127 int tool_main(int argc, char** argv); |
| 127 int tool_main(int argc, char** argv) { | 128 int tool_main(int argc, char** argv) { |
| 128 SkCommandLineFlags::SetUsage(""); | 129 SkCommandLineFlags::SetUsage(""); |
| 129 SkCommandLineFlags::Parse(argc, argv); | 130 SkCommandLineFlags::Parse(argc, argv); |
| 130 | 131 |
| 131 #if SK_ENABLE_INST_COUNT | 132 #if SK_ENABLE_INST_COUNT |
| 132 gPrintInstCount = true; | 133 if (FLAGS_leaks) { |
| 134 gPrintInstCount = true; |
| 135 } |
| 133 #endif | 136 #endif |
| 134 | 137 |
| 135 SkGraphics::Init(); | 138 SkGraphics::Init(); |
| 136 | 139 |
| 137 { | 140 { |
| 138 SkString header("Skia UnitTests:"); | 141 SkString header("Skia UnitTests:"); |
| 139 if (!FLAGS_match.isEmpty()) { | 142 if (!FLAGS_match.isEmpty()) { |
| 140 header.appendf(" --match"); | 143 header.appendf(" --match"); |
| 141 for (int index = 0; index < FLAGS_match.count(); ++index) { | 144 for (int index = 0; index < FLAGS_match.count(); ++index) { |
| 142 header.appendf(" %s", FLAGS_match[index]); | 145 header.appendf(" %s", FLAGS_match[index]); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 215 |
| 213 SkDebugf("\n"); | 216 SkDebugf("\n"); |
| 214 return (failCount == 0) ? 0 : 1; | 217 return (failCount == 0) ? 0 : 1; |
| 215 } | 218 } |
| 216 | 219 |
| 217 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 220 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 218 int main(int argc, char * const argv[]) { | 221 int main(int argc, char * const argv[]) { |
| 219 return tool_main(argc, (char**) argv); | 222 return tool_main(argc, (char**) argv); |
| 220 } | 223 } |
| 221 #endif | 224 #endif |
| OLD | NEW |