Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
| 10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
| 515 if (0 == strcmp(exts[i], ext)) { | 515 if (0 == strcmp(exts[i], ext)) { |
| 516 return true; | 516 return true; |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 return false; | 519 return false; |
| 520 } | 520 } |
| 521 | 521 |
| 522 static bool is_raw(const SkString& file) { | 522 static bool gather_srcs() { |
|
scroggo
2016/01/27 15:43:36
This was only here to prevent testing RAW with SkI
| |
| 523 static const char* const exts[] = { | |
| 524 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | |
| 525 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | |
| 526 }; | |
| 527 | |
| 528 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | |
| 529 if (file.endsWith(exts[i])) { | |
| 530 return true; | |
| 531 } | |
| 532 } | |
| 533 return false; | |
| 534 } | |
| 535 | |
| 536 static void gather_srcs() { | |
| 537 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { | 523 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { |
| 538 push_src("gm", "", new GMSrc(r->factory())); | 524 push_src("gm", "", new GMSrc(r->factory())); |
| 539 } | 525 } |
| 540 for (int i = 0; i < FLAGS_skps.count(); i++) { | 526 for (int i = 0; i < FLAGS_skps.count(); i++) { |
| 541 const char* path = FLAGS_skps[i]; | 527 const char* path = FLAGS_skps[i]; |
| 542 if (sk_isdir(path)) { | 528 if (sk_isdir(path)) { |
| 543 SkOSFile::Iter it(path, "skp"); | 529 SkOSFile::Iter it(path, "skp"); |
| 544 for (SkString file; it.next(&file); ) { | 530 for (SkString file; it.next(&file); ) { |
| 545 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); | 531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); |
| 546 } | 532 } |
| 547 } else { | 533 } else { |
| 548 push_src("skp", "", new SKPSrc(path)); | 534 push_src("skp", "", new SKPSrc(path)); |
| 549 } | 535 } |
| 550 } | 536 } |
| 551 static const char* const exts[] = { | 537 |
| 552 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , | 538 SkTArray<SkString> images; |
| 553 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , | 539 if (!CollectImages(&images)) { |
| 554 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | 540 return false; |
| 555 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | 541 } |
| 556 }; | 542 |
| 557 for (int i = 0; i < FLAGS_images.count(); i++) { | 543 for (auto image : images) { |
| 558 const char* flag = FLAGS_images[i]; | 544 push_src("image", "decode", new ImageSrc(image)); // Decode entire image |
| 559 if (sk_isdir(flag)) { | 545 push_codec_srcs(image); |
| 560 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 546 const char* ext = ""; |
| 561 SkOSFile::Iter it(flag, exts[j]); | 547 int index = image.findLastOf('.'); |
| 562 for (SkString file; it.next(&file); ) { | 548 if (index >= 0 && (size_t) ++index < image.size()) { |
| 563 SkString path = SkOSPath::Join(flag, file.c_str()); | 549 ext = &image.c_str()[index]; |
| 564 if (!is_raw(file)) { | 550 } |
| 565 push_src("image", "decode", new ImageSrc(path)); // Deco de entire image | 551 if (brd_supported(ext)) { |
| 566 } | 552 push_brd_srcs(image); |
| 567 push_codec_srcs(path); | |
| 568 if (brd_supported(exts[j])) { | |
| 569 push_brd_srcs(path); | |
| 570 } | |
| 571 } | |
| 572 } | |
| 573 } else if (sk_exists(flag)) { | |
| 574 // assume that FLAGS_images[i] is a valid image if it is a file. | |
| 575 if (!is_raw(SkString(flag))) { | |
| 576 push_src("image", "decode", new ImageSrc(flag)); // Decode entir e image. | |
| 577 } | |
| 578 push_codec_srcs(flag); | |
| 579 push_brd_srcs(flag); | |
| 580 } | 553 } |
| 581 } | 554 } |
| 555 | |
| 556 return true; | |
| 582 } | 557 } |
| 583 | 558 |
| 584 static void push_sink(const SkCommandLineConfig& config, Sink* s) { | 559 static void push_sink(const SkCommandLineConfig& config, Sink* s) { |
| 585 SkAutoTDelete<Sink> sink(s); | 560 SkAutoTDelete<Sink> sink(s); |
| 586 | 561 |
| 587 // Try a simple Src as a canary. If it fails, skip this sink. | 562 // Try a simple Src as a canary. If it fails, skip this sink. |
| 588 struct : public Src { | 563 struct : public Src { |
| 589 Error draw(SkCanvas* c) const override { | 564 Error draw(SkCanvas* c) const override { |
| 590 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); | 565 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); |
| 591 return ""; | 566 return ""; |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1119 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. | 1094 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. |
| 1120 SkAutoGraphics ag; | 1095 SkAutoGraphics ag; |
| 1121 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1096 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 1122 gCreateTypefaceDelegate = &create_from_name; | 1097 gCreateTypefaceDelegate = &create_from_name; |
| 1123 | 1098 |
| 1124 start_keepalive(); | 1099 start_keepalive(); |
| 1125 | 1100 |
| 1126 gather_gold(); | 1101 gather_gold(); |
| 1127 gather_uninteresting_hashes(); | 1102 gather_uninteresting_hashes(); |
| 1128 | 1103 |
| 1129 gather_srcs(); | 1104 if (!gather_srcs()) { |
| 1105 exit(1); | |
| 1106 } | |
| 1130 gather_sinks(); | 1107 gather_sinks(); |
| 1131 gather_tests(); | 1108 gather_tests(); |
| 1132 | 1109 |
| 1133 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); | 1110 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); |
| 1134 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", | 1111 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", |
| 1135 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); | 1112 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); |
| 1136 | 1113 |
| 1137 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, | 1114 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, |
| 1138 // but Sinks that identify as part of a particular enclave run serially on a single thread. | 1115 // but Sinks that identify as part of a particular enclave run serially on a single thread. |
| 1139 // CPU tests run on any thread. GPU tests depend on --gpu_threading. | 1116 // CPU tests run on any thread. GPU tests depend on --gpu_threading. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1281 Reporter* reporter, | 1258 Reporter* reporter, |
| 1282 GrContextFactory* fac tory); | 1259 GrContextFactory* fac tory); |
| 1283 } // namespace skiatest | 1260 } // namespace skiatest |
| 1284 | 1261 |
| 1285 #if !defined(SK_BUILD_FOR_IOS) | 1262 #if !defined(SK_BUILD_FOR_IOS) |
| 1286 int main(int argc, char** argv) { | 1263 int main(int argc, char** argv) { |
| 1287 SkCommandLineFlags::Parse(argc, argv); | 1264 SkCommandLineFlags::Parse(argc, argv); |
| 1288 return dm_main(); | 1265 return dm_main(); |
| 1289 } | 1266 } |
| 1290 #endif | 1267 #endif |
| OLD | NEW |