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

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

Issue 17552012: GM: add --missingExpectationsPath option, similar to --mismatchPath (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_new_flag_and_test Created 7 years, 6 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 exit 1 78 exit 1
79 fi 79 fi
80 GM_ARGS="$1" 80 GM_ARGS="$1"
81 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" 81 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR"
82 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" 82 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR"
83 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" 83 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt"
84 84
85 rm -rf $ACTUAL_OUTPUT_DIR 85 rm -rf $ACTUAL_OUTPUT_DIR
86 mkdir -p $ACTUAL_OUTPUT_DIR 86 mkdir -p $ACTUAL_OUTPUT_DIR
87 87
88 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE --write Path $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath " 88 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE --write Path $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath --missingExpectationsPath $ACTUAL_OUTPUT_DIR/missingExpectationsPath"
89 89
90 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line 90 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
91 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr 91 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr
92 echo $? >$ACTUAL_OUTPUT_DIR/return_value 92 echo $? >$ACTUAL_OUTPUT_DIR/return_value
93 93
94 # Only compare selected lines in the stdout, to ignore any spurious lines 94 # Only compare selected lines in the stdout, to ignore any spurious lines
95 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . 95 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 .
96 # 96 #
97 # TODO(epoger): This is still hacky... we need to rewrite this script in 97 # TODO(epoger): This is still hacky... we need to rewrite this script in
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 $(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 if [ -d $ACTUAL_OUTPUT_DIR/mismatchPath ]; then 111
112 for MISMATCHDIR in $(find $ACTUAL_OUTPUT_DIR/mismatchPath -mindepth 1 -type d); do 112 # Add a file to any empty subdirectories.
113 echo "Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories." >$MISMATCHDIR/bogusfile 113 for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do
114 done 114 echo "Created additional file to make sure directory isn't empty, because se lf-test cannot handle empty directories." >$DIR/bogusfile
115 fi 115 done
116 116
117 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR 117 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
118 } 118 }
119 119
120 # 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)
121 # that gm will match or mismatch as appropriate. 121 # that gm will match or mismatch as appropriate.
122 # 122 #
123 # We used to check these files into SVN, but then we needed to rebaseline them 123 # We used to check these files into SVN, but then we needed to rebaseline them
124 # when our drawing changed at all... so, as proposed in 124 # when our drawing changed at all... so, as proposed in
125 # 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
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 for CASE in $FAILING_CASES; do 229 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" 230 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt"
231 done 231 done
232 232
233 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then 233 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then
234 echo "All tests passed." 234 echo "All tests passed."
235 exit 0 235 exit 0
236 else 236 else
237 exit 1 237 exit 1
238 fi 238 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698