skdiff test-only change: add test of --nodiffs mode, make tests validate return value
authorepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 18 May 2012 18:25:26 +0000 (18:25 +0000)
committerepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 18 May 2012 18:25:26 +0000 (18:25 +0000)
Review URL: https://codereview.appspot.com/6206085

git-svn-id: http://skia.googlecode.com/svn/trunk@3999 2bbb7eff-a529-9590-31e7-b0007b416f81

tools/tests/run.sh
tools/tests/skdiff/test1/output-expected/command_line [new file with mode: 0644]
tools/tests/skdiff/test1/output-expected/return_value [new file with mode: 0644]
tools/tests/skdiff/test2/output-expected/command_line [new file with mode: 0644]
tools/tests/skdiff/test2/output-expected/return_value [new file with mode: 0644]
tools/tests/skdiff/test2/output-expected/stdout [new file with mode: 0644]

index c3c5bbc..a3e610d 100755 (executable)
@@ -30,10 +30,15 @@ function skdiff_test {
 
   rm -rf $ACTUAL_OUTPUT_DIR
   mkdir -p $ACTUAL_OUTPUT_DIR
-  $SKDIFF_BINARY $SKDIFF_ARGS $ACTUAL_OUTPUT_DIR &>$ACTUAL_OUTPUT_DIR/stdout
+  COMMAND="$SKDIFF_BINARY $SKDIFF_ARGS $ACTUAL_OUTPUT_DIR"
+  echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
+  $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout
+  echo $? >$ACTUAL_OUTPUT_DIR/return_value
+
   compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
 }
 
 SKDIFF_TESTDIR=tools/tests/skdiff
 skdiff_test "$SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test1"
+skdiff_test "--nodiffs $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test2"
 echo "All tests passed."
diff --git a/tools/tests/skdiff/test1/output-expected/command_line b/tools/tests/skdiff/test1/output-expected/command_line
new file mode 100644 (file)
index 0000000..7ed9128
--- /dev/null
@@ -0,0 +1 @@
+out/Debug/skdiff tools/tests/skdiff/baseDir tools/tests/skdiff/comparisonDir tools/tests/skdiff/test1/output-actual
diff --git a/tools/tests/skdiff/test1/output-expected/return_value b/tools/tests/skdiff/test1/output-expected/return_value
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0
diff --git a/tools/tests/skdiff/test2/output-expected/command_line b/tools/tests/skdiff/test2/output-expected/command_line
new file mode 100644 (file)
index 0000000..b0bdd62
--- /dev/null
@@ -0,0 +1 @@
+out/Debug/skdiff --nodiffs tools/tests/skdiff/baseDir tools/tests/skdiff/comparisonDir tools/tests/skdiff/test2/output-actual
diff --git a/tools/tests/skdiff/test2/output-expected/return_value b/tools/tests/skdiff/test2/output-expected/return_value
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0
diff --git a/tools/tests/skdiff/test2/output-expected/stdout b/tools/tests/skdiff/test2/output-expected/stdout
new file mode 100644 (file)
index 0000000..5567977
--- /dev/null
@@ -0,0 +1,14 @@
+ERROR: no codec found for <tools/tests/skdiff/baseDir/different-bits-unknown-format.xyz>
+ERROR: no codec found for <tools/tests/skdiff/baseDir/identical-bits-unknown-format.xyz>
+baseDir is [tools/tests/skdiff/baseDir/]
+comparisonDir is [tools/tests/skdiff/comparisonDir/]
+not writing any diffs to outputDir [tools/tests/skdiff/test2/output-actual/]
+Missing in baseDir:
+       missing-from-baseDir.png
+       missing-from-baseDir.xyz
+Missing in comparisonDir:
+       missing-from-comparisonDir.png
+       missing-from-comparisonDir.xyz
+4 of 12 images matched.
+Maximum pixel intensity mismatch 239
+Largest area mismatch was 100.00% of pixels