598 {
600 int (*sortProc)(
const void*,
const void*) = compare<CompareDiffMetrics>;
601
602
603
604 int colorThreshold = 0;
608
611
612 bool generateDiffs = true;
613 bool listFilenames = false;
614 bool printDirNames = true;
615 bool recurseIntoSubdirs = true;
617 bool listFailingBase = false;
618 bool ignoreColorSpace = false;
619
622
625 failOnResultType[
i] =
false;
626 }
627
631 failOnStatusType[
base][comparison] =
false;
632 }
633 }
634
635 int numUnflaggedArguments = 0;
636 for (
int i = 1;
i < argc;
i++) {
637 if (!strcmp(
argv[
i],
"--failonresult")) {
639 SkDebugf(
"failonresult expects one argument.\n");
640 continue;
641 }
644 failOnResultType[
type] =
true;
645 } else {
647 }
648 continue;
649 }
650 if (!strcmp(
argv[
i],
"--failonstatus")) {
652 SkDebugf(
"failonstatus missing base status.\n");
653 continue;
654 }
658 }
659
661 SkDebugf(
"failonstatus missing comparison status.\n");
662 continue;
663 }
667 }
668
671 failOnStatusType[
base][comparison] |=
672 baseStatuses[
base] && comparisonStatuses[comparison];
673 }
674 }
675 continue;
676 }
677 if (!strcmp(
argv[
i],
"--help")) {
680 }
681 if (!strcmp(
argv[
i],
"--listfilenames")) {
682 listFilenames = true;
683 continue;
684 }
685 if (!strcmp(
argv[
i],
"--verbose")) {
687 continue;
688 }
689 if (!strcmp(
argv[
i],
"--match")) {
691 continue;
692 }
693 if (!strcmp(
argv[
i],
"--nocolorspace")) {
694 ignoreColorSpace = true;
695 continue;
696 }
697 if (!strcmp(
argv[
i],
"--nodiffs")) {
698 generateDiffs = false;
699 continue;
700 }
701 if (!strcmp(
argv[
i],
"--nomatch")) {
703 continue;
704 }
705 if (!strcmp(
argv[
i],
"--noprintdirs")) {
706 printDirNames = false;
707 continue;
708 }
709 if (!strcmp(
argv[
i],
"--norecurse")) {
710 recurseIntoSubdirs = false;
711 continue;
712 }
713 if (!strcmp(
argv[
i],
"--sortbymaxmismatch")) {
714 sortProc = compare<CompareDiffMaxMismatches>;
715 continue;
716 }
717 if (!strcmp(
argv[
i],
"--sortbymismatch")) {
718 sortProc = compare<CompareDiffMeanMismatches>;
719 continue;
720 }
721 if (!strcmp(
argv[
i],
"--threshold")) {
722 colorThreshold = atoi(
argv[++
i]);
723 continue;
724 }
725 if (!strcmp(
argv[
i],
"--weighted")) {
726 sortProc = compare<CompareDiffWeighted>;
727 continue;
728 }
729 if (
argv[
i][0] !=
'-') {
730 switch (numUnflaggedArguments++) {
731 case 0:
733 continue;
734 case 1:
736 continue;
737 case 2:
739 continue;
740 default:
744 }
745 }
746 if (!strcmp(
argv[
i],
"--listFailingBase")) {
747 listFailingBase = true;
748 continue;
749 }
750
754 }
755
756 if (numUnflaggedArguments == 2) {
757 outputDir = comparisonDir;
758 } else if (numUnflaggedArguments != 3) {
761 }
762
765 }
766 if (printDirNames) {
768 }
769
772 }
773 if (printDirNames) {
774 printf(
"comparisonDir is [%s]\n", comparisonDir.
c_str());
775 }
776
779 }
780 if (generateDiffs) {
781 if (printDirNames) {
782 printf(
"writing diffs to outputDir is [%s]\n", outputDir.
c_str());
783 }
784 } else {
785 if (printDirNames) {
786 printf(
"not writing any diffs to outputDir [%s]\n", outputDir.
c_str());
787 }
789 }
790
791
792
793 if (matchSubstrings.
empty()) {
795 }
796
798 baseDir, comparisonDir, outputDir,
799 matchSubstrings, nomatchSubstrings, recurseIntoSubdirs, generateDiffs,
801 summary.
print(listFilenames, failOnResultType, failOnStatusType);
802
803 if (listFailingBase) {
805 }
806
807 if (differences.
size()) {
809 }
810
811 if (generateDiffs) {
813 baseDir, comparisonDir, outputDir);
814 }
815
816 int num_failing_results = 0;
818 if (failOnResultType[
i]) {
820 }
821 }
825 if (failOnStatusType[
base][comparison]) {
827 }
828 }
829 }
830 }
831
832
833
834
835 return (num_failing_results > 255) ? 255 : num_failing_results;
836}
void set(const SkString &src)
bool endsWith(const char suffixStr[]) const
T & emplace_back(Args &&... args)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
SkPMColor(* DiffMetricProc)(SkPMColor, SkPMColor)
Parameterized routine to compute the color of a pixel in a difference image.
static SkPMColor compute_diff_pmcolor(SkPMColor c0, SkPMColor c1)
void print_diff_page(const int matchCount, const int colorThreshold, const RecordArray &differences, const SkString &baseDir, const SkString &comparisonDir, const SkString &outputDir)
static void usage(char *argv0)
static void create_diff_images(DiffMetricProc dmp, const int colorThreshold, bool ignoreColorSpace, RecordArray *differences, const SkString &baseDir, const SkString &comparisonDir, const SkString &outputDir, const StringArray &matchSubstrings, const StringArray &nomatchSubstrings, bool recurseIntoSubdirs, bool getBounds, bool verbose, DiffSummary *summary)
static Result getResultByName(const char *name)
static bool getMatchingStatuses(char *selector, bool statuses[kStatusCount])
void printfFailingBaseNames(const char separator[])
FileArray fStatusOfType[DiffResource::kStatusCount][DiffResource::kStatusCount]
FileArray fResultsOfType[DiffRecord::kResultCount]
void print(bool listFilenames, bool failOnResultType[DiffRecord::kResultCount], bool failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount])