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) |
epoger
2014/01/08 17:59:10
The long-term fix is to re-write the GM self-test:
| |
11 # it only runs on Linux and Mac. | 11 # it only runs on Linux and Mac. |
12 # See https://code.google.com/p/skia/issues/detail?id=677 | 12 # See https://code.google.com/p/skia/issues/detail?id=677 |
13 # ('make tools/tests/run.sh work cross-platform') | 13 # ('make tools/tests/run.sh work cross-platform') |
14 # Ideally, these tests should pass on all development platforms... | 14 # Ideally, these tests should pass on all development platforms... |
15 # otherwise, how can developers be expected to test them before committing a | 15 # otherwise, how can developers be expected to test them before committing a |
16 # change? | 16 # change? |
17 | 17 |
18 # cd into .../trunk so all the paths will work | 18 # cd into .../trunk so all the paths will work |
19 cd $(dirname $0)/../.. | 19 cd $(dirname $0)/../.. |
20 | 20 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.pdf); do | 111 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name \*.pdf); do |
112 echo "[contents of $IMAGEFILE]" >$IMAGEFILE | 112 echo "[contents of $IMAGEFILE]" >$IMAGEFILE |
113 done | 113 done |
114 | 114 |
115 # Add a file to any empty subdirectories. | 115 # Add a file to any empty subdirectories. |
116 for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do | 116 for DIR in $(find $ACTUAL_OUTPUT_DIR -mindepth 1 -type d); do |
117 echo "Created additional file to make sure directory isn't empty, because se lf-test cannot handle empty directories." >$DIR/bogusfile | 117 echo "Created additional file to make sure directory isn't empty, because se lf-test cannot handle empty directories." >$DIR/bogusfile |
118 done | 118 done |
119 | 119 |
120 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 120 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
121 } | 121 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 for CASE in $FAILING_CASES; do | 258 for CASE in $FAILING_CASES; do |
259 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" | 259 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" |
260 done | 260 done |
261 | 261 |
262 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then | 262 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
263 echo "All tests passed." | 263 echo "All tests passed." |
264 exit 0 | 264 exit 0 |
265 else | 265 else |
266 exit 1 | 266 exit 1 |
267 fi | 267 fi |
OLD | NEW |