| 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 "OverwriteLine.h" | 8 #include "OverwriteLine.h" |
| 9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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(leaks, l, false, "show leaked ref cnt'd objects."); |
| 36 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."); |
| 37 DEFINE_bool2(verbose, v, false, "enable verbose output."); | 37 DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver."); |
| 38 DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose."); |
| 38 DEFINE_int32(threads, SkThreadPool::kThreadPerCore, | 39 DEFINE_int32(threads, SkThreadPool::kThreadPerCore, |
| 39 "Run threadsafe tests on a threadpool with this many threads."); | 40 "Run threadsafe tests on a threadpool with this many threads."); |
| 40 | 41 |
| 41 // need to explicitly declare this, or we get some weird infinite loop llist | 42 // need to explicitly declare this, or we get some weird infinite loop llist |
| 42 template TestRegistry* TestRegistry::gHead; | 43 template TestRegistry* TestRegistry::gHead; |
| 43 | 44 |
| 44 class Iter { | 45 class Iter { |
| 45 public: | 46 public: |
| 46 Iter() { this->reset(); } | 47 Iter() { this->reset(); } |
| 47 void reset() { fReg = TestRegistry::Head(); } | 48 void reset() { fReg = TestRegistry::Head(); } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 private: | 61 private: |
| 61 const TestRegistry* fReg; | 62 const TestRegistry* fReg; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 class DebugfReporter : public Reporter { | 65 class DebugfReporter : public Reporter { |
| 65 public: | 66 public: |
| 66 explicit DebugfReporter(int total) : fDone(0), fTotal(total) {} | 67 explicit DebugfReporter(int total) : fDone(0), fTotal(total) {} |
| 67 | 68 |
| 68 virtual bool allowExtendedTest() const SK_OVERRIDE { return FLAGS_extendedTe
st; } | 69 virtual bool allowExtendedTest() const SK_OVERRIDE { return FLAGS_extendedTe
st; } |
| 69 virtual bool allowThreaded() const SK_OVERRIDE { return !FLAGS_single; } | 70 virtual bool allowThreaded() const SK_OVERRIDE { return !FLAGS_single; } |
| 70 virtual bool verbose() const SK_OVERRIDE { return FLAGS_verbose; } | 71 virtual bool verbose() const SK_OVERRIDE { return FLAGS_veryVerbos
e; } |
| 71 | 72 |
| 72 protected: | 73 protected: |
| 73 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE { | 74 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE { |
| 74 SkDebugf("\nFAILED: %s", desc.c_str()); | 75 SkDebugf("\nFAILED: %s", desc.c_str()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 virtual void onEnd(Test* test) SK_OVERRIDE { | 78 virtual void onEnd(Test* test) SK_OVERRIDE { |
| 78 const int done = 1 + sk_atomic_inc(&fDone); | 79 const int done = 1 + sk_atomic_inc(&fDone); |
| 79 | 80 |
| 80 if (!test->passed()) { | 81 if (!test->passed()) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 216 |
| 216 SkDebugf("\n"); | 217 SkDebugf("\n"); |
| 217 return (failCount == 0) ? 0 : 1; | 218 return (failCount == 0) ? 0 : 1; |
| 218 } | 219 } |
| 219 | 220 |
| 220 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 221 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 221 int main(int argc, char * const argv[]) { | 222 int main(int argc, char * const argv[]) { |
| 222 return tool_main(argc, (char**) argv); | 223 return tool_main(argc, (char**) argv); |
| 223 } | 224 } |
| 224 #endif | 225 #endif |
| OLD | NEW |