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 void gather_srcs() { | 522 static bool gather_srcs() { |
523 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()) { |
524 push_src("gm", "", new GMSrc(r->factory())); | 524 push_src("gm", "", new GMSrc(r->factory())); |
525 } | 525 } |
526 for (int i = 0; i < FLAGS_skps.count(); i++) { | 526 for (int i = 0; i < FLAGS_skps.count(); i++) { |
527 const char* path = FLAGS_skps[i]; | 527 const char* path = FLAGS_skps[i]; |
528 if (sk_isdir(path)) { | 528 if (sk_isdir(path)) { |
529 SkOSFile::Iter it(path, "skp"); | 529 SkOSFile::Iter it(path, "skp"); |
530 for (SkString file; it.next(&file); ) { | 530 for (SkString file; it.next(&file); ) { |
531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); | 531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); |
532 } | 532 } |
533 } else { | 533 } else { |
534 push_src("skp", "", new SKPSrc(path)); | 534 push_src("skp", "", new SKPSrc(path)); |
535 } | 535 } |
536 } | 536 } |
537 static const char* const exts[] = { | 537 |
538 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , | 538 SkTArray<SkString> images; |
539 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , | 539 if (!CollectImages(&images)) { |
540 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | 540 return false; |
541 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | 541 } |
542 }; | 542 |
543 for (int i = 0; i < FLAGS_images.count(); i++) { | 543 for (auto image : images) { |
544 const char* flag = FLAGS_images[i]; | 544 push_codec_srcs(image); |
545 if (sk_isdir(flag)) { | 545 const char* ext = ""; |
546 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 546 int index = image.findLastOf('.'); |
547 SkOSFile::Iter it(flag, exts[j]); | 547 if (index >= 0 && (size_t) ++index < image.size()) { |
548 for (SkString file; it.next(&file); ) { | 548 ext = &image.c_str()[index]; |
549 SkString path = SkOSPath::Join(flag, file.c_str()); | 549 } |
550 push_codec_srcs(path); | 550 if (brd_supported(ext)) { |
551 if (brd_supported(exts[j])) { | 551 push_brd_srcs(image); |
552 push_brd_srcs(path); | |
553 } | |
554 } | |
555 } | |
556 } else if (sk_exists(flag)) { | |
557 // assume that FLAGS_images[i] is a valid image if it is a file. | |
558 push_codec_srcs(flag); | |
559 push_brd_srcs(flag); | |
560 } | 552 } |
561 } | 553 } |
554 | |
555 return true; | |
562 } | 556 } |
563 | 557 |
564 static void push_sink(const SkCommandLineConfig& config, Sink* s) { | 558 static void push_sink(const SkCommandLineConfig& config, Sink* s) { |
565 SkAutoTDelete<Sink> sink(s); | 559 SkAutoTDelete<Sink> sink(s); |
566 | 560 |
567 // Try a simple Src as a canary. If it fails, skip this sink. | 561 // Try a simple Src as a canary. If it fails, skip this sink. |
568 struct : public Src { | 562 struct : public Src { |
569 Error draw(SkCanvas* c) const override { | 563 Error draw(SkCanvas* c) const override { |
570 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); | 564 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); |
571 return ""; | 565 return ""; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1099 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. | 1093 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. |
1100 SkAutoGraphics ag; | 1094 SkAutoGraphics ag; |
1101 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1095 SkTaskGroup::Enabler enabled(FLAGS_threads); |
1102 gCreateTypefaceDelegate = &create_from_name; | 1096 gCreateTypefaceDelegate = &create_from_name; |
1103 | 1097 |
1104 start_keepalive(); | 1098 start_keepalive(); |
1105 | 1099 |
1106 gather_gold(); | 1100 gather_gold(); |
1107 gather_uninteresting_hashes(); | 1101 gather_uninteresting_hashes(); |
1108 | 1102 |
1109 gather_srcs(); | 1103 if (!gather_srcs()) { |
1104 exit(1); | |
mtklein
2016/01/27 19:38:05
return 1?
scroggo
2016/01/27 19:42:27
Done.
| |
1105 } | |
1110 gather_sinks(); | 1106 gather_sinks(); |
1111 gather_tests(); | 1107 gather_tests(); |
1112 | 1108 |
1113 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); | 1109 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); |
1114 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", | 1110 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", |
1115 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); | 1111 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); |
1116 | 1112 |
1117 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, | 1113 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, |
1118 // but Sinks that identify as part of a particular enclave run serially on a single thread. | 1114 // but Sinks that identify as part of a particular enclave run serially on a single thread. |
1119 // CPU tests run on any thread. GPU tests depend on --gpu_threading. | 1115 // 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... | |
1261 Reporter* reporter, | 1257 Reporter* reporter, |
1262 GrContextFactory* fac tory); | 1258 GrContextFactory* fac tory); |
1263 } // namespace skiatest | 1259 } // namespace skiatest |
1264 | 1260 |
1265 #if !defined(SK_BUILD_FOR_IOS) | 1261 #if !defined(SK_BUILD_FOR_IOS) |
1266 int main(int argc, char** argv) { | 1262 int main(int argc, char** argv) { |
1267 SkCommandLineFlags::Parse(argc, argv); | 1263 SkCommandLineFlags::Parse(argc, argv); |
1268 return dm_main(); | 1264 return dm_main(); |
1269 } | 1265 } |
1270 #endif | 1266 #endif |
OLD | NEW |