Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Self-tests for gm, based on tools/tests/run.sh | 3 # Self-tests for gm, based on tools/tests/run.sh |
| 4 # | 4 # |
| 5 # These tests are run by the Skia_PerCommit_House_Keeping bot at every commit, | 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! | 6 # so make sure that they still pass when you make changes to gm! |
| 7 # | 7 # |
| 8 # To generate new baselines when gm behavior changes, run gm/tests/rebaseline.sh | 8 # To generate new baselines when gm behavior changes, run gm/tests/rebaseline.sh |
| 9 # | 9 # |
| 10 # TODO: because this is written as a shell script (instead of, say, Python) | 10 # TODO: because this is written as a shell script (instead of, say, Python) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 173 |
| 174 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy | 174 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy |
| 175 mkdir -p $THIS_IMAGE_DIR | 175 mkdir -p $THIS_IMAGE_DIR |
| 176 $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR | 176 $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR |
| 177 mv $THIS_IMAGE_DIR/selftest2_8888.png $THIS_IMAGE_DIR/selftest1_8888.png | 177 mv $THIS_IMAGE_DIR/selftest2_8888.png $THIS_IMAGE_DIR/selftest1_8888.png |
| 178 mv $THIS_IMAGE_DIR/selftest2_565.png $THIS_IMAGE_DIR/selftest1_565.png | 178 mv $THIS_IMAGE_DIR/selftest2_565.png $THIS_IMAGE_DIR/selftest1_565.png |
| 179 $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ | 179 $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
| 180 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json | 180 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json |
| 181 | 181 |
| 182 mkdir -p $IMAGES_DIR/empty-dir | 182 mkdir -p $IMAGES_DIR/empty-dir |
| 183 | |
| 184 echo "# Comment line" >$GM_IGNORE_FAILURES_FILE | |
| 185 echo "" >>$GM_IGNORE_FAILURES_FILE | |
| 186 echo "8888/selfte" >>$GM_IGNORE_FAILURES_FILE | |
|
borenet
2013/10/21 17:19:41
Confused about why this is "selfte" but it's consi
epoger
2013/10/21 17:25:20
Added some commentary.
| |
| 183 } | 187 } |
| 184 | 188 |
| 185 GM_TESTDIR=gm/tests | 189 GM_TESTDIR=gm/tests |
| 186 GM_INPUTS=$GM_TESTDIR/inputs | 190 GM_INPUTS=$GM_TESTDIR/inputs |
| 187 GM_OUTPUTS=$GM_TESTDIR/outputs | 191 GM_OUTPUTS=$GM_TESTDIR/outputs |
| 188 GM_TEMPFILES=$GM_TESTDIR/tempfiles | 192 GM_TEMPFILES=$GM_TESTDIR/tempfiles |
| 193 GM_IGNORE_FAILURES_FILE=$GM_INPUTS/ignored-tests.txt | |
| 189 | 194 |
| 190 create_inputs_dir $GM_INPUTS | 195 create_inputs_dir $GM_INPUTS |
| 191 | 196 |
| 192 # Compare generated image against an input image file with identical bytes. | 197 # Compare generated image against an input image file with identical bytes. |
| 193 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-bytes" "$GM_OUTPUTS/compared-against-identical-bytes-images" | 198 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-bytes" "$GM_OUTPUTS/compared-against-identical-bytes-images" |
| 194 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" | 199 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" |
| 195 | 200 |
| 196 # Compare generated image against an input image file with identical pixels but different PNG encoding. | 201 # Compare generated image against an input image file with identical pixels but different PNG encoding. |
| 197 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-pixels" "$GM_OUTPUTS/compared-against-identical-pixels-images" | 202 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-pixels" "$GM_OUTPUTS/compared-against-identical-pixels-images" |
| 198 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" | 203 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" |
| 199 | 204 |
| 200 # Compare generated image against an input image file with different pixels. | 205 # Compare generated image against an input image file with different pixels. |
| 201 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/d ifferent-pixels" "$GM_OUTPUTS/compared-against-different-pixels-images" | 206 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/d ifferent-pixels" "$GM_OUTPUTS/compared-against-different-pixels-images" |
| 202 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" | 207 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" |
| 203 | 208 |
| 204 # Exercise --ignoreFailuresFile flag. | 209 # Exercise --ignoreFailuresFile flag. |
| 205 FAILURES_FILE="$GM_INPUTS/ignoreFailureFile" | 210 gm_test "--verbose --hierarchy --match selftest1 --ignoreFailuresFile $GM_IGNORE _FAILURES_FILE $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OUTPUTS/i gnoring-one-test" |
| 206 echo "# Comment line" >$FAILURES_FILE | |
| 207 echo "" >>$FAILURES_FILE | |
| 208 echo "8888/selfte" >>$FAILURES_FILE | |
| 209 gm_test "--verbose --hierarchy --match selftest1 --ignoreFailuresFile $FAILURES_ FILE $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OUTPUTS/ignoring-on e-test" | |
| 210 | 211 |
| 211 # Compare different pixels, but with a SUBSET of the expectations marked as | 212 # Compare different pixels, but with a SUBSET of the expectations marked as |
| 212 # ignore-failure. | 213 # ignore-failure. |
| 213 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels-ignore-some-failures.json" "$GM_OUTPUTS/ignoring-some-failures" | 214 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels-ignore-some-failures.json" "$GM_OUTPUTS/ignoring-some-failures" |
| 214 | 215 |
| 215 # Compare generated image against an empty "expected image" dir. | 216 # Compare generated image against an empty "expected image" dir. |
| 216 # Even the tests that have been marked as ignore-failure should show up as | 217 # Even the tests that have been marked as ignore-failure should show up as |
| 217 # no-comparison. | 218 # no-comparison. |
| 218 gm_test "--verbose --hierarchy --match selftest1 --ignoreTests 8888 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/compared-against-empty-dir" | 219 gm_test "--verbose --hierarchy --match selftest1 --ignoreFailuresFile $GM_IGNORE _FAILURES_FILE $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/compared-ag ainst-empty-dir" |
| 219 | 220 |
| 220 # Compare generated image against a nonexistent "expected image" dir. | 221 # Compare generated image against a nonexistent "expected image" dir. |
| 221 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere" "$GM_OUTPUTS/compared-against-nonexistent-dir" | 222 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere" "$GM_OUTPUTS/compared-against-nonexistent-dir" |
| 222 | 223 |
| 223 # Compare generated image against an empty "expected image" dir, but NOT in verb ose mode. | 224 # Compare generated image against an empty "expected image" dir, but NOT in verb ose mode. |
| 224 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose" | 225 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose" |
| 225 | 226 |
| 226 # Add pdf to the list of configs. | 227 # Add pdf to the list of configs. |
| 227 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json /identical-bytes.json" "$GM_OUTPUTS/add-config-pdf" | 228 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json /identical-bytes.json" "$GM_OUTPUTS/add-config-pdf" |
| 228 | 229 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 255 for CASE in $FAILING_CASES; do | 256 for CASE in $FAILING_CASES; do |
| 256 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" | 257 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" |
| 257 done | 258 done |
| 258 | 259 |
| 259 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 260 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
| 260 echo "All tests passed." | 261 echo "All tests passed." |
| 261 exit 0 | 262 exit 0 |
| 262 else | 263 else |
| 263 exit 1 | 264 exit 1 |
| 264 fi | 265 fi |
| OLD | NEW |