Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: gm/tests/run.sh

Issue 15397007: GM self-tests: add testing for non --hierarchy case (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 # Python soon, and make stuff like this more maintainable. 98 # Python soon, and make stuff like this more maintainable.
99 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp 99 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp
100 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout 100 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout
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 $(ls $ACTUAL_OUTPUT_DIR/*/*/*.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 MISMATCHDIR in $(ls -d $ACTUAL_OUTPUT_DIR/mismatchPath/*); do 111 if [ -d $ACTUAL_OUTPUT_DIR/mismatchPath ]; then
112 echo "Created additional file to make sure directory isn't empty, because se lf-test cannot handle empty directories." >$MISMATCHDIR/bogusfile 112 for MISMATCHDIR in $(find $ACTUAL_OUTPUT_DIR/mismatchPath -mindepth 1 -type d); do
113 done 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
114 116
115 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR 117 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
116 } 118 }
117 119
118 # Create input dir (at path $1) with expectations (both image and json) 120 # Create input dir (at path $1) with expectations (both image and json)
119 # that gm will match or mismatch as appropriate. 121 # that gm will match or mismatch as appropriate.
120 # 122 #
121 # We used to check these files into SVN, but then we needed to rebasline them 123 # We used to check these files into SVN, but then we needed to rebaseline them
122 # when our drawing changed at all... so, as proposed in 124 # when our drawing changed at all... so, as proposed in
123 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them 125 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them
124 # new each time. 126 # new each time.
125 function create_inputs_dir { 127 function create_inputs_dir {
126 if [ $# != 1 ]; then 128 if [ $# != 1 ]; then
127 echo "create_inputs_dir requires exactly 1 parameter, got $#" 129 echo "create_inputs_dir requires exactly 1 parameter, got $#"
128 exit 1 130 exit 1
129 fi 131 fi
130 INPUTS_DIR="$1" 132 INPUTS_DIR="$1"
131 IMAGES_DIR=$INPUTS_DIR/images 133 IMAGES_DIR=$INPUTS_DIR/images
(...skipping 24 matching lines...) Expand all
156 $GM_BINARY --hierarchy --match selftest2 $CONFIGS \ 158 $GM_BINARY --hierarchy --match selftest2 $CONFIGS \
157 -w $IMAGES_DIR/different-pixels 159 -w $IMAGES_DIR/different-pixels
158 mv $IMAGES_DIR/different-pixels/8888/selftest2.png \ 160 mv $IMAGES_DIR/different-pixels/8888/selftest2.png \
159 $IMAGES_DIR/different-pixels/8888/selftest1.png 161 $IMAGES_DIR/different-pixels/8888/selftest1.png
160 mv $IMAGES_DIR/different-pixels/565/selftest2.png \ 162 mv $IMAGES_DIR/different-pixels/565/selftest2.png \
161 $IMAGES_DIR/different-pixels/565/selftest1.png 163 $IMAGES_DIR/different-pixels/565/selftest1.png
162 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ 164 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \
163 -r $IMAGES_DIR/different-pixels \ 165 -r $IMAGES_DIR/different-pixels \
164 --writeJsonSummaryPath $JSON_DIR/different-pixels.json 166 --writeJsonSummaryPath $JSON_DIR/different-pixels.json
165 167
168 mkdir -p $IMAGES_DIR/different-pixels-no-hierarchy
scroggo 2013/05/20 17:22:03 Should there be a variable set to different-pixels
epoger 2013/05/21 15:41:23 Great idea, thanks! Done throughout this function
169 $GM_BINARY --match selftest2 $CONFIGS \
170 -w $IMAGES_DIR/different-pixels-no-hierarchy
171 mv $IMAGES_DIR/different-pixels-no-hierarchy/selftest2_8888.png \
172 $IMAGES_DIR/different-pixels-no-hierarchy/selftest1_8888.png
173 mv $IMAGES_DIR/different-pixels-no-hierarchy/selftest2_565.png \
174 $IMAGES_DIR/different-pixels-no-hierarchy/selftest1_565.png
175 $GM_BINARY --match selftest1 $CONFIGS \
176 -r $IMAGES_DIR/different-pixels-no-hierarchy \
177 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json
178
166 mkdir -p $IMAGES_DIR/empty-dir 179 mkdir -p $IMAGES_DIR/empty-dir
167 } 180 }
168 181
169 GM_TESTDIR=gm/tests 182 GM_TESTDIR=gm/tests
170 GM_INPUTS=$GM_TESTDIR/inputs 183 GM_INPUTS=$GM_TESTDIR/inputs
171 GM_OUTPUTS=$GM_TESTDIR/outputs 184 GM_OUTPUTS=$GM_TESTDIR/outputs
172 GM_TEMPFILES=$GM_TESTDIR/tempfiles 185 GM_TEMPFILES=$GM_TESTDIR/tempfiles
173 186
174 create_inputs_dir $GM_INPUTS 187 create_inputs_dir $GM_INPUTS
175 188
(...skipping 25 matching lines...) Expand all
201 214
202 # Test what happens if a subset of the renderModes fail (e.g. pipe) 215 # Test what happens if a subset of the renderModes fail (e.g. pipe)
203 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $ CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai lure" 216 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $ CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai lure"
204 217
205 # Confirm that IntentionallySkipped tests are recorded as such. 218 # Confirm that IntentionallySkipped tests are recorded as such.
206 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests" 219 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests"
207 220
208 # Ignore some error types (including ExpectationsMismatch) 221 # Ignore some error types (including ExpectationsMismatch)
209 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU TPUTS/ignore-expectations-mismatch" 222 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU TPUTS/ignore-expectations-mismatch"
210 223
224 # Test non-hierarchical mode.
225 gm_test "--verbose --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixel s-no-hierarchy.json" "$GM_OUTPUTS/no-hierarchy"
226
211 # Exercise confirm_no_failures_in_json.py 227 # Exercise confirm_no_failures_in_json.py
212 PASSING_CASES="compared-against-identical-bytes-json compared-against-identical- pixels-json" 228 PASSING_CASES="compared-against-identical-bytes-json compared-against-identical- pixels-json"
213 FAILING_CASES="compared-against-different-pixels-json" 229 FAILING_CASES="compared-against-different-pixels-json"
214 for CASE in $PASSING_CASES; do 230 for CASE in $PASSING_CASES; do
215 assert_passes "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUT PUT_EXPECTED_SUBDIR/json-summary.txt" 231 assert_passes "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUT PUT_EXPECTED_SUBDIR/json-summary.txt"
216 done 232 done
217 for CASE in $FAILING_CASES; do 233 for CASE in $FAILING_CASES; do
218 assert_fails "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUTP UT_EXPECTED_SUBDIR/json-summary.txt" 234 assert_fails "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUTP UT_EXPECTED_SUBDIR/json-summary.txt"
219 done 235 done
220 236
221 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then 237 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then
222 echo "All tests passed." 238 echo "All tests passed."
223 exit 0 239 exit 0
224 else 240 else
225 exit 1 241 exit 1
226 fi 242 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698