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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp | 101 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp |
102 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr | 102 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr |
103 | 103 |
104 # Replace image file contents with just the filename, for two reasons: | 104 # Replace image file contents with just the filename, for two reasons: |
105 # 1. Image file encoding may vary by platform | 105 # 1. Image file encoding may vary by platform |
106 # 2. https://code.google.com/p/chromium/issues/detail?id=169600 | 106 # 2. https://code.google.com/p/chromium/issues/detail?id=169600 |
107 # ('gcl/upload.py fail to upload binary files to rietveld') | 107 # ('gcl/upload.py fail to upload binary files to rietveld') |
108 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do | 108 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do |
109 echo "[contents of $IMAGEFILE]" >$IMAGEFILE | 109 echo "[contents of $IMAGEFILE]" >$IMAGEFILE |
110 done | 110 done |
| 111 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.pdf); do |
| 112 echo "[contents of $IMAGEFILE]" >$IMAGEFILE |
| 113 done |
111 | 114 |
112 # Add a file to any empty subdirectories. | 115 # Add a file to any empty subdirectories. |
113 for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do | 116 for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do |
114 echo "Created additional file to make sure directory isn't empty, because se
lf-test cannot handle empty directories." >$DIR/bogusfile | 117 echo "Created additional file to make sure directory isn't empty, because se
lf-test cannot handle empty directories." >$DIR/bogusfile |
115 done | 118 done |
116 | 119 |
117 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 120 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
118 } | 121 } |
119 | 122 |
120 # Create input dir (at path $1) with expectations (both image and json) | 123 # Create input dir (at path $1) with expectations (both image and json) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 195 |
193 # Compare generated image against an empty "expected image" dir. | 196 # Compare generated image against an empty "expected image" dir. |
194 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/e
mpty-dir" "$GM_OUTPUTS/compared-against-empty-dir" | 197 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/e
mpty-dir" "$GM_OUTPUTS/compared-against-empty-dir" |
195 | 198 |
196 # Compare generated image against a nonexistent "expected image" dir. | 199 # 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" | 200 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS -r ../path/to/nowhere"
"$GM_OUTPUTS/compared-against-nonexistent-dir" |
198 | 201 |
199 # Compare generated image against an empty "expected image" dir, but NOT in verb
ose mode. | 202 # Compare generated image against an empty "expected image" dir, but NOT in verb
ose mode. |
200 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir"
"$GM_OUTPUTS/nonverbose" | 203 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir"
"$GM_OUTPUTS/nonverbose" |
201 | 204 |
| 205 # 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" |
| 207 |
202 # If run without "-r", the JSON's "actual-results" section should contain | 208 # If run without "-r", the JSON's "actual-results" section should contain |
203 # actual checksums marked as "failure-ignored", but the "expected-results" | 209 # actual checksums marked as "failure-ignored", but the "expected-results" |
204 # section should be empty. | 210 # section should be empty. |
205 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readp
ath" | 211 gm_test "--verbose --hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readp
ath" |
206 | 212 |
207 # Test what happens if a subset of the renderModes fail (e.g. pipe) | 213 # Test what happens if a subset of the renderModes fail (e.g. pipe) |
208 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $
CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai
lure" | 214 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $
CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai
lure" |
209 | 215 |
210 # Confirm that IntentionallySkipped tests are recorded as such. | 216 # Confirm that IntentionallySkipped tests are recorded as such. |
211 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT
S/intentionally-skipped-tests" | 217 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT
S/intentionally-skipped-tests" |
(...skipping 17 matching lines...) Expand all Loading... |
229 for CASE in $FAILING_CASES; do | 235 for CASE in $FAILING_CASES; do |
230 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE
CTED_SUBDIR/json-summary.txt" | 236 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE
CTED_SUBDIR/json-summary.txt" |
231 done | 237 done |
232 | 238 |
233 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 239 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
234 echo "All tests passed." | 240 echo "All tests passed." |
235 exit 0 | 241 exit 0 |
236 else | 242 else |
237 exit 1 | 243 exit 1 |
238 fi | 244 fi |
OLD | NEW |