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

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: add_THIS_IMAGE_DIR 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
« no previous file with comments | « gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_8888.png ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
132 JSON_DIR=$INPUTS_DIR/json 134 JSON_DIR=$INPUTS_DIR/json
133 mkdir -p $IMAGES_DIR $JSON_DIR 135 mkdir -p $IMAGES_DIR $JSON_DIR
134 136
135 mkdir -p $IMAGES_DIR/identical-bytes 137 THIS_IMAGE_DIR=$IMAGES_DIR/identical-bytes
138 mkdir -p $THIS_IMAGE_DIR
136 # Run GM to write out the images actually generated. 139 # Run GM to write out the images actually generated.
137 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ 140 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR
138 -w $IMAGES_DIR/identical-bytes
139 # Run GM again to read in those images and write them out as a JSON summary. 141 # Run GM again to read in those images and write them out as a JSON summary.
140 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ 142 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \
141 -r $IMAGES_DIR/identical-bytes \
142 --writeJsonSummaryPath $JSON_DIR/identical-bytes.json 143 --writeJsonSummaryPath $JSON_DIR/identical-bytes.json
143 144
144 mkdir -p $IMAGES_DIR/identical-pixels 145 THIS_IMAGE_DIR=$IMAGES_DIR/identical-pixels
145 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ 146 mkdir -p $THIS_IMAGE_DIR
146 -w $IMAGES_DIR/identical-pixels 147 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR
147 echo "more bytes that do not change the image pixels" \ 148 echo "more bytes that do not change the image pixels" \
148 >> $IMAGES_DIR/identical-pixels/8888/selftest1.png 149 >> $THIS_IMAGE_DIR/8888/selftest1.png
149 echo "more bytes that do not change the image pixels" \ 150 echo "more bytes that do not change the image pixels" \
150 >> $IMAGES_DIR/identical-pixels/565/selftest1.png 151 >> $THIS_IMAGE_DIR/565/selftest1.png
151 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ 152 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \
152 -r $IMAGES_DIR/identical-pixels \
153 --writeJsonSummaryPath $JSON_DIR/identical-pixels.json 153 --writeJsonSummaryPath $JSON_DIR/identical-pixels.json
154 154
155 mkdir -p $IMAGES_DIR/different-pixels 155 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels
156 $GM_BINARY --hierarchy --match selftest2 $CONFIGS \ 156 mkdir -p $THIS_IMAGE_DIR
157 -w $IMAGES_DIR/different-pixels 157 $GM_BINARY --hierarchy --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR
158 mv $IMAGES_DIR/different-pixels/8888/selftest2.png \ 158 mv $THIS_IMAGE_DIR/8888/selftest2.png $THIS_IMAGE_DIR/8888/selftest1.png
159 $IMAGES_DIR/different-pixels/8888/selftest1.png 159 mv $THIS_IMAGE_DIR/565/selftest2.png $THIS_IMAGE_DIR/565/selftest1.png
160 mv $IMAGES_DIR/different-pixels/565/selftest2.png \ 160 $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \
161 $IMAGES_DIR/different-pixels/565/selftest1.png
162 $GM_BINARY --hierarchy --match selftest1 $CONFIGS \
163 -r $IMAGES_DIR/different-pixels \
164 --writeJsonSummaryPath $JSON_DIR/different-pixels.json 161 --writeJsonSummaryPath $JSON_DIR/different-pixels.json
165 162
163 THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy
164 mkdir -p $THIS_IMAGE_DIR
165 $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR
166 mv $THIS_IMAGE_DIR/selftest2_8888.png $THIS_IMAGE_DIR/selftest1_8888.png
167 mv $THIS_IMAGE_DIR/selftest2_565.png $THIS_IMAGE_DIR/selftest1_565.png
168 $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \
169 --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json
170
166 mkdir -p $IMAGES_DIR/empty-dir 171 mkdir -p $IMAGES_DIR/empty-dir
167 } 172 }
168 173
169 GM_TESTDIR=gm/tests 174 GM_TESTDIR=gm/tests
170 GM_INPUTS=$GM_TESTDIR/inputs 175 GM_INPUTS=$GM_TESTDIR/inputs
171 GM_OUTPUTS=$GM_TESTDIR/outputs 176 GM_OUTPUTS=$GM_TESTDIR/outputs
172 GM_TEMPFILES=$GM_TESTDIR/tempfiles 177 GM_TEMPFILES=$GM_TESTDIR/tempfiles
173 178
174 create_inputs_dir $GM_INPUTS 179 create_inputs_dir $GM_INPUTS
175 180
(...skipping 25 matching lines...) Expand all
201 206
202 # Test what happens if a subset of the renderModes fail (e.g. pipe) 207 # 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" 208 gm_test "--simulatePipePlaybackFailure --verbose --hierarchy --match selftest1 $ CONFIGS -r $GM_INPUTS/json/identical-pixels.json" "$GM_OUTPUTS/pipe-playback-fai lure"
204 209
205 # Confirm that IntentionallySkipped tests are recorded as such. 210 # Confirm that IntentionallySkipped tests are recorded as such.
206 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests" 211 gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT S/intentionally-skipped-tests"
207 212
208 # Ignore some error types (including ExpectationsMismatch) 213 # 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" 214 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 215
216 # Test non-hierarchical mode.
217 gm_test "--verbose --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixel s-no-hierarchy.json" "$GM_OUTPUTS/no-hierarchy"
218
211 # Exercise confirm_no_failures_in_json.py 219 # Exercise confirm_no_failures_in_json.py
212 PASSING_CASES="compared-against-identical-bytes-json compared-against-identical- pixels-json" 220 PASSING_CASES="compared-against-identical-bytes-json compared-against-identical- pixels-json"
213 FAILING_CASES="compared-against-different-pixels-json" 221 FAILING_CASES="compared-against-different-pixels-json"
214 for CASE in $PASSING_CASES; do 222 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" 223 assert_passes "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUT PUT_EXPECTED_SUBDIR/json-summary.txt"
216 done 224 done
217 for CASE in $FAILING_CASES; do 225 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" 226 assert_fails "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/$CASE/$OUTP UT_EXPECTED_SUBDIR/json-summary.txt"
219 done 227 done
220 228
221 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then 229 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then
222 echo "All tests passed." 230 echo "All tests passed."
223 exit 0 231 exit 0
224 else 232 else
225 exit 1 233 exit 1
226 fi 234 fi
OLDNEW
« no previous file with comments | « gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_8888.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698