Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #include "CrashHandler.h" | 1 #include "CrashHandler.h" |
| 2 #include "DMJsonWriter.h" | 2 #include "DMJsonWriter.h" |
| 3 #include "DMSrcSink.h" | 3 #include "DMSrcSink.h" |
| 4 #include "OverwriteLine.h" | 4 #include "OverwriteLine.h" |
| 5 #include "ProcStats.h" | 5 #include "ProcStats.h" |
| 6 #include "SkBBHFactory.h" | 6 #include "SkBBHFactory.h" |
| 7 #include "SkCommonFlags.h" | 7 #include "SkCommonFlags.h" |
| 8 #include "SkForceLinking.h" | 8 #include "SkForceLinking.h" |
| 9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
| 10 #include "SkMD5.h" | 10 #include "SkMD5.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); | 22 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
| 23 DEFINE_string(matrix, "1 0 0 0 1 0 0 0 1", | 23 DEFINE_string(matrix, "1 0 0 0 1 0 0 0 1", |
| 24 "Matrix to apply when using 'matrix' in config."); | 24 "Matrix to apply when using 'matrix' in config."); |
| 25 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); | 25 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); |
| 26 | 26 |
| 27 DEFINE_string(blacklist, "", | 27 DEFINE_string(blacklist, "", |
| 28 "Space-separated config/src/name triples to blacklist. '_' matches anyt hing. E.g. \n" | 28 "Space-separated config/src/name triples to blacklist. '_' matches anyt hing. E.g. \n" |
| 29 "'--blacklist gpu skp _' will blacklist all SKPs drawn into the gpu conf ig.\n" | 29 "'--blacklist gpu skp _' will blacklist all SKPs drawn into the gpu conf ig.\n" |
| 30 "'--blacklist gpu skp _ 8888 gm aarects' will also blacklist the aarects GM on 8888."); | 30 "'--blacklist gpu skp _ 8888 gm aarects' will also blacklist the aarects GM on 8888."); |
| 31 | 31 |
| 32 | |
| 33 __SK_FORCE_IMAGE_DECODER_LINKING; | 32 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 34 using namespace DM; | 33 using namespace DM; |
| 35 | 34 |
| 36 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ | 35 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ |
| 37 | 36 |
| 38 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); | 37 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); |
| 39 static SkTArray<SkString> gFailures; | 38 static SkTArray<SkString> gFailures; |
| 40 | 39 |
| 41 static void fail(ImplicitString err) { | 40 static void fail(ImplicitString err) { |
| 42 SkAutoMutexAcquire lock(gFailuresMutex); | 41 SkAutoMutexAcquire lock(gFailuresMutex); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 static void run_enclave(SkTArray<Task>* tasks) { | 354 static void run_enclave(SkTArray<Task>* tasks) { |
| 356 for (int i = 0; i < tasks->count(); i++) { | 355 for (int i = 0; i < tasks->count(); i++) { |
| 357 Task::Run(tasks->begin() + i); | 356 Task::Run(tasks->begin() + i); |
| 358 } | 357 } |
| 359 } | 358 } |
| 360 | 359 |
| 361 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ | 360 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ |
| 362 | 361 |
| 363 // Unit tests don't fit so well into the Src/Sink model, so we give them special treatment. | 362 // Unit tests don't fit so well into the Src/Sink model, so we give them special treatment. |
| 364 | 363 |
| 365 static struct : public skiatest::Reporter { | 364 static SkTDArray<skiatest::Test> gCPUTests, gGPUTests; |
| 366 void onReportFailed(const skiatest::Failure& failure) SK_OVERRIDE { | |
| 367 SkString s; | |
| 368 failure.getFailureString(&s); | |
| 369 fail(s); | |
| 370 JsonWriter::AddTestFailure(failure); | |
| 371 } | |
| 372 bool allowExtendedTest() const SK_OVERRIDE { return FLAGS_pathOpsExtended; } | |
| 373 bool verbose() const SK_OVERRIDE { return FLAGS_veryVerbose; } | |
| 374 } gTestReporter; | |
| 375 | |
| 376 static SkTArray<SkAutoTDelete<skiatest::Test>, kMemcpyOK> gCPUTests, gGPUTests; | |
| 377 | 365 |
| 378 static void gather_tests() { | 366 static void gather_tests() { |
| 379 if (!FLAGS_tests) { | 367 if (!FLAGS_tests) { |
| 380 return; | 368 return; |
| 381 } | 369 } |
| 382 for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r = r->next()) { | 370 for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; |
| 383 SkAutoTDelete<skiatest::Test> test(r->factory()(NULL)); | 371 r = r->next()) { |
| 384 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) { | 372 // Despite its name, factory() is returning a reference to |
| 373 // link-time static const POD data. | |
| 374 const skiatest::Test& test = r->factory(); | |
| 375 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { | |
| 385 continue; | 376 continue; |
| 386 } | 377 } |
| 387 | 378 if (test.needsGpu && gpu_supported()) { |
| 388 test->setReporter(&gTestReporter); | 379 gGPUTests.push(test); |
| 389 if (test->isGPUTest() && gpu_supported()) { | 380 } else if (!test.needsGpu && FLAGS_cpu) { |
| 390 gGPUTests.push_back().reset(test.detach()); | 381 gCPUTests.push(test); |
| 391 } else if (!test->isGPUTest() && FLAGS_cpu) { | |
| 392 gCPUTests.push_back().reset(test.detach()); | |
| 393 } | 382 } |
| 394 } | 383 } |
| 395 } | 384 } |
| 396 | 385 |
| 397 static void run_test(SkAutoTDelete<skiatest::Test>* t) { | 386 static void run_test(skiatest::Test* test) { |
| 387 struct : public skiatest::Reporter { | |
| 388 void reportFailed(const skiatest::Failure& failure) SK_OVERRIDE { | |
| 389 fail(failure.toString()); | |
| 390 JsonWriter::AddTestFailure(failure); | |
| 391 } | |
| 392 bool allowExtendedTest() const SK_OVERRIDE { | |
| 393 return FLAGS_pathOpsExtended; | |
|
mtklein
2015/01/20 16:16:53
One line?
hal.canary
2015/01/20 16:21:51
I'll defer to clang-format
| |
| 394 } | |
| 395 bool verbose() const SK_OVERRIDE { return FLAGS_veryVerbose; } | |
| 396 } | |
| 397 reporter; | |
|
mtklein
2015/01/20 16:16:53
usually I put these on the same line as the }
hal.canary
2015/01/20 16:21:51
Done.
| |
| 398 WallTimer timer; | 398 WallTimer timer; |
| 399 timer.start(); | 399 timer.start(); |
| 400 skiatest::Test* test = t->get(); | |
| 401 if (!FLAGS_dryRun) { | 400 if (!FLAGS_dryRun) { |
| 402 test->setGrContextFactory(GetThreadLocalGrContextFactory()); | 401 test->proc(&reporter, GetThreadLocalGrContextFactory()); |
| 403 test->run(); | |
| 404 if (!test->passed()) { | |
| 405 fail(SkStringPrintf("test %s failed", test->getName())); | |
| 406 } | |
| 407 } | 402 } |
| 408 timer.end(); | 403 timer.end(); |
| 409 done(timer.fWall, "unit", "test", test->getName()); | 404 done(timer.fWall, "unit", "test", test->name); |
| 410 } | 405 } |
| 411 | 406 |
| 412 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ | 407 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ |
| 413 | 408 |
| 414 int dm_main(); | 409 int dm_main(); |
| 415 int dm_main() { | 410 int dm_main() { |
| 416 SetupCrashHandler(); | 411 SetupCrashHandler(); |
| 417 SkAutoGraphics ag; | 412 SkAutoGraphics ag; |
| 418 SkTaskGroup::Enabler enabled(FLAGS_threads); | 413 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 419 | 414 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 } | 473 } |
| 479 return 0; | 474 return 0; |
| 480 } | 475 } |
| 481 | 476 |
| 482 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 477 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 483 int main(int argc, char** argv) { | 478 int main(int argc, char** argv) { |
| 484 SkCommandLineFlags::Parse(argc, argv); | 479 SkCommandLineFlags::Parse(argc, argv); |
| 485 return dm_main(); | 480 return dm_main(); |
| 486 } | 481 } |
| 487 #endif | 482 #endif |
| OLD | NEW |