epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 7 | |
scroggo@google.com | 5a6324e | 2013-04-11 20:11:40 +0000 | [diff] [blame] | 8 | #include "SkCommandLineFlags.h" |
reed@android.com | 5e5adfd | 2009-03-07 03:39:23 +0000 | [diff] [blame] | 9 | #include "SkGraphics.h" |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 10 | #include "SkOSFile.h" |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 11 | #include "SkRunnable.h" |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 12 | #include "SkTArray.h" |
| 13 | #include "SkTemplates.h" |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 14 | #include "SkThreadPool.h" |
| 15 | #include "SkTime.h" |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 16 | #include "Test.h" |
| 17 | |
robertphillips@google.com | bdb1be5 | 2012-09-07 18:24:43 +0000 | [diff] [blame] | 18 | #if SK_SUPPORT_GPU |
| 19 | #include "GrContext.h" |
| 20 | #endif |
| 21 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 22 | using namespace skiatest; |
| 23 | |
reed@android.com | d252db0 | 2009-04-01 18:31:44 +0000 | [diff] [blame] | 24 | // need to explicitly declare this, or we get some weird infinite loop llist |
| 25 | template TestRegistry* TestRegistry::gHead; |
| 26 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 27 | class Iter { |
| 28 | public: |
| 29 | Iter(Reporter* r) : fReporter(r) { |
| 30 | r->ref(); |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 31 | this->reset(); |
| 32 | } |
| 33 | |
| 34 | void reset() { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 35 | fReg = TestRegistry::Head(); |
| 36 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 37 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 38 | ~Iter() { |
| 39 | fReporter->unref(); |
| 40 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 41 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 42 | Test* next() { |
| 43 | if (fReg) { |
| 44 | TestRegistry::Factory fact = fReg->factory(); |
| 45 | fReg = fReg->next(); |
| 46 | Test* test = fact(NULL); |
| 47 | test->setReporter(fReporter); |
| 48 | return test; |
| 49 | } |
| 50 | return NULL; |
| 51 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 52 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 53 | private: |
| 54 | Reporter* fReporter; |
| 55 | const TestRegistry* fReg; |
| 56 | }; |
| 57 | |
reed@android.com | d252db0 | 2009-04-01 18:31:44 +0000 | [diff] [blame] | 58 | class DebugfReporter : public Reporter { |
reed@android.com | 57b799e | 2009-04-01 20:26:42 +0000 | [diff] [blame] | 59 | public: |
caryclark@google.com | 07e97fc | 2013-07-08 17:17:02 +0000 | [diff] [blame] | 60 | DebugfReporter(bool allowExtendedTest, bool allowThreaded, bool verbose) |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 61 | : fNextIndex(0) |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 62 | , fPending(0) |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 63 | , fTotal(0) |
caryclark@google.com | 16cfe40 | 2013-04-18 18:47:37 +0000 | [diff] [blame] | 64 | , fAllowExtendedTest(allowExtendedTest) |
caryclark@google.com | 07e97fc | 2013-07-08 17:17:02 +0000 | [diff] [blame] | 65 | , fAllowThreaded(allowThreaded) |
| 66 | , fVerbose(verbose) { |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 67 | } |
reed@android.com | eeb3b7f | 2009-04-09 04:06:54 +0000 | [diff] [blame] | 68 | |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 69 | void setTotal(int total) { |
reed@android.com | 57b799e | 2009-04-01 20:26:42 +0000 | [diff] [blame] | 70 | fTotal = total; |
| 71 | } |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 72 | |
commit-bot@chromium.org | e1c5429 | 2013-04-22 17:35:55 +0000 | [diff] [blame] | 73 | virtual bool allowExtendedTest() const SK_OVERRIDE { |
skia.committer@gmail.com | 391ca66 | 2013-04-11 07:01:45 +0000 | [diff] [blame] | 74 | return fAllowExtendedTest; |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 75 | } |
| 76 | |
commit-bot@chromium.org | e1c5429 | 2013-04-22 17:35:55 +0000 | [diff] [blame] | 77 | virtual bool allowThreaded() const SK_OVERRIDE { |
caryclark@google.com | 16cfe40 | 2013-04-18 18:47:37 +0000 | [diff] [blame] | 78 | return fAllowThreaded; |
| 79 | } |
| 80 | |
caryclark@google.com | 07e97fc | 2013-07-08 17:17:02 +0000 | [diff] [blame] | 81 | virtual bool verbose() const SK_OVERRIDE { |
| 82 | return fVerbose; |
| 83 | } |
| 84 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 85 | protected: |
| 86 | virtual void onStart(Test* test) { |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 87 | const int index = sk_atomic_inc(&fNextIndex); |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 88 | sk_atomic_inc(&fPending); |
| 89 | SkDebugf("[%3d/%3d] (%d) %s\n", index+1, fTotal, fPending, test->getName()); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 90 | } |
commit-bot@chromium.org | 1f79286 | 2013-06-18 20:50:34 +0000 | [diff] [blame] | 91 | virtual void onReportFailed(const SkString& desc) { |
| 92 | SkDebugf("\tFAILED: %s\n", desc.c_str()); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 93 | } |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 94 | |
| 95 | virtual void onEnd(Test* test) { |
| 96 | if (!test->passed()) { |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 97 | SkDebugf("---- %s FAILED\n", test->getName()); |
| 98 | } |
| 99 | |
| 100 | sk_atomic_dec(&fPending); |
| 101 | if (fNextIndex == fTotal) { |
| 102 | // Just waiting on straggler tests. Shame them by printing their name and runtime. |
| 103 | SkDebugf(" (%d) %5.1fs %s\n", |
| 104 | fPending, test->elapsedMs() / 1e3, test->getName()); |
reed@android.com | eeb3b7f | 2009-04-09 04:06:54 +0000 | [diff] [blame] | 105 | } |
| 106 | } |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 107 | |
djsollen@google.com | f4d1b39 | 2012-11-29 16:29:58 +0000 | [diff] [blame] | 108 | private: |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 109 | int32_t fNextIndex; |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 110 | int32_t fPending; |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 111 | int fTotal; |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 112 | bool fAllowExtendedTest; |
caryclark@google.com | 16cfe40 | 2013-04-18 18:47:37 +0000 | [diff] [blame] | 113 | bool fAllowThreaded; |
caryclark@google.com | 07e97fc | 2013-07-08 17:17:02 +0000 | [diff] [blame] | 114 | bool fVerbose; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 115 | }; |
| 116 | |
caryclark@google.com | b631eec | 2013-05-02 13:14:40 +0000 | [diff] [blame] | 117 | DEFINE_string2(match, m, NULL, "[~][^]substring[$] [...] of test name to run.\n" \ |
| 118 | "Multiple matches may be separated by spaces.\n" \ |
| 119 | "~ causes a matching test to always be skipped\n" \ |
| 120 | "^ requires the start of the test to match\n" \ |
| 121 | "$ requires the end of the test to match\n" \ |
| 122 | "^ and $ requires an exact match\n" \ |
| 123 | "If a test does not match any list entry,\n" \ |
| 124 | "it is skipped unless some list entry starts with ~"); |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 125 | DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use."); |
| 126 | DEFINE_string2(resourcePath, i, NULL, "directory for test resources."); |
| 127 | DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); |
caryclark@google.com | 8d0a524 | 2013-07-16 16:11:16 +0000 | [diff] [blame] | 128 | DEFINE_bool2(single, z, false, "run tests on a single thread internally."); |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 129 | DEFINE_bool2(verbose, v, false, "enable verbose output."); |
commit-bot@chromium.org | 44c661f | 2013-04-22 15:23:14 +0000 | [diff] [blame] | 130 | DEFINE_int32(threads, SkThreadPool::kThreadPerCore, |
| 131 | "Run threadsafe tests on a threadpool with this many threads."); |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 132 | |
scroggo@google.com | c76218d | 2013-06-06 14:59:56 +0000 | [diff] [blame] | 133 | SkString Test::GetTmpDir() { |
| 134 | const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; |
| 135 | return SkString(tmpDir); |
| 136 | } |
| 137 | |
| 138 | SkString Test::GetResourcePath() { |
| 139 | const char* resourcePath = FLAGS_resourcePath.isEmpty() ? NULL : FLAGS_resourcePath[0]; |
| 140 | return SkString(resourcePath); |
| 141 | } |
| 142 | |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 143 | // Deletes self when run. |
| 144 | class SkTestRunnable : public SkRunnable { |
| 145 | public: |
| 146 | // Takes ownership of test. |
| 147 | SkTestRunnable(Test* test, int32_t* failCount) : fTest(test), fFailCount(failCount) {} |
| 148 | |
| 149 | virtual void run() { |
| 150 | fTest->run(); |
| 151 | if(!fTest->passed()) { |
| 152 | sk_atomic_inc(fFailCount); |
| 153 | } |
| 154 | SkDELETE(this); |
| 155 | } |
| 156 | |
| 157 | private: |
| 158 | SkAutoTDelete<Test> fTest; |
| 159 | int32_t* fFailCount; |
| 160 | }; |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 161 | |
caryclark@google.com | b631eec | 2013-05-02 13:14:40 +0000 | [diff] [blame] | 162 | /* Takes a list of the form [~][^]match[$] |
| 163 | ~ causes a matching test to always be skipped |
| 164 | ^ requires the start of the test to match |
| 165 | $ requires the end of the test to match |
| 166 | ^ and $ requires an exact match |
| 167 | If a test does not match any list entry, it is skipped unless some list entry starts with ~ |
| 168 | */ |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 169 | static bool shouldSkip(const char* testName) { |
caryclark@google.com | b631eec | 2013-05-02 13:14:40 +0000 | [diff] [blame] | 170 | int count = FLAGS_match.count(); |
| 171 | size_t testLen = strlen(testName); |
caryclark@google.com | 89d1827 | 2013-05-02 14:23:07 +0000 | [diff] [blame] | 172 | bool anyExclude = count == 0; |
caryclark@google.com | b631eec | 2013-05-02 13:14:40 +0000 | [diff] [blame] | 173 | for (int index = 0; index < count; ++index) { |
| 174 | const char* matchName = FLAGS_match[index]; |
| 175 | size_t matchLen = strlen(matchName); |
| 176 | bool matchExclude, matchStart, matchEnd; |
| 177 | if ((matchExclude = matchName[0] == '~')) { |
| 178 | anyExclude = true; |
| 179 | matchName++; |
| 180 | matchLen--; |
| 181 | } |
| 182 | if ((matchStart = matchName[0] == '^')) { |
| 183 | matchName++; |
| 184 | matchLen--; |
| 185 | } |
| 186 | if ((matchEnd = matchName[matchLen - 1] == '$')) { |
| 187 | matchLen--; |
| 188 | } |
| 189 | if (matchStart ? (!matchEnd || matchLen == testLen) |
| 190 | && strncmp(testName, matchName, matchLen) == 0 |
| 191 | : matchEnd ? matchLen <= testLen |
| 192 | && strncmp(testName + testLen - matchLen, matchName, matchLen) == 0 |
| 193 | : strstr(testName, matchName) != 0) { |
| 194 | return matchExclude; |
| 195 | } |
| 196 | } |
| 197 | return !anyExclude; |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 198 | } |
| 199 | |
caryclark@google.com | 5987f58 | 2012-10-02 18:33:14 +0000 | [diff] [blame] | 200 | int tool_main(int argc, char** argv); |
| 201 | int tool_main(int argc, char** argv) { |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 202 | SkCommandLineFlags::SetUsage(""); |
| 203 | SkCommandLineFlags::Parse(argc, argv); |
| 204 | |
bsalomon@google.com | 4e23068 | 2013-01-15 20:37:04 +0000 | [diff] [blame] | 205 | #if SK_ENABLE_INST_COUNT |
reed@google.com | a276975 | 2012-07-22 22:33:05 +0000 | [diff] [blame] | 206 | gPrintInstCount = true; |
| 207 | #endif |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 208 | |
reed@google.com | a276975 | 2012-07-22 22:33:05 +0000 | [diff] [blame] | 209 | SkGraphics::Init(); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 210 | |
reed@google.com | 91d449e | 2011-10-26 15:25:18 +0000 | [diff] [blame] | 211 | { |
| 212 | SkString header("Skia UnitTests:"); |
reed@google.com | 9aff148 | 2013-04-11 18:27:52 +0000 | [diff] [blame] | 213 | if (!FLAGS_match.isEmpty()) { |
caryclark@google.com | b631eec | 2013-05-02 13:14:40 +0000 | [diff] [blame] | 214 | header.appendf(" --match"); |
| 215 | for (int index = 0; index < FLAGS_match.count(); ++index) { |
| 216 | header.appendf(" %s", FLAGS_match[index]); |
| 217 | } |
reed@google.com | 91d449e | 2011-10-26 15:25:18 +0000 | [diff] [blame] | 218 | } |
scroggo@google.com | c76218d | 2013-06-06 14:59:56 +0000 | [diff] [blame] | 219 | SkString tmpDir = Test::GetTmpDir(); |
| 220 | if (!tmpDir.isEmpty()) { |
| 221 | header.appendf(" --tmpDir %s", tmpDir.c_str()); |
djsollen@google.com | cb62650 | 2013-03-20 13:48:20 +0000 | [diff] [blame] | 222 | } |
scroggo@google.com | c76218d | 2013-06-06 14:59:56 +0000 | [diff] [blame] | 223 | SkString resourcePath = Test::GetResourcePath(); |
| 224 | if (!resourcePath.isEmpty()) { |
| 225 | header.appendf(" --resourcePath %s", resourcePath.c_str()); |
reed@google.com | 789c6f2 | 2013-02-25 20:24:24 +0000 | [diff] [blame] | 226 | } |
reed@google.com | 91d449e | 2011-10-26 15:25:18 +0000 | [diff] [blame] | 227 | #ifdef SK_DEBUG |
| 228 | header.append(" SK_DEBUG"); |
| 229 | #else |
| 230 | header.append(" SK_RELEASE"); |
| 231 | #endif |
| 232 | #ifdef SK_SCALAR_IS_FIXED |
| 233 | header.append(" SK_SCALAR_IS_FIXED"); |
| 234 | #else |
| 235 | header.append(" SK_SCALAR_IS_FLOAT"); |
| 236 | #endif |
djsollen@google.com | f4d1b39 | 2012-11-29 16:29:58 +0000 | [diff] [blame] | 237 | SkDebugf("%s\n", header.c_str()); |
reed@google.com | 91d449e | 2011-10-26 15:25:18 +0000 | [diff] [blame] | 238 | } |
| 239 | |
caryclark@google.com | 8d0a524 | 2013-07-16 16:11:16 +0000 | [diff] [blame] | 240 | DebugfReporter reporter(FLAGS_extendedTest, !FLAGS_single, FLAGS_verbose); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 241 | Iter iter(&reporter); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 242 | |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 243 | // Count tests first. |
| 244 | int total = 0; |
| 245 | int toRun = 0; |
| 246 | Test* test; |
| 247 | while ((test = iter.next()) != NULL) { |
| 248 | SkAutoTDelete<Test> owned(test); |
| 249 | if(!shouldSkip(test->getName())) { |
| 250 | toRun++; |
| 251 | } |
| 252 | total++; |
| 253 | } |
| 254 | reporter.setTotal(toRun); |
| 255 | |
| 256 | // Now run them. |
| 257 | iter.reset(); |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 258 | int32_t failCount = 0; |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 259 | int skipCount = 0; |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 260 | |
| 261 | SkAutoTDelete<SkThreadPool> threadpool(SkNEW_ARGS(SkThreadPool, (FLAGS_threads))); |
| 262 | SkTArray<Test*> unsafeTests; // Always passes ownership to an SkTestRunnable |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 263 | for (int i = 0; i < total; i++) { |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 264 | SkAutoTDelete<Test> test(iter.next()); |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 265 | if (shouldSkip(test->getName())) { |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 266 | ++skipCount; |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 267 | } else if (!test->isThreadsafe()) { |
| 268 | unsafeTests.push_back() = test.detach(); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 269 | } else { |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 270 | threadpool->add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount))); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 271 | } |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 272 | } |
reed@android.com | 57b799e | 2009-04-01 20:26:42 +0000 | [diff] [blame] | 273 | |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 274 | // Run the tests that aren't threadsafe. |
| 275 | for (int i = 0; i < unsafeTests.count(); i++) { |
| 276 | SkNEW_ARGS(SkTestRunnable, (unsafeTests[i], &failCount))->run(); |
| 277 | } |
| 278 | |
| 279 | // Blocks until threaded tests finish. |
| 280 | threadpool.free(); |
| 281 | |
djsollen@google.com | f4d1b39 | 2012-11-29 16:29:58 +0000 | [diff] [blame] | 282 | SkDebugf("Finished %d tests, %d failures, %d skipped.\n", |
commit-bot@chromium.org | 0506b9d | 2013-04-22 16:43:07 +0000 | [diff] [blame] | 283 | toRun, failCount, skipCount); |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 284 | const int testCount = reporter.countTests(); |
commit-bot@chromium.org | ba59d64 | 2013-04-11 16:54:09 +0000 | [diff] [blame] | 285 | if (FLAGS_verbose && testCount > 0) { |
caryclark@google.com | d54e1e9 | 2013-04-10 15:57:31 +0000 | [diff] [blame] | 286 | SkDebugf("Ran %d Internal tests.\n", testCount); |
| 287 | } |
robertphillips@google.com | bdb1be5 | 2012-09-07 18:24:43 +0000 | [diff] [blame] | 288 | #if SK_SUPPORT_GPU |
| 289 | |
| 290 | #if GR_CACHE_STATS |
| 291 | GrContext *gr = GpuTest::GetContext(); |
| 292 | |
| 293 | gr->printCacheStats(); |
| 294 | #endif |
| 295 | |
| 296 | #endif |
| 297 | |
reed@google.com | a276975 | 2012-07-22 22:33:05 +0000 | [diff] [blame] | 298 | SkGraphics::Term(); |
bsalomon@google.com | 67b915d | 2013-02-04 16:13:32 +0000 | [diff] [blame] | 299 | GpuTest::DestroyContexts(); |
reed@google.com | a276975 | 2012-07-22 22:33:05 +0000 | [diff] [blame] | 300 | |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 301 | return (failCount == 0) ? 0 : 1; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 302 | } |
caryclark@google.com | 5987f58 | 2012-10-02 18:33:14 +0000 | [diff] [blame] | 303 | |
borenet@google.com | 7158e6a | 2012-11-01 17:43:44 +0000 | [diff] [blame] | 304 | #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
caryclark@google.com | 5987f58 | 2012-10-02 18:33:14 +0000 | [diff] [blame] | 305 | int main(int argc, char * const argv[]) { |
| 306 | return tool_main(argc, (char**) argv); |
| 307 | } |
| 308 | #endif |