| 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 # TODO: because this is written as a shell script (instead of, say, Python) | 8 # TODO: because this is written as a shell script (instead of, say, Python) |
| 9 # it only runs on Linux and Mac. | 9 # it only runs on Linux and Mac. |
| 10 # See https://code.google.com/p/skia/issues/detail?id=677 | 10 # See https://code.google.com/p/skia/issues/detail?id=677 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 fi | 53 fi |
| 54 GM_ARGS="$1" | 54 GM_ARGS="$1" |
| 55 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" | 55 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" |
| 56 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" | 56 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" |
| 57 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" | 57 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" |
| 58 | 58 |
| 59 rm -rf $ACTUAL_OUTPUT_DIR | 59 rm -rf $ACTUAL_OUTPUT_DIR |
| 60 mkdir -p $ACTUAL_OUTPUT_DIR | 60 mkdir -p $ACTUAL_OUTPUT_DIR |
| 61 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummary $JSON_SUMMARY_FILE" | 61 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummary $JSON_SUMMARY_FILE" |
| 62 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | 62 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
| 63 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | 63 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr |
| 64 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 64 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
| 65 | 65 |
| 66 # Only compare selected lines in the stdout, to ignore any spurious lines | 66 # Only compare selected lines in the stdout, to ignore any spurious lines |
| 67 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . | 67 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 . |
| 68 # | 68 # |
| 69 # TODO(epoger): This is still hacky... we need to rewrite this script in | 69 # TODO(epoger): This is still hacky... we need to rewrite this script in |
| 70 # Python soon, and make stuff like this more maintainable. | 70 # Python soon, and make stuff like this more maintainable. |
| 71 grep --regexp=^reading --regexp=^writing --regexp=^drawing \ | 71 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp |
| 72 --regexp=^FAILED --regexp=^Ran $ACTUAL_OUTPUT_DIR/stdout \ | |
| 73 >$ACTUAL_OUTPUT_DIR/stdout-tmp | |
| 74 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout | 72 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout |
| 73 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp |
| 74 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr |
| 75 | 75 |
| 76 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 76 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
| 77 } | 77 } |
| 78 | 78 |
| 79 # Create input dir (at path $1) with expectations (both image and json) | 79 # Create input dir (at path $1) with expectations (both image and json) |
| 80 # that gm will match or mismatch as appropriate. | 80 # that gm will match or mismatch as appropriate. |
| 81 # | 81 # |
| 82 # We used to check these files into SVN, but then we needed to rebasline them | 82 # We used to check these files into SVN, but then we needed to rebasline them |
| 83 # when our drawing changed at all... so, as proposed in | 83 # when our drawing changed at all... so, as proposed in |
| 84 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them | 84 # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 # Compare generated image against an empty "expected image" dir. | 149 # Compare generated image against an empty "expected image" dir. |
| 150 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir"
"$GM_OUTPUTS/compared-against-empty-dir" | 150 gm_test "--hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/images/empty-dir"
"$GM_OUTPUTS/compared-against-empty-dir" |
| 151 | 151 |
| 152 # If run without "-r", the JSON's "actual-results" section should contain | 152 # If run without "-r", the JSON's "actual-results" section should contain |
| 153 # actual checksums marked as "failure-ignored", but the "expected-results" | 153 # actual checksums marked as "failure-ignored", but the "expected-results" |
| 154 # section should be empty. | 154 # section should be empty. |
| 155 gm_test "--hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readpath" | 155 gm_test "--hierarchy --match selftest1 $CONFIGS" "$GM_OUTPUTS/no-readpath" |
| 156 | 156 |
| 157 echo "All tests passed." | 157 echo "All tests passed." |
| OLD | NEW |