OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 exit 1 | 56 exit 1 |
57 fi | 57 fi |
58 GM_ARGS="$1" | 58 GM_ARGS="$1" |
59 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" | 59 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" |
60 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" | 60 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" |
61 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" | 61 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" |
62 | 62 |
63 rm -rf $ACTUAL_OUTPUT_DIR | 63 rm -rf $ACTUAL_OUTPUT_DIR |
64 mkdir -p $ACTUAL_OUTPUT_DIR | 64 mkdir -p $ACTUAL_OUTPUT_DIR |
65 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE" | 65 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE" |
| 66 # EPOGER: start temporary change (won't be able to commit this, because |
| 67 # different image files are generated on different platforms) |
| 68 #mkdir -p $ACTUAL_OUTPUT_DIR/writePath $ACTUAL_OUTPUT_DIR/mismatchPath |
| 69 COMMAND="$COMMAND --writePath $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACT
UAL_OUTPUT_DIR/mismatchPath" |
| 70 # EPOGER: end temporary change |
66 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | 71 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
67 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr | 72 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr |
68 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 73 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
69 | 74 |
70 # Only compare selected lines in the stdout, to ignore any spurious lines | 75 # Only compare selected lines in the stdout, to ignore any spurious lines |
71 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . | 76 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . |
72 # | 77 # |
73 # TODO(epoger): This is still hacky... we need to rewrite this script in | 78 # TODO(epoger): This is still hacky... we need to rewrite this script in |
74 # Python soon, and make stuff like this more maintainable. | 79 # Python soon, and make stuff like this more maintainable. |
75 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp | 80 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp |
76 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout | 81 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout |
77 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp | 82 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp |
78 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr | 83 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr |
79 | 84 |
| 85 # EPOGER: start temporary change (don't want to commit this) |
| 86 IMAGEFILES=$(ls $ACTUAL_OUTPUT_DIR/*/*/*.png) |
| 87 for IMAGEFILE in $IMAGEFILES; do |
| 88 SUM=$(sum $IMAGEFILE) |
| 89 echo "Replaced image bytes with a checksum, because gcl upload cannot handle
PNGs" >$IMAGEFILE |
| 90 echo $SUM >> $IMAGEFILE |
| 91 done |
| 92 # EPOGER: end temporary change |
| 93 |
80 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 94 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
81 } | 95 } |
82 | 96 |
83 # Create input dir (at path $1) with expectations (both image and json) | 97 # Create input dir (at path $1) with expectations (both image and json) |
84 # that gm will match or mismatch as appropriate. | 98 # that gm will match or mismatch as appropriate. |
85 # | 99 # |
86 # We used to check these files into SVN, but then we needed to rebasline them | 100 # We used to check these files into SVN, but then we needed to rebasline them |
87 # when our drawing changed at all... so, as proposed in | 101 # when our drawing changed at all... so, as proposed in |
88 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them | 102 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them |
89 # new each time. | 103 # new each time. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 186 |
173 # Ignore some error types (including ExpectationsMismatch) | 187 # Ignore some error types (including ExpectationsMismatch) |
174 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar
chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU
TPUTS/ignore-expectations-mismatch" | 188 gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierar
chy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OU
TPUTS/ignore-expectations-mismatch" |
175 | 189 |
176 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 190 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
177 echo "All tests passed." | 191 echo "All tests passed." |
178 exit 0 | 192 exit 0 |
179 else | 193 else |
180 exit 1 | 194 exit 1 |
181 fi | 195 fi |
OLD | NEW |