OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Tests for our tools. | 3 # Tests for our tools. |
4 # | 4 # |
5 # TODO: currently, this only passes on Linux (which is the platform that | 5 # TODO: currently, this only passes on Linux (which is the platform that |
6 # the housekeeper bot runs on, e.g. | 6 # the housekeeper bot runs on, e.g. |
7 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1415/st
eps/RunToolSelfTests/logs/stdio ) | 7 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1415/st
eps/RunToolSelfTests/logs/stdio ) |
8 # See https://code.google.com/p/skia/issues/detail?id=677 | 8 # See https://code.google.com/p/skia/issues/detail?id=677 |
9 # ('make tools/tests/run.sh work cross-platform') | 9 # ('make tools/tests/run.sh work cross-platform') |
10 # Ideally, these tests should pass on all development platforms... | 10 # Ideally, these tests should pass on all development platforms... |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | 122 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout |
123 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 123 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
124 END_TIMESTAMP=$(date +%s) | 124 END_TIMESTAMP=$(date +%s) |
125 | 125 |
126 SECONDS_RUN=$(expr $END_TIMESTAMP - $START_TIMESTAMP) | 126 SECONDS_RUN=$(expr $END_TIMESTAMP - $START_TIMESTAMP) |
127 echo "bench_graph_svg.py for $PLATFORM took $SECONDS_RUN seconds to complete" | 127 echo "bench_graph_svg.py for $PLATFORM took $SECONDS_RUN seconds to complete" |
128 | 128 |
129 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 129 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
130 } | 130 } |
131 | 131 |
132 # Test rebaseline.py's soon-to-disappear image file rebaselining capability. | 132 # Test rebaseline.py's JSON-format expectations rebaselining capability. |
133 # | |
134 # Run rebaseline.py with arguments in $1, recording its dry-run output. | |
135 # Then compare that dry-run output to the content of $2/output-expected. | |
136 function rebaseline_images_test { | |
137 if [ $# != 2 ]; then | |
138 echo "rebaseline_test requires exactly 2 parameters, got $#" | |
139 exit 1 | |
140 fi | |
141 ARGS="$1" | |
142 ACTUAL_OUTPUT_DIR="$2/output-actual" | |
143 EXPECTED_OUTPUT_DIR="$2/output-expected" | |
144 | |
145 rm -rf $ACTUAL_OUTPUT_DIR | |
146 mkdir -p $ACTUAL_OUTPUT_DIR | |
147 COMMAND="python tools/rebaseline.py --dry-run $ARGS" | |
148 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | |
149 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | |
150 echo $? >$ACTUAL_OUTPUT_DIR/return_value | |
151 | |
152 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | |
153 } | |
154 | |
155 # Test rebaseline.py's new JSON-format expectations rebaselining capability. | |
156 # | 133 # |
157 # Copy expected-result.json files from $1 into a dir where they can be modified. | 134 # Copy expected-result.json files from $1 into a dir where they can be modified. |
158 # Run rebaseline.py with arguments in $2, recording its output. | 135 # Run rebaseline.py with arguments in $2, recording its output. |
159 # Then compare the output (and modified expected-result.json files) to the | 136 # Then compare the output (and modified expected-result.json files) to the |
160 # content of $2/output-expected. | 137 # content of $2/output-expected. |
161 function rebaseline_test { | 138 function rebaseline_test { |
162 if [ $# != 3 ]; then | 139 if [ $# != 3 ]; then |
163 echo "rebaseline_test requires exactly 3 parameters, got $#" | 140 echo "rebaseline_test requires exactly 3 parameters, got $#" |
164 exit 1 | 141 exit 1 |
165 fi | 142 fi |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 echo "skimage self tests failed." | 235 echo "skimage self tests failed." |
259 exit 1 | 236 exit 1 |
260 fi | 237 fi |
261 | 238 |
262 # | 239 # |
263 # Test rebaseline.py ... | 240 # Test rebaseline.py ... |
264 # | 241 # |
265 | 242 |
266 REBASELINE_INPUT=tools/tests/rebaseline/input | 243 REBASELINE_INPUT=tools/tests/rebaseline/input |
267 REBASELINE_OUTPUT=tools/tests/rebaseline/output | 244 REBASELINE_OUTPUT=tools/tests/rebaseline/output |
268 | |
269 # These test the old image-file expectations. | |
270 rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-d
ir --actuals-base-url file:$REBASELINE_INPUT/json1 --tests nonexistenttest1 imag
eblur nonexistenttest2 --configs nonexistentconfig1 8888 nonexistentconfig2 --su
bdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTP
UT/subset" | |
271 rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-d
ir --actuals-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy
-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/using-json1" | |
272 rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-d
ir --actuals-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy
-nexus base-shuttle-win7-intel-float --add-new" "$REBASELINE_OUTPUT/using-json1-
add-new" | |
273 rebaseline_images_test "--expectations-root $REBASELINE_INPUT --actuals-base-url
file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-w
in7-intel-float" "$REBASELINE_OUTPUT/exercise-bug1403" | |
274 | |
275 # These test the new JSON-format expectations. | |
276 rebaseline_test "$REBASELINE_INPUT/json1" "--actuals-base-url $REBASELINE_INPUT/
json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBAS
ELINE_OUTPUT/using-json1-expectations" | 245 rebaseline_test "$REBASELINE_INPUT/json1" "--actuals-base-url $REBASELINE_INPUT/
json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBAS
ELINE_OUTPUT/using-json1-expectations" |
277 | 246 |
278 # | 247 # |
279 # Test jsondiff.py ... | 248 # Test jsondiff.py ... |
280 # | 249 # |
281 | 250 |
282 JSONDIFF_INPUT=tools/tests/jsondiff/input | 251 JSONDIFF_INPUT=tools/tests/jsondiff/input |
283 JSONDIFF_OUTPUT=tools/tests/jsondiff/output | 252 JSONDIFF_OUTPUT=tools/tests/jsondiff/output |
284 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" | 253 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" |
285 | 254 |
286 | 255 |
287 echo "All tests passed." | 256 echo "All tests passed." |
OLD | NEW |