skdiff output: indicate which result types would cause failure
Review URL: https://codereview.appspot.com/6419053 git-svn-id: http://skia.googlecode.com/svn/trunk@4676 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
ceaa5beb66
commit
3af4ff46a7
@ -193,28 +193,32 @@ struct DiffSummary {
|
||||
|
||||
FileArray fResultsOfType[kNumResultTypes];
|
||||
|
||||
// Print a line about the contents of this FileArray to stdout; if the FileArray is empty,
|
||||
// print nothing.
|
||||
// Print a line about the contents of this FileArray to stdout.
|
||||
void printContents(const FileArray& fileArray, const char* headerText, bool listFilenames) {
|
||||
int n = fileArray.count();
|
||||
if (n > 0) {
|
||||
printf(" %d file pairs %s", n, headerText);
|
||||
if (listFilenames) {
|
||||
printf(": ");
|
||||
for (int i = 0; i < n; ++i) {
|
||||
printf("%s ", fileArray[i]->c_str());
|
||||
}
|
||||
printf("%d file pairs %s", n, headerText);
|
||||
if (listFilenames) {
|
||||
printf(": ");
|
||||
for (int i = 0; i < n; ++i) {
|
||||
printf("%s ", fileArray[i]->c_str());
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void print(bool listFilenames) {
|
||||
printf("compared %d file pairs:\n", fNumMatches + fNumMismatches);
|
||||
void print(bool listFilenames, bool failOnResultType[kNumResultTypes]) {
|
||||
printf("\ncompared %d file pairs:\n", fNumMatches + fNumMismatches);
|
||||
for (int resultInt = 0; resultInt < kNumResultTypes; resultInt++) {
|
||||
Result result = static_cast<Result>(resultInt);
|
||||
if (failOnResultType[result]) {
|
||||
printf("[*] ");
|
||||
} else {
|
||||
printf("[_] ");
|
||||
}
|
||||
printContents(fResultsOfType[result], getResultDescription(result), listFilenames);
|
||||
}
|
||||
printf("(results marked with [*] will cause nonzero return value)\n");
|
||||
printf("\nnumber of mismatching file pairs: %d\n", fNumMismatches);
|
||||
if (fNumMismatches > 0) {
|
||||
printf("Maximum pixel intensity mismatch %d\n", fMaxMismatchV);
|
||||
printf("Largest area mismatch was %.2f%% of pixels\n",fMaxMismatchPercent);
|
||||
@ -1158,7 +1162,6 @@ int main (int argc, char ** argv) {
|
||||
|
||||
StringArray matchSubstrings;
|
||||
StringArray nomatchSubstrings;
|
||||
SkTDArray<Result> failOnTheseResultTypes;
|
||||
|
||||
bool generateDiffs = true;
|
||||
bool listFilenames = false;
|
||||
@ -1167,14 +1170,17 @@ int main (int argc, char ** argv) {
|
||||
RecordArray differences;
|
||||
DiffSummary summary;
|
||||
|
||||
bool failOnResultType[kNumResultTypes];
|
||||
for (int i = 0; i < kNumResultTypes; i++) {
|
||||
failOnResultType[i] = false;
|
||||
}
|
||||
|
||||
int i;
|
||||
int numUnflaggedArguments = 0;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "--failonresult")) {
|
||||
Result type = getResultByName(argv[++i]);
|
||||
if (!failOnTheseResultTypes.contains(type)) {
|
||||
failOnTheseResultTypes.push(type);
|
||||
}
|
||||
failOnResultType[type] = true;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[i], "--help")) {
|
||||
@ -1284,7 +1290,7 @@ int main (int argc, char ** argv) {
|
||||
create_diff_images(diffProc, colorThreshold, &differences,
|
||||
baseDir, comparisonDir, outputDir,
|
||||
matchSubstrings, nomatchSubstrings, &summary);
|
||||
summary.print(listFilenames);
|
||||
summary.print(listFilenames, failOnResultType);
|
||||
|
||||
if (differences.count()) {
|
||||
qsort(differences.begin(), differences.count(),
|
||||
@ -1303,9 +1309,10 @@ int main (int argc, char ** argv) {
|
||||
nomatchSubstrings.deleteAll();
|
||||
|
||||
int num_failing_results = 0;
|
||||
for (int i = 0; i < failOnTheseResultTypes.count(); i++) {
|
||||
Result type = failOnTheseResultTypes[i];
|
||||
num_failing_results += summary.fResultsOfType[type].count();
|
||||
for (int i = 0; i < kNumResultTypes; i++) {
|
||||
if (failOnResultType[i]) {
|
||||
num_failing_results += summary.fResultsOfType[i].count();
|
||||
}
|
||||
}
|
||||
|
||||
// On Linux (and maybe other platforms too), any results outside of the
|
||||
|
@ -1,6 +1,16 @@
|
||||
baseDir is [tools/tests/skdiff/baseDir/]
|
||||
comparisonDir is [tools/tests/skdiff/comparisonDir/]
|
||||
not writing any diffs to outputDir [tools/tests/skdiff/identical-bits-or-pixels/output-actual/]
|
||||
|
||||
compared 3 file pairs:
|
||||
2 file pairs contain exactly the same bits
|
||||
1 file pairs contain the same pixel values, but not the same bits
|
||||
[_] 2 file pairs contain exactly the same bits
|
||||
[_] 1 file pairs contain the same pixel values, but not the same bits
|
||||
[_] 0 file pairs have identical dimensions but some differing pixels
|
||||
[_] 0 file pairs have differing dimensions
|
||||
[_] 0 file pairs contain different bits and are not parsable images
|
||||
[_] 0 file pairs missing from comparisonDir
|
||||
[_] 0 file pairs missing from baseDir
|
||||
[_] 0 file pairs not compared yet
|
||||
(results marked with [*] will cause nonzero return value)
|
||||
|
||||
number of mismatching file pairs: 0
|
||||
|
@ -1,5 +1,16 @@
|
||||
baseDir is [tools/tests/skdiff/baseDir/]
|
||||
comparisonDir is [tools/tests/skdiff/comparisonDir/]
|
||||
not writing any diffs to outputDir [tools/tests/skdiff/identical-bits/output-actual/]
|
||||
|
||||
compared 2 file pairs:
|
||||
2 file pairs contain exactly the same bits
|
||||
[_] 2 file pairs contain exactly the same bits
|
||||
[_] 0 file pairs contain the same pixel values, but not the same bits
|
||||
[_] 0 file pairs have identical dimensions but some differing pixels
|
||||
[_] 0 file pairs have differing dimensions
|
||||
[_] 0 file pairs contain different bits and are not parsable images
|
||||
[_] 0 file pairs missing from comparisonDir
|
||||
[_] 0 file pairs missing from baseDir
|
||||
[_] 0 file pairs not compared yet
|
||||
(results marked with [*] will cause nonzero return value)
|
||||
|
||||
number of mismatching file pairs: 0
|
||||
|
@ -6,13 +6,18 @@ ERROR: no codec found for <tools/tests/skdiff/comparisonDir/different-bits-unkno
|
||||
baseDir is [tools/tests/skdiff/baseDir/]
|
||||
comparisonDir is [tools/tests/skdiff/comparisonDir/]
|
||||
writing diffs to outputDir is [tools/tests/skdiff/test1/output-actual/]
|
||||
|
||||
compared 12 file pairs:
|
||||
2 file pairs contain exactly the same bits
|
||||
1 file pairs contain the same pixel values, but not the same bits
|
||||
2 file pairs have identical dimensions but some differing pixels
|
||||
2 file pairs have differing dimensions
|
||||
1 file pairs contain different bits and are not parsable images
|
||||
2 file pairs missing from comparisonDir
|
||||
2 file pairs missing from baseDir
|
||||
[_] 2 file pairs contain exactly the same bits
|
||||
[_] 1 file pairs contain the same pixel values, but not the same bits
|
||||
[_] 2 file pairs have identical dimensions but some differing pixels
|
||||
[_] 2 file pairs have differing dimensions
|
||||
[_] 1 file pairs contain different bits and are not parsable images
|
||||
[_] 2 file pairs missing from comparisonDir
|
||||
[_] 2 file pairs missing from baseDir
|
||||
[_] 0 file pairs not compared yet
|
||||
(results marked with [*] will cause nonzero return value)
|
||||
|
||||
number of mismatching file pairs: 9
|
||||
Maximum pixel intensity mismatch 239
|
||||
Largest area mismatch was 97.99% of pixels
|
||||
|
@ -2,13 +2,18 @@ ERROR: no codec found for basePath <tools/tests/skdiff/baseDir/different-bits-un
|
||||
baseDir is [tools/tests/skdiff/baseDir/]
|
||||
comparisonDir is [tools/tests/skdiff/comparisonDir/]
|
||||
not writing any diffs to outputDir [tools/tests/skdiff/test2/output-actual/]
|
||||
|
||||
compared 12 file pairs:
|
||||
2 file pairs contain exactly the same bits: identical-bits-unknown-format.xyz identical-bits.png
|
||||
1 file pairs contain the same pixel values, but not the same bits: different-bits-identical-pixels.png
|
||||
2 file pairs have identical dimensions but some differing pixels: slightly-different-pixels-same-size.png very-different-pixels-same-size.png
|
||||
2 file pairs have differing dimensions: slightly-different-sizes.png very-different-sizes.png
|
||||
1 file pairs contain different bits and are not parsable images: different-bits-unknown-format.xyz
|
||||
2 file pairs missing from comparisonDir: missing-from-comparisonDir.png missing-from-comparisonDir.xyz
|
||||
2 file pairs missing from baseDir: missing-from-baseDir.png missing-from-baseDir.xyz
|
||||
[_] 2 file pairs contain exactly the same bits: identical-bits-unknown-format.xyz identical-bits.png
|
||||
[_] 1 file pairs contain the same pixel values, but not the same bits: different-bits-identical-pixels.png
|
||||
[*] 2 file pairs have identical dimensions but some differing pixels: slightly-different-pixels-same-size.png very-different-pixels-same-size.png
|
||||
[*] 2 file pairs have differing dimensions: slightly-different-sizes.png very-different-sizes.png
|
||||
[*] 1 file pairs contain different bits and are not parsable images: different-bits-unknown-format.xyz
|
||||
[_] 2 file pairs missing from comparisonDir: missing-from-comparisonDir.png missing-from-comparisonDir.xyz
|
||||
[_] 2 file pairs missing from baseDir: missing-from-baseDir.png missing-from-baseDir.xyz
|
||||
[*] 0 file pairs not compared yet:
|
||||
(results marked with [*] will cause nonzero return value)
|
||||
|
||||
number of mismatching file pairs: 9
|
||||
Maximum pixel intensity mismatch 239
|
||||
Largest area mismatch was 97.99% of pixels
|
||||
|
Loading…
Reference in New Issue
Block a user