| 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" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const Test& test = iter->factory(); | 167 const Test& test = iter->factory(); |
| 168 if (should_run(test.name, test.needsGpu)) { | 168 if (should_run(test.name, test.needsGpu)) { |
| 169 toRun++; | 169 toRun++; |
| 170 } | 170 } |
| 171 total++; | 171 total++; |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Now run them. | 174 // Now run them. |
| 175 int skipCount = 0; | 175 int skipCount = 0; |
| 176 | 176 |
| 177 #if SK_SUPPORT_GPU |
| 178 SkTaskGroup::Enabler enabled(FLAGS_threads, GrContextFactory::ReleaseGpuAPIs
InThread); |
| 179 #else |
| 177 SkTaskGroup::Enabler enabled(FLAGS_threads); | 180 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 181 #endif |
| 178 SkTaskGroup cpuTests; | 182 SkTaskGroup cpuTests; |
| 179 SkTArray<const Test*> gpuTests; | 183 SkTArray<const Test*> gpuTests; |
| 180 | 184 |
| 181 Status status(toRun); | 185 Status status(toRun); |
| 182 for (const TestRegistry* iter = TestRegistry::Head(); iter; | 186 for (const TestRegistry* iter = TestRegistry::Head(); iter; |
| 183 iter = iter->next()) { | 187 iter = iter->next()) { |
| 184 const Test& test = iter->factory(); | 188 const Test& test = iter->factory(); |
| 185 if (!should_run(test.name, test.needsGpu)) { | 189 if (!should_run(test.name, test.needsGpu)) { |
| 186 ++skipCount; | 190 ++skipCount; |
| 187 } else if (test.needsGpu) { | 191 } else if (test.needsGpu) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 211 SkDebugf( | 215 SkDebugf( |
| 212 "\nFinished %d tests, %d failures, %d skipped. " | 216 "\nFinished %d tests, %d failures, %d skipped. " |
| 213 "(%d internal tests)", | 217 "(%d internal tests)", |
| 214 toRun, status.failCount(), skipCount, status.testCount()); | 218 toRun, status.failCount(), skipCount, status.testCount()); |
| 215 if (gVerboseFinalize) { | 219 if (gVerboseFinalize) { |
| 216 (*gVerboseFinalize)(); | 220 (*gVerboseFinalize)(); |
| 217 } | 221 } |
| 218 } | 222 } |
| 219 | 223 |
| 220 SkDebugf("\n"); | 224 SkDebugf("\n"); |
| 225 #if SK_SUPPORT_GPU |
| 226 // The main thread maybe ran GPU code. |
| 227 GrContextFactory::ReleaseGpuAPIsInThread(); |
| 228 #endif |
| 221 return (status.failCount() == 0) ? 0 : 1; | 229 return (status.failCount() == 0) ? 0 : 1; |
| 222 } | 230 } |
| 223 | 231 |
| 224 #if !defined(SK_BUILD_FOR_IOS) | 232 #if !defined(SK_BUILD_FOR_IOS) |
| 225 int main(int argc, char** argv) { | 233 int main(int argc, char** argv) { |
| 226 SkCommandLineFlags::Parse(argc, argv); | 234 SkCommandLineFlags::Parse(argc, argv); |
| 227 return test_main(); | 235 return test_main(); |
| 228 } | 236 } |
| 229 #endif | 237 #endif |
| OLD | NEW |