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 "# ignore any test runs whose filename contains '8888/selfte'" >>$GM_IGNO
RE_FAILURES_FILE |
| 187 echo "# (in other words, config is 8888 and test name starts with 'selfte')"
>>$GM_IGNORE_FAILURES_FILE |
| 188 echo "8888/selfte" >>$GM_IGNORE_FAILURES_FILE |
183 } | 189 } |
184 | 190 |
185 GM_TESTDIR=gm/tests | 191 GM_TESTDIR=gm/tests |
186 GM_INPUTS=$GM_TESTDIR/inputs | 192 GM_INPUTS=$GM_TESTDIR/inputs |
187 GM_OUTPUTS=$GM_TESTDIR/outputs | 193 GM_OUTPUTS=$GM_TESTDIR/outputs |
188 GM_TEMPFILES=$GM_TESTDIR/tempfiles | 194 GM_TEMPFILES=$GM_TESTDIR/tempfiles |
| 195 GM_IGNORE_FAILURES_FILE=$GM_INPUTS/ignored-tests.txt |
189 | 196 |
190 create_inputs_dir $GM_INPUTS | 197 create_inputs_dir $GM_INPUTS |
191 | 198 |
192 # Compare generated image against an input image file with identical bytes. | 199 # 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" | 200 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" | 201 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide
ntical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" |
195 | 202 |
196 # Compare generated image against an input image file with identical pixels but
different PNG encoding. | 203 # 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" | 204 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" | 205 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide
ntical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" |
199 | 206 |
200 # Compare generated image against an input image file with different pixels. | 207 # 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" | 208 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" | 209 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif
ferent-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" |
203 | 210 |
204 # Exercise --ignoreFailuresFile flag. | 211 # Exercise --ignoreFailuresFile flag. |
205 FAILURES_FILE="$GM_INPUTS/ignoreFailureFile" | 212 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 | 213 |
211 # Compare different pixels, but with a SUBSET of the expectations marked as | 214 # Compare different pixels, but with a SUBSET of the expectations marked as |
212 # ignore-failure. | 215 # 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" | 216 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif
ferent-pixels-ignore-some-failures.json" "$GM_OUTPUTS/ignoring-some-failures" |
214 | 217 |
215 # Compare generated image against an empty "expected image" dir. | 218 # Compare generated image against an empty "expected image" dir. |
216 # Even the tests that have been marked as ignore-failure should show up as | 219 # Even the tests that have been marked as ignore-failure should show up as |
217 # no-comparison. | 220 # no-comparison. |
218 gm_test "--verbose --hierarchy --match selftest1 --ignoreTests 8888 $CONFIGS -r
$GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/compared-against-empty-dir" | 221 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 | 222 |
220 # Compare generated image against a nonexistent "expected image" dir. | 223 # 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" | 224 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere"
"$GM_OUTPUTS/compared-against-nonexistent-dir" |
222 | 225 |
223 # Compare generated image against an empty "expected image" dir, but NOT in verb
ose mode. | 226 # 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" | 227 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir"
"$GM_OUTPUTS/nonverbose" |
225 | 228 |
226 # Add pdf to the list of configs. | 229 # 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" | 230 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json
/identical-bytes.json" "$GM_OUTPUTS/add-config-pdf" |
228 | 231 |
(...skipping 26 matching lines...) Expand all Loading... |
255 for CASE in $FAILING_CASES; do | 258 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" | 259 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE
CTED_SUBDIR/json-summary.txt" |
257 done | 260 done |
258 | 261 |
259 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 262 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
260 echo "All tests passed." | 263 echo "All tests passed." |
261 exit 0 | 264 exit 0 |
262 else | 265 else |
263 exit 1 | 266 exit 1 |
264 fi | 267 fi |
OLD | NEW |