OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Applies a Skia patch and compares images of SKPs with render_pictures. | 3 # Applies a Skia patch and compares images of SKPs with render_pictures. |
4 # | 4 # |
5 # The script should be run from the skia-telemetry-slave GCE instance's | 5 # The script should be run from the skia-telemetry-slave GCE instance's |
6 # /home/default/skia-repo/buildbot/compute_engine_scripts/telemetry/telemetry_sl
ave_scripts | 6 # /home/default/skia-repo/buildbot/compute_engine_scripts/telemetry/telemetry_sl
ave_scripts |
7 # directory. | 7 # directory. |
8 # | 8 # |
9 # Copyright 2013 Google Inc. All Rights Reserved. | 9 # Copyright 2013 Google Inc. All Rights Reserved. |
10 # Author: rmistry@google.com (Ravi Mistry) | 10 # Author: rmistry@google.com (Ravi Mistry) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 # Download the SKP files from Google Storage if the local TIMESTAMP is out of da
te. | 109 # Download the SKP files from Google Storage if the local TIMESTAMP is out of da
te. |
110 LOCAL_SKP_DIR=/home/default/storage/skps/$PAGESETS_TYPE/$CHROMIUM_BUILD_DIR | 110 LOCAL_SKP_DIR=/home/default/storage/skps/$PAGESETS_TYPE/$CHROMIUM_BUILD_DIR |
111 GS_SKP_DIR=gs://chromium-skia-gm/telemetry/skps/slave$SLAVE_NUM/$PAGESETS_TYPE/$
CHROMIUM_BUILD_DIR | 111 GS_SKP_DIR=gs://chromium-skia-gm/telemetry/skps/slave$SLAVE_NUM/$PAGESETS_TYPE/$
CHROMIUM_BUILD_DIR |
112 mkdir -p $LOCAL_SKP_DIR | 112 mkdir -p $LOCAL_SKP_DIR |
113 are_timestamps_equal $LOCAL_SKP_DIR $GS_SKP_DIR | 113 are_timestamps_equal $LOCAL_SKP_DIR $GS_SKP_DIR |
114 if [ $? -eq 1 ]; then | 114 if [ $? -eq 1 ]; then |
115 gsutil cp $GS_SKP_DIR/* $LOCAL_SKP_DIR | 115 gsutil cp $GS_SKP_DIR/* $LOCAL_SKP_DIR |
116 fi | 116 fi |
117 | 117 |
118 SKIA_TRUNK_LOCATION=/home/default/skia-repo/trunk | 118 SKIA_TRUNK_LOCATION=/home/default/skia-repo/trunk |
| 119 TELEMETRY_SLAVE_SCRIPTS_DIR=/home/default/skia-repo/buildbot/compute_engine_scri
pts/telemetry/telemetry_slave_scripts |
119 | 120 |
120 function cleanup_slave_before_exit { | 121 function cleanup_slave_before_exit { |
121 reset_skia_checkout | 122 reset_skia_checkout |
122 copy_log_to_gs | 123 copy_log_to_gs |
123 delete_worker_file $WORKER_FILE | 124 delete_worker_file $WORKER_FILE |
124 rm -rf /tmp/*${RUN_ID}* | 125 rm -rf /tmp/*${RUN_ID}* |
125 rm -rf /tmp/diffs | 126 rm -rf /tmp/diffs |
126 rm -rf /tmp/whitediffs | 127 rm -rf /tmp/whitediffs |
127 } | 128 } |
128 | 129 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 if [ $? -ne 0 ]; then | 177 if [ $? -ne 0 ]; then |
177 echo "== Patch failed to apply. Exiting. ==" | 178 echo "== Patch failed to apply. Exiting. ==" |
178 cleanup_slave_before_exit | 179 cleanup_slave_before_exit |
179 exit 1 | 180 exit 1 |
180 fi | 181 fi |
181 echo "== Applied patch successfully ==" | 182 echo "== Applied patch successfully ==" |
182 else | 183 else |
183 echo "== Empty patch specified ==" | 184 echo "== Empty patch specified ==" |
184 fi | 185 fi |
185 build_tools $MESA_WITHPATCH_RUN | 186 build_tools $MESA_WITHPATCH_RUN |
186 IMG_ROOT=/tmp/ | 187 IMG_ROOT=/tmp |
187 OUTPUT_DIR_WITHPATCH_DIR_NAME=withpatch-pictures-$RUN_ID | 188 OUTPUT_DIR_WITHPATCH=$IMG_ROOT/withpatch-pictures-$RUN_ID |
188 OUTPUT_DIR_WITHPATCH=${IMG_ROOT}${OUTPUT_DIR_WITHPATCH_DIR_NAME} | |
189 mkdir -p $OUTPUT_DIR_WITHPATCH | 189 mkdir -p $OUTPUT_DIR_WITHPATCH |
190 run_render_pictures $OUTPUT_DIR_WITHPATCH $MESA_WITHPATCH_RUN | 190 run_render_pictures $OUTPUT_DIR_WITHPATCH $MESA_WITHPATCH_RUN |
191 | 191 |
192 echo "== Removing the patch, building, and running render_pictures ==" | 192 echo "== Removing the patch, building, and running render_pictures ==" |
193 reset_skia_checkout | 193 reset_skia_checkout |
194 make clean | 194 make clean |
195 build_tools $MESA_NOPATCH_RUN | 195 build_tools $MESA_NOPATCH_RUN |
196 OUTPUT_DIR_NOPATCH_DIR_NAME=nopatch-pictures-$RUN_ID | 196 OUTPUT_DIR_NOPATCH=$IMG_ROOT/nopatch-pictures-$RUN_ID |
197 OUTPUT_DIR_NOPATCH=${IMG_ROOT}${OUTPUT_DIR_NOPATCH_DIR_NAME} | |
198 mkdir -p $OUTPUT_DIR_NOPATCH | 197 mkdir -p $OUTPUT_DIR_NOPATCH |
199 run_render_pictures $OUTPUT_DIR_NOPATCH $MESA_NOPATCH_RUN | 198 run_render_pictures $OUTPUT_DIR_NOPATCH $MESA_NOPATCH_RUN |
200 | 199 |
201 echo "== Run skpdiff to get the CSV with perceptual similarity metrics ==" | |
202 SKPDIFF_OUTPUT_FILE=/tmp/skpdiff-$RUN_ID.csv | |
203 ./out/Release/skpdiff \ | |
204 -f $OUTPUT_DIR_NOPATCH $OUTPUT_DIR_WITHPATCH \ | |
205 --csv $SKPDIFF_OUTPUT_FILE \ | |
206 -d perceptual | |
207 | |
208 echo "== Comparing pictures and saving differences in JSON output file ==" | 200 echo "== Comparing pictures and saving differences in JSON output file ==" |
209 cd /home/default/skia-repo/buildbot/compute_engine_scripts/telemetry/telemetry_s
lave_scripts | |
210 JSON_SUMMARY_DIR=/tmp/summary-$RUN_ID | 201 JSON_SUMMARY_DIR=/tmp/summary-$RUN_ID |
211 mkdir -p $JSON_SUMMARY_DIR | 202 mkdir -p $JSON_SUMMARY_DIR |
212 python write_json_summary.py \ | 203 python $TELEMETRY_SLAVE_SCRIPTS_DIR/write_json_summary.py \ |
213 --img_root=$IMG_ROOT \ | 204 --img_root=$IMG_ROOT \ |
214 --nopatch_json=$OUTPUT_DIR_NOPATCH/summary.json \ | 205 --nopatch_json=$OUTPUT_DIR_NOPATCH/summary.json \ |
215 --nopatch_img_dir_name=$OUTPUT_DIR_NOPATCH_DIR_NAME \ | 206 --nopatch_images_base_url=file:/$OUTPUT_DIR_NOPATCH \ |
216 --withpatch_json=$OUTPUT_DIR_WITHPATCH/summary.json \ | 207 --withpatch_json=$OUTPUT_DIR_WITHPATCH/summary.json \ |
217 --withpatch_img_dir_name=$OUTPUT_DIR_WITHPATCH_DIR_NAME \ | 208 --withpatch_images_base_url=file:/$OUTPUT_DIR_WITHPATCH \ |
218 --output_file_path=$JSON_SUMMARY_DIR/slave$SLAVE_NUM.json \ | 209 --output_file_path=$JSON_SUMMARY_DIR/slave$SLAVE_NUM.json \ |
219 --gs_output_dir=$OUTPUT_FILE_GS_LOCATION \ | 210 --gs_output_dir=$OUTPUT_FILE_GS_LOCATION \ |
220 --gs_skp_dir=$GS_SKP_DIR \ | 211 --gs_skp_dir=$GS_SKP_DIR \ |
221 --slave_num=$SLAVE_NUM \ | 212 --slave_num=$SLAVE_NUM \ |
222 --gm_json_path=/home/default/skia-repo/trunk/gm/gm_json.py \ | 213 --gm_json_path=$SKIA_TRUNK_LOCATION/gm/gm_json.py \ |
223 --imagediffdb_path=/home/default/skia-repo/trunk/gm/rebaseline_server/imagedif
fdb.py \ | 214 --imagediffdb_path=$SKIA_TRUNK_LOCATION/gm/rebaseline_server/imagediffdb.py |
224 --skpdiff_output_csv=$SKPDIFF_OUTPUT_FILE | |
225 | 215 |
226 echo "== Copy everything to Google Storage ==" | 216 echo "== Copy everything to Google Storage ==" |
227 # Get list of failed file names and upload only those to Google Storage. | 217 # Get list of failed file names and upload only those to Google Storage. |
228 ARRAY=`cat $JSON_SUMMARY_DIR/slave${SLAVE_NUM}.json | grep 'fileName' | cut -d '
:' -f 2 | cut -d "\"" -f2` | 218 ARRAY=`cat $JSON_SUMMARY_DIR/slave${SLAVE_NUM}.json | grep 'fileName' | cut -d '
:' -f 2 | cut -d "\"" -f2` |
229 for i in ${ARRAY[@]}; do | 219 for i in ${ARRAY[@]}; do |
230 gsutil cp $OUTPUT_DIR_NOPATCH/$i $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/nopa
tch-images/ | 220 gsutil cp $OUTPUT_DIR_NOPATCH/$i $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/nopa
tch-images/ |
231 gsutil cp $OUTPUT_DIR_WITHPATCH/$i $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/wi
thpatch-images/ | 221 gsutil cp $OUTPUT_DIR_WITHPATCH/$i $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/wi
thpatch-images/ |
232 done | 222 done |
233 # Copy the diffs and whitediffs to Google Storage. | 223 # Copy the diffs and whitediffs to Google Storage. |
234 gsutil cp $IMG_ROOT/diffs/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/diffs/ | 224 gsutil cp $IMG_ROOT/diffs/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/diffs/ |
235 gsutil cp $IMG_ROOT/whitediffs/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/whited
iffs/ | 225 gsutil cp $IMG_ROOT/whitediffs/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/whited
iffs/ |
236 | 226 |
237 # Set google.com permissions on all uploaded images. | 227 # Set google.com permissions on all uploaded images. |
238 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/nopatc
h-images/* | 228 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/nopatc
h-images/* |
239 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/withpa
tch-images/* | 229 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/withpa
tch-images/* |
240 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/diffs/
* | 230 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/diffs/
* |
241 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/whited
iffs/* | 231 gsutil acl ch -g google.com:READ $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/whited
iffs/* |
242 gsutil cp $JSON_SUMMARY_DIR/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/ | 232 gsutil cp $JSON_SUMMARY_DIR/* $OUTPUT_FILE_GS_LOCATION/slave$SLAVE_NUM/ |
243 | 233 |
244 cleanup_slave_before_exit | 234 cleanup_slave_before_exit |
OLD | NEW |