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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 --writeJsonSummaryPath $JSON_DIR/identical-pixels.json | 156 --writeJsonSummaryPath $JSON_DIR/identical-pixels.json |
157 | 157 |
158 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels | 158 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels |
159 mkdir -p $THIS_IMAGE_DIR | 159 mkdir -p $THIS_IMAGE_DIR |
160 $GM_BINARY --hierarchy --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR | 160 $GM_BINARY --hierarchy --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR |
161 mv $THIS_IMAGE_DIR/8888/selftest2.png $THIS_IMAGE_DIR/8888/selftest1.png | 161 mv $THIS_IMAGE_DIR/8888/selftest2.png $THIS_IMAGE_DIR/8888/selftest1.png |
162 mv $THIS_IMAGE_DIR/565/selftest2.png $THIS_IMAGE_DIR/565/selftest1.png | 162 mv $THIS_IMAGE_DIR/565/selftest2.png $THIS_IMAGE_DIR/565/selftest1.png |
163 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ | 163 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
164 --writeJsonSummaryPath $JSON_DIR/different-pixels.json | 164 --writeJsonSummaryPath $JSON_DIR/different-pixels.json |
165 | 165 |
166 # Create another JSON expectations file which is identical to | |
167 # different-pixels.json, but in which the *first* ignore-failure is changed | |
168 # from false to true. | |
169 OLD='"ignore-failure" : false' | |
170 NEW='"ignore-failure" : true' | |
171 sed -e "0,/$OLD/{s/$OLD/$NEW/}" $JSON_DIR/different-pixels.json \ | |
epoger
2013/08/30 19:53:02
Patchset 2 modified the input file such that exact
| |
172 >$JSON_DIR/different-pixels-ignore-some-failures.json | |
173 | |
166 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy | 174 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy |
167 mkdir -p $THIS_IMAGE_DIR | 175 mkdir -p $THIS_IMAGE_DIR |
168 $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR | 176 $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR |
169 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 |
170 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 |
171 $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ | 179 $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ |
172 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json | 180 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json |
173 | 181 |
174 mkdir -p $IMAGES_DIR/empty-dir | 182 mkdir -p $IMAGES_DIR/empty-dir |
175 } | 183 } |
(...skipping 10 matching lines...) Expand all Loading... | |
186 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" | 194 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-bytes.json" "$GM_OUTPUTS/compared-against-identical-bytes-json" |
187 | 195 |
188 # Compare generated image against an input image file with identical pixels but different PNG encoding. | 196 # Compare generated image against an input image file with identical pixels but different PNG encoding. |
189 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-pixels" "$GM_OUTPUTS/compared-against-identical-pixels-images" | 197 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/i dentical-pixels" "$GM_OUTPUTS/compared-against-identical-pixels-images" |
190 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" | 198 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/ide ntical-pixels.json" "$GM_OUTPUTS/compared-against-identical-pixels-json" |
191 | 199 |
192 # Compare generated image against an input image file with different pixels. | 200 # Compare generated image against an input image file with different pixels. |
193 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/d ifferent-pixels" "$GM_OUTPUTS/compared-against-different-pixels-images" | 201 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/d ifferent-pixels" "$GM_OUTPUTS/compared-against-different-pixels-images" |
194 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" | 202 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels.json" "$GM_OUTPUTS/compared-against-different-pixels-json" |
195 | 203 |
204 # Compare different pixels, but with a SUBSET of the expectations marked as | |
205 # ignore-failure. | |
206 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/dif ferent-pixels-ignore-some-failures.json" "$GM_OUTPUTS/ignoring-some-failures" | |
207 | |
196 # Compare generated image against an empty "expected image" dir. | 208 # Compare generated image against an empty "expected image" dir. |
197 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/e mpty-dir" "$GM_OUTPUTS/compared-against-empty-dir" | 209 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/e mpty-dir" "$GM_OUTPUTS/compared-against-empty-dir" |
198 | 210 |
199 # Compare generated image against a nonexistent "expected image" dir. | 211 # Compare generated image against a nonexistent "expected image" dir. |
200 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere" "$GM_OUTPUTS/compared-against-nonexistent-dir" | 212 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere" "$GM_OUTPUTS/compared-against-nonexistent-dir" |
201 | 213 |
202 # Compare generated image against an empty "expected image" dir, but NOT in verb ose mode. | 214 # Compare generated image against an empty "expected image" dir, but NOT in verb ose mode. |
203 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose" | 215 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir" "$GM_OUTPUTS/nonverbose" |
204 | 216 |
205 # Add pdf to the list of configs. | 217 # Add pdf to the list of configs. |
206 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json /identical-bytes.json" "$GM_OUTPUTS/add-config-pdf" | 218 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS pdf -r $GM_INPUTS/json /identical-bytes.json" "$GM_OUTPUTS/add-config-pdf" |
207 | 219 |
208 # If run without "-r", the JSON's "actual-results" section should contain | 220 # Test what happens if run without -r (no expected-results.json to compare |
209 # actual checksums marked as "failure-ignored", but the "expected-results" | 221 # against). |
210 # section should be empty. | |
211 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readp ath" | 222 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readp ath" |
212 | 223 |
213 # Test what happens if a subset of the renderModes fail (e.g. pipe) | 224 # Test what happens if a subset of the renderModes fail (e.g. pipe) |
214 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $ CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai lure" | 225 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $ CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai lure" |
215 | 226 |
216 # Confirm that IntentionallySkipped tests are recorded as such. | 227 # Confirm that IntentionallySkipped tests are recorded as such. |
217 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests" | 228 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests" |
218 | 229 |
219 # Ignore some error types (including ExpectationsMismatch) | 230 # Ignore some error types (including ExpectationsMismatch) |
220 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU TPUTS/ignore-expectations-mismatch" | 231 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU TPUTS/ignore-expectations-mismatch" |
(...skipping 14 matching lines...) Expand all Loading... | |
235 for CASE in $FAILING_CASES; do | 246 for CASE in $FAILING_CASES; do |
236 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" | 247 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" |
237 done | 248 done |
238 | 249 |
239 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 250 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
240 echo "All tests passed." | 251 echo "All tests passed." |
241 exit 0 | 252 exit 0 |
242 else | 253 else |
243 exit 1 | 254 exit 1 |
244 fi | 255 fi |
OLD | NEW |