From 8e4e51d69b383c5439444be123bc9084f95c437c Mon Sep 17 00:00:00 2001 From: "epoger@google.com" Date: Wed, 30 May 2012 19:12:45 +0000 Subject: [PATCH] test-only: add test coverage of skdiff over input with identical bits or pixels Review URL: https://codereview.appspot.com/6260055 git-svn-id: http://skia.googlecode.com/svn/trunk@4084 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tools/tests/run.sh | 16 ++++++++++++++++ .../output-expected/command_line | 1 + .../output-expected/return_value | 1 + .../output-expected/stdout | 4 ++++ .../identical-bits/output-expected/command_line | 1 + .../identical-bits/output-expected/return_value | 1 + .../skdiff/identical-bits/output-expected/stdout | 4 ++++ 7 files changed, 28 insertions(+) create mode 100644 tools/tests/skdiff/identical-bits-or-pixels/output-expected/command_line create mode 100644 tools/tests/skdiff/identical-bits-or-pixels/output-expected/return_value create mode 100644 tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout create mode 100644 tools/tests/skdiff/identical-bits/output-expected/command_line create mode 100644 tools/tests/skdiff/identical-bits/output-expected/return_value create mode 100644 tools/tests/skdiff/identical-bits/output-expected/stdout diff --git a/tools/tests/run.sh b/tools/tests/run.sh index a3e610df1..f6dbe27ca 100755 --- a/tools/tests/run.sh +++ b/tools/tests/run.sh @@ -39,6 +39,22 @@ function skdiff_test { } SKDIFF_TESTDIR=tools/tests/skdiff + +# Run skdiff over a variety of file pair types: identical bits, identical +# pixels, missing from baseDir, etc. +# TODO: In the near future, skdiff will return a nonzero exit code in this case. skdiff_test "$SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test1" + +# Same as above but without generating HTML output files. +# TODO: In the near future, skdiff will return a nonzero exit code in this case. skdiff_test "--nodiffs $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test2" + +# Run skdiff over just the files that have identical bits, to validate any +# behavior/return value differences in this case. +skdiff_test "--nodiffs --match identical-bits $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits" + +# Run skdiff over just the files that have identical bits or identical pixels, +# to validate any behavior/return value differences in this case. +skdiff_test "--nodiffs --match identical-bits --match identical-pixels $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits-or-pixels" + echo "All tests passed." diff --git a/tools/tests/skdiff/identical-bits-or-pixels/output-expected/command_line b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/command_line new file mode 100644 index 000000000..8a2066790 --- /dev/null +++ b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/command_line @@ -0,0 +1 @@ +out/Debug/skdiff --nodiffs --match identical-bits --match identical-pixels tools/tests/skdiff/baseDir tools/tests/skdiff/comparisonDir tools/tests/skdiff/identical-bits-or-pixels/output-actual diff --git a/tools/tests/skdiff/identical-bits-or-pixels/output-expected/return_value b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/return_value new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/return_value @@ -0,0 +1 @@ +0 diff --git a/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout new file mode 100644 index 000000000..937f8c77c --- /dev/null +++ b/tools/tests/skdiff/identical-bits-or-pixels/output-expected/stdout @@ -0,0 +1,4 @@ +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/] +3 of 3 images matched. diff --git a/tools/tests/skdiff/identical-bits/output-expected/command_line b/tools/tests/skdiff/identical-bits/output-expected/command_line new file mode 100644 index 000000000..49f9ad5e7 --- /dev/null +++ b/tools/tests/skdiff/identical-bits/output-expected/command_line @@ -0,0 +1 @@ +out/Debug/skdiff --nodiffs --match identical-bits tools/tests/skdiff/baseDir tools/tests/skdiff/comparisonDir tools/tests/skdiff/identical-bits/output-actual diff --git a/tools/tests/skdiff/identical-bits/output-expected/return_value b/tools/tests/skdiff/identical-bits/output-expected/return_value new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tools/tests/skdiff/identical-bits/output-expected/return_value @@ -0,0 +1 @@ +0 diff --git a/tools/tests/skdiff/identical-bits/output-expected/stdout b/tools/tests/skdiff/identical-bits/output-expected/stdout new file mode 100644 index 000000000..ccb24f8be --- /dev/null +++ b/tools/tests/skdiff/identical-bits/output-expected/stdout @@ -0,0 +1,4 @@ +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/] +2 of 2 images matched.