Index: gm/tests/run.sh |
=================================================================== |
--- gm/tests/run.sh (revision 9045) |
+++ gm/tests/run.sh (working copy) |
@@ -21,6 +21,12 @@ |
# TODO(epoger): make it look in Release and/or Debug |
GM_BINARY=out/Debug/gm |
+# If WRITE_IMAGE_FILES is nonzero, then the self-test will pass --writePath |
+# and --mismatchPath arguments to GM. Currently, for various reasons, we |
+# cannot run these arguments on the production buildbots, so this should |
+# only be set to nonzero for local testing. |
+WRITE_IMAGE_FILES=0 |
+ |
OUTPUT_ACTUAL_SUBDIR=output-actual |
OUTPUT_EXPECTED_SUBDIR=output-expected |
CONFIGS="--config 8888 565" |
@@ -62,7 +68,12 @@ |
rm -rf $ACTUAL_OUTPUT_DIR |
mkdir -p $ACTUAL_OUTPUT_DIR |
+ |
COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE" |
+ if [ $WRITE_IMAGE_FILES != 0 ]; then |
+ COMMAND="$COMMAND --writePath $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath" |
+ fi |
+ |
echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
$COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr |
echo $? >$ACTUAL_OUTPUT_DIR/return_value |
@@ -77,6 +88,17 @@ |
grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp |
mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr |
+ if [ $WRITE_IMAGE_FILES != 0 ]; then |
+ for IMAGEFILE in $(ls $ACTUAL_OUTPUT_DIR/*/*/*.png); do |
+ SUM=$(sum $IMAGEFILE) |
+ echo "Replaced image bytes with a checksum, because of https://code.google.com/p/chromium/issues/detail?id=169600 ('gcl/upload.py fail to upload binary files to rietveld')" >$IMAGEFILE |
+ echo $SUM >> $IMAGEFILE |
+ done |
+ for MISMATCHDIR in $(ls -d $ACTUAL_OUTPUT_DIR/mismatchPath/*); do |
+ echo "Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories." >$MISMATCHDIR/bogusfile |
+ done |
+ fi |
+ |
compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
} |