| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Self-tests for gm, based on tools/tests/run.sh |
| epoger@google.com | 454008a | 2012-11-13 20:46:50 +0000 | [diff] [blame] | 4 | # |
| 5 | # These tests are run by the Skia_PerCommit_House_Keeping bot at every commit, |
| 6 | # so make sure that they still pass when you make changes to gm! |
| 7 | # |
| epoger@google.com | 0b62b3d | 2013-03-20 17:59:28 +0000 | [diff] [blame] | 8 | # To generate new baselines when gm behavior changes, run gm/tests/rebaseline.sh |
| 9 | # |
| commit-bot@chromium.org | c61c3c3 | 2013-03-01 15:32:34 +0000 | [diff] [blame] | 10 | # TODO: because this is written as a shell script (instead of, say, Python) |
| 11 | # it only runs on Linux and Mac. |
| epoger@google.com | 3aa3358 | 2013-01-02 15:53:25 +0000 | [diff] [blame] | 12 | # See https://code.google.com/p/skia/issues/detail?id=677 |
| 13 | # ('make tools/tests/run.sh work cross-platform') |
| epoger@google.com | 454008a | 2012-11-13 20:46:50 +0000 | [diff] [blame] | 14 | # Ideally, these tests should pass on all development platforms... |
| 15 | # otherwise, how can developers be expected to test them before committing a |
| 16 | # change? |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 17 | |
| 18 | # cd into .../trunk so all the paths will work |
| 19 | cd $(dirname $0)/../.. |
| 20 | |
| 21 | # TODO(epoger): make it look in Release and/or Debug |
| 22 | GM_BINARY=out/Debug/gm |
| 23 | |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 24 | OUTPUT_ACTUAL_SUBDIR=output-actual |
| 25 | OUTPUT_EXPECTED_SUBDIR=output-expected |
| scroggo@google.com | 09fd4d2 | 2013-03-20 14:20:18 +0000 | [diff] [blame] | 26 | CONFIGS="--config 8888 565" |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 27 | |
| epoger@google.com | 0cc99cf | 2013-04-26 17:45:06 +0000 | [diff] [blame] | 28 | ENCOUNTERED_ANY_ERRORS=0 |
| 29 | |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 30 | # Compare contents of all files within directories $1 and $2, |
| 31 | # EXCEPT for any dotfiles. |
| 32 | # If there are any differences, a description is written to stdout and |
| 33 | # we exit with a nonzero return value. |
| 34 | # Otherwise, we write nothing to stdout and return. |
| 35 | function compare_directories { |
| 36 | if [ $# != 2 ]; then |
| 37 | echo "compare_directories requires exactly 2 parameters, got $#" |
| 38 | exit 1 |
| 39 | fi |
| 40 | diff -r --exclude=.* $1 $2 |
| 41 | if [ $? != 0 ]; then |
| 42 | echo "failed in: compare_directories $1 $2" |
| epoger@google.com | 0cc99cf | 2013-04-26 17:45:06 +0000 | [diff] [blame] | 43 | ENCOUNTERED_ANY_ERRORS=1 |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 44 | fi |
| 45 | } |
| 46 | |
| epoger@google.com | 26515ba | 2013-05-14 18:58:12 +0000 | [diff] [blame] | 47 | # Run a command, and validate that it succeeds (returns 0). |
| 48 | function assert_passes { |
| 49 | COMMAND="$1" |
| 50 | OUTPUT=$($COMMAND 2>&1) |
| 51 | if [ $? != 0 ]; then |
| 52 | echo "This command was supposed to pass, but failed: [$COMMAND]" |
| 53 | echo $OUTPUT |
| 54 | ENCOUNTERED_ANY_ERRORS=1 |
| 55 | fi |
| 56 | } |
| 57 | |
| 58 | # Run a command, and validate that it fails (returns nonzero). |
| 59 | function assert_fails { |
| 60 | COMMAND="$1" |
| 61 | OUTPUT=$($COMMAND 2>&1) |
| 62 | if [ $? == 0 ]; then |
| 63 | echo "This command was supposed to fail, but passed: [$COMMAND]" |
| 64 | echo $OUTPUT |
| 65 | ENCOUNTERED_ANY_ERRORS=1 |
| 66 | fi |
| 67 | } |
| 68 | |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 69 | # Run gm... |
| 70 | # - with the arguments in $1 |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 71 | # - writing stdout into $2/$OUTPUT_ACTUAL_SUBDIR/stdout |
| 72 | # - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt |
| 73 | # - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value |
| 74 | # Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR . |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 75 | function gm_test { |
| 76 | if [ $# != 2 ]; then |
| 77 | echo "gm_test requires exactly 2 parameters, got $#" |
| 78 | exit 1 |
| 79 | fi |
| 80 | GM_ARGS="$1" |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 81 | ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" |
| 82 | EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" |
| 83 | JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 84 | |
| 85 | rm -rf $ACTUAL_OUTPUT_DIR |
| 86 | mkdir -p $ACTUAL_OUTPUT_DIR |
| epoger@google.com | fed9db6 | 2013-05-08 14:10:28 +0000 | [diff] [blame] | 87 | |
| epoger@google.com | ee2c3b9 | 2013-05-09 18:09:06 +0000 | [diff] [blame] | 88 | COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE --writePath $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath" |
| epoger@google.com | fed9db6 | 2013-05-08 14:10:28 +0000 | [diff] [blame] | 89 | |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 90 | echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
| epoger@google.com | 5efdd0c | 2013-03-13 14:18:40 +0000 | [diff] [blame] | 91 | $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 92 | echo $? >$ACTUAL_OUTPUT_DIR/return_value |
| 93 | |
| epoger@google.com | 80d4478 | 2013-01-18 20:03:58 +0000 | [diff] [blame] | 94 | # Only compare selected lines in the stdout, to ignore any spurious lines |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 95 | # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . |
| 96 | # |
| 97 | # TODO(epoger): This is still hacky... we need to rewrite this script in |
| 98 | # Python soon, and make stuff like this more maintainable. |
| epoger@google.com | 5efdd0c | 2013-03-13 14:18:40 +0000 | [diff] [blame] | 99 | grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp |
| epoger@google.com | 98204f9 | 2013-01-16 04:19:01 +0000 | [diff] [blame] | 100 | mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout |
| epoger@google.com | 5efdd0c | 2013-03-13 14:18:40 +0000 | [diff] [blame] | 101 | grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp |
| 102 | mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr |
| epoger@google.com | 98204f9 | 2013-01-16 04:19:01 +0000 | [diff] [blame] | 103 | |
| epoger@google.com | ee2c3b9 | 2013-05-09 18:09:06 +0000 | [diff] [blame] | 104 | # Replace image file contents with just the filename, for two reasons: |
| 105 | # 1. Image file encoding may vary by platform |
| 106 | # 2. https://code.google.com/p/chromium/issues/detail?id=169600 |
| 107 | # ('gcl/upload.py fail to upload binary files to rietveld') |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 108 | for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do |
| epoger@google.com | ee2c3b9 | 2013-05-09 18:09:06 +0000 | [diff] [blame] | 109 | echo "[contents of $IMAGEFILE]" >$IMAGEFILE |
| 110 | done |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 111 | if [ -d $ACTUAL_OUTPUT_DIR/mismatchPath ]; then |
| 112 | for MISMATCHDIR in $(find $ACTUAL_OUTPUT_DIR/mismatchPath -mindepth 1 -type d); do |
| 113 | echo "Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories." >$MISMATCHDIR/bogusfile |
| 114 | done |
| 115 | fi |
| epoger@google.com | fed9db6 | 2013-05-08 14:10:28 +0000 | [diff] [blame] | 116 | |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 117 | compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
| 118 | } |
| 119 | |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 120 | # Create input dir (at path $1) with expectations (both image and json) |
| 121 | # that gm will match or mismatch as appropriate. |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 122 | # |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 123 | # We used to check these files into SVN, but then we needed to rebaseline them |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 124 | # when our drawing changed at all... so, as proposed in |
| 125 | # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them |
| 126 | # new each time. |
| 127 | function create_inputs_dir { |
| 128 | if [ $# != 1 ]; then |
| 129 | echo "create_inputs_dir requires exactly 1 parameter, got $#" |
| 130 | exit 1 |
| 131 | fi |
| 132 | INPUTS_DIR="$1" |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 133 | IMAGES_DIR=$INPUTS_DIR/images |
| 134 | JSON_DIR=$INPUTS_DIR/json |
| 135 | mkdir -p $IMAGES_DIR $JSON_DIR |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 136 | |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 137 | THIS_IMAGE_DIR=$IMAGES_DIR/identical-bytes |
| 138 | mkdir -p $THIS_IMAGE_DIR |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 139 | # Run GM to write out the images actually generated. |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 140 | $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 141 | # Run GM again to read in those images and write them out as a JSON summary. |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 142 | $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
| scroggo@google.com | 09fd4d2 | 2013-03-20 14:20:18 +0000 | [diff] [blame] | 143 | --writeJsonSummaryPath $JSON_DIR/identical-bytes.json |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 144 | |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 145 | THIS_IMAGE_DIR=$IMAGES_DIR/identical-pixels |
| 146 | mkdir -p $THIS_IMAGE_DIR |
| 147 | $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 148 | echo "more bytes that do not change the image pixels" \ |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 149 | >> $THIS_IMAGE_DIR/8888/selftest1.png |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 150 | echo "more bytes that do not change the image pixels" \ |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 151 | >> $THIS_IMAGE_DIR/565/selftest1.png |
| 152 | $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
| scroggo@google.com | 09fd4d2 | 2013-03-20 14:20:18 +0000 | [diff] [blame] | 153 | --writeJsonSummaryPath $JSON_DIR/identical-pixels.json |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 154 | |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 155 | THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels |
| 156 | mkdir -p $THIS_IMAGE_DIR |
| 157 | $GM_BINARY --hierarchy --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR |
| 158 | mv $THIS_IMAGE_DIR/8888/selftest2.png $THIS_IMAGE_DIR/8888/selftest1.png |
| 159 | mv $THIS_IMAGE_DIR/565/selftest2.png $THIS_IMAGE_DIR/565/selftest1.png |
| 160 | $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
| scroggo@google.com | 09fd4d2 | 2013-03-20 14:20:18 +0000 | [diff] [blame] | 161 | --writeJsonSummaryPath $JSON_DIR/different-pixels.json |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 162 | |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 163 | THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy |
| 164 | mkdir -p $THIS_IMAGE_DIR |
| 165 | $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR |
| 166 | mv $THIS_IMAGE_DIR/selftest2_8888.png $THIS_IMAGE_DIR/selftest1_8888.png |
| 167 | mv $THIS_IMAGE_DIR/selftest2_565.png $THIS_IMAGE_DIR/selftest1_565.png |
| 168 | $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
| 169 | --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json |
| 170 | |
| epoger@google.com | e460a47 | 2013-02-06 18:41:04 +0000 | [diff] [blame] | 171 | mkdir -p $IMAGES_DIR/empty-dir |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 172 | } |
| 173 | |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 174 | GM_TESTDIR=gm/tests |
| 175 | GM_INPUTS=$GM_TESTDIR/inputs |
| 176 | GM_OUTPUTS=$GM_TESTDIR/outputs |
| epoger@google.com | 3726960 | 2013-01-19 04:21:27 +0000 | [diff] [blame] | 177 | GM_TEMPFILES=$GM_TESTDIR/tempfiles |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 178 | |
| epoger@google.com | 407f8da | 2013-01-18 19:19:47 +0000 | [diff] [blame] | 179 | create_inputs_dir $GM_INPUTS |
| 180 | |
| epoger@google.com | 570aafe | 2012-11-28 20:08:32 +0000 | [diff] [blame] | 181 | # Compare generated image against an input image file with identical bytes. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 182 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/identical-bytes" "$GM_OUTPUTS/compared-against-identical-bytes-images" |
| 183 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/identical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 184 | |
| epoger@google.com | 570aafe | 2012-11-28 20:08:32 +0000 | [diff] [blame] | 185 | # Compare generated image against an input image file with identical pixels but different PNG encoding. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 186 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/identical-pixels" "$GM_OUTPUTS/compared-against-identical-pixels-images" |
| 187 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" |
| epoger@google.com | 570aafe | 2012-11-28 20:08:32 +0000 | [diff] [blame] | 188 | |
| 189 | # Compare generated image against an input image file with different pixels. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 190 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/different-pixels" "$GM_OUTPUTS/compared-against-different-pixels-images" |
| 191 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" |
| epoger@google.com | a413a53 | 2012-11-12 18:04:51 +0000 | [diff] [blame] | 192 | |
| epoger@google.com | ee8a8e3 | 2012-12-18 19:13:49 +0000 | [diff] [blame] | 193 | # Compare generated image against an empty "expected image" dir. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 194 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/compared-against-empty-dir" |
| 195 | |
| epoger@google.com | 318a059 | 2013-04-12 19:05:57 +0000 | [diff] [blame] | 196 | # Compare generated image against a nonexistent "expected image" dir. |
| 197 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere" "$GM_OUTPUTS/compared-against-nonexistent-dir" |
| 198 | |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 199 | # Compare generated image against an empty "expected image" dir, but NOT in verbose mode. |
| 200 | gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose" |
| epoger@google.com | ee8a8e3 | 2012-12-18 19:13:49 +0000 | [diff] [blame] | 201 | |
| epoger@google.com | 9c56a8d | 2012-12-20 18:34:29 +0000 | [diff] [blame] | 202 | # If run without "-r", the JSON's "actual-results" section should contain |
| 203 | # actual checksums marked as "failure-ignored", but the "expected-results" |
| 204 | # section should be empty. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 205 | gm_test "--verbose --hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readpath" |
| epoger@google.com | 9c56a8d | 2012-12-20 18:34:29 +0000 | [diff] [blame] | 206 | |
| epoger@google.com | caac3db | 2013-04-04 19:23:11 +0000 | [diff] [blame] | 207 | # Test what happens if a subset of the renderModes fail (e.g. pipe) |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 208 | gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-failure" |
| epoger@google.com | caac3db | 2013-04-04 19:23:11 +0000 | [diff] [blame] | 209 | |
| epoger@google.com | c8263e7 | 2013-04-10 12:17:34 +0000 | [diff] [blame] | 210 | # Confirm that IntentionallySkipped tests are recorded as such. |
| epoger@google.com | 51dbabe | 2013-04-10 15:24:53 +0000 | [diff] [blame] | 211 | gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUTS/intentionally-skipped-tests" |
| epoger@google.com | c8263e7 | 2013-04-10 12:17:34 +0000 | [diff] [blame] | 212 | |
| epoger@google.com | 5079d2c | 2013-04-12 14:11:21 +0000 | [diff] [blame] | 213 | # Ignore some error types (including ExpectationsMismatch) |
| 214 | gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OUTPUTS/ignore-expectations-mismatch" |
| 215 | |
| epoger@google.com | 37d747d | 2013-05-21 15:41:35 +0000 | [diff] [blame] | 216 | # Test non-hierarchical mode. |
| 217 | gm_test "--verbose --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels-no-hierarchy.json" "$GM_OUTPUTS/no-hierarchy" |
| 218 | |
| epoger@google.com | 6f7f14d | 2013-06-19 18:28:31 +0000 | [diff] [blame^] | 219 | # Try writing out actual images using checksum-based filenames, like we do when |
| 220 | # uploading to Google Storage. |
| 221 | gm_test "--verbose --writeChecksumBasedFilenames --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels-no-hierarchy.json" "$GM_OUTPUTS/checksum-based-filenames" |
| 222 | |
| epoger@google.com | a55e48d | 2013-05-21 16:06:40 +0000 | [diff] [blame] | 223 | # Exercise display_json_results.py |
| epoger@google.com | 26515ba | 2013-05-14 18:58:12 +0000 | [diff] [blame] | 224 | PASSING_CASES="compared-against-identical-bytes-json compared-against-identical-pixels-json" |
| 225 | FAILING_CASES="compared-against-different-pixels-json" |
| 226 | for CASE in $PASSING_CASES; do |
| epoger@google.com | a55e48d | 2013-05-21 16:06:40 +0000 | [diff] [blame] | 227 | assert_passes "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPECTED_SUBDIR/json-summary.txt" |
| epoger@google.com | 26515ba | 2013-05-14 18:58:12 +0000 | [diff] [blame] | 228 | done |
| 229 | for CASE in $FAILING_CASES; do |
| epoger@google.com | a55e48d | 2013-05-21 16:06:40 +0000 | [diff] [blame] | 230 | assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPECTED_SUBDIR/json-summary.txt" |
| epoger@google.com | 26515ba | 2013-05-14 18:58:12 +0000 | [diff] [blame] | 231 | done |
| 232 | |
| epoger@google.com | 0cc99cf | 2013-04-26 17:45:06 +0000 | [diff] [blame] | 233 | if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
| 234 | echo "All tests passed." |
| 235 | exit 0 |
| 236 | else |
| 237 | exit 1 |
| 238 | fi |