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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 JSON-format expectations rebaselining capability. | 132 # Test rebaseline.py's JSON-format expectations rebaselining capability. |
133 # | 133 # |
134 # Copy expected-result.json files from $1 into a dir where they can be modified. | 134 # Copy expected-results.json files from $1 into a dir where they can be modified
. |
135 # Run rebaseline.py with arguments in $2, recording its output. | 135 # Run rebaseline.py with arguments in $2, recording its output. |
136 # Then compare the output (and modified expected-result.json files) to the | 136 # Then compare the output (and modified expected-results.json files) to the |
137 # content of $2/output-expected. | 137 # content of $2/output-expected. |
138 function rebaseline_test { | 138 function rebaseline_test { |
139 if [ $# != 3 ]; then | 139 if [ $# != 3 ]; then |
140 echo "rebaseline_test requires exactly 3 parameters, got $#" | 140 echo "rebaseline_test requires exactly 3 parameters, got $#" |
141 exit 1 | 141 exit 1 |
142 fi | 142 fi |
143 COPY_EXPECTATIONS_FROM_DIR="$1" | 143 COPY_EXPECTATIONS_FROM_DIR="$1" |
144 ARGS="$2" | 144 ARGS="$2" |
145 ACTUAL_OUTPUT_DIR="$3/output-actual" | 145 ACTUAL_OUTPUT_DIR="$3/output-actual" |
146 EXPECTED_OUTPUT_DIR="$3/output-expected" | 146 EXPECTED_OUTPUT_DIR="$3/output-expected" |
147 | 147 |
148 rm -rf $ACTUAL_OUTPUT_DIR | 148 rm -rf $ACTUAL_OUTPUT_DIR |
149 mkdir -p $ACTUAL_OUTPUT_DIR | 149 mkdir -p $ACTUAL_OUTPUT_DIR |
150 EXPECTATIONS_TO_MODIFY_DIR="$ACTUAL_OUTPUT_DIR/gm-expectations" | 150 EXPECTATIONS_TO_MODIFY_DIR="$ACTUAL_OUTPUT_DIR/gm-expectations" |
151 SUBDIRS=$(ls $COPY_EXPECTATIONS_FROM_DIR) | 151 # TODO(epoger): Temporarily exclude expectations subdirs with old base-* names
, |
152 for SUBDIR in $SUBDIRS; do | 152 # during a transition period (we need the svn rm of those subdirs to take |
153 mkdir -p $EXPECTATIONS_TO_MODIFY_DIR/$SUBDIR | 153 # effect) |
154 cp $COPY_EXPECTATIONS_FROM_DIR/$SUBDIR/expected-results.json \ | 154 BUILDERS=$(ls $COPY_EXPECTATIONS_FROM_DIR | grep -v ^base-) |
155 $EXPECTATIONS_TO_MODIFY_DIR/$SUBDIR | 155 for BUILDER in $BUILDERS; do |
| 156 mkdir -p $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER |
| 157 cp $COPY_EXPECTATIONS_FROM_DIR/$BUILDER/expected-results.json \ |
| 158 $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER |
156 done | 159 done |
157 COMMAND="python tools/rebaseline.py --expectations-root $EXPECTATIONS_TO_MODIF
Y_DIR $ARGS" | 160 COMMAND="python tools/rebaseline.py --expectations-root $EXPECTATIONS_TO_MODIF
Y_DIR $ARGS" |
158 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | 161 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
159 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | 162 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout |
160 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 163 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
161 | 164 |
162 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 165 # TODO(epoger): Temporarily override compare_directories with a comparison |
| 166 # that excludes expectations subdirs with old base-* names, |
| 167 # during a transition period (we need the svn rm of those subdirs to take |
| 168 # effect) |
| 169 # |
| 170 # WAS: compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
| 171 diff --recursive --exclude=.* --exclude=base-* $EXPECTED_OUTPUT_DIR $ACTUAL_OU
TPUT_DIR |
| 172 if [ $? != 0 ]; then |
| 173 echo "failed in: compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
" |
| 174 exit 1 |
| 175 fi |
163 } | 176 } |
164 | 177 |
165 # Run jsondiff.py with arguments in $1, recording its output. | 178 # Run jsondiff.py with arguments in $1, recording its output. |
166 # Then compare that output to the content of $2/output-expected. | 179 # Then compare that output to the content of $2/output-expected. |
167 function jsondiff_test { | 180 function jsondiff_test { |
168 if [ $# != 2 ]; then | 181 if [ $# != 2 ]; then |
169 echo "jsondiff_test requires exactly 2 parameters, got $#" | 182 echo "jsondiff_test requires exactly 2 parameters, got $#" |
170 exit 1 | 183 exit 1 |
171 fi | 184 fi |
172 ARGS="$1" | 185 ARGS="$1" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 echo "skimage self tests failed." | 248 echo "skimage self tests failed." |
236 exit 1 | 249 exit 1 |
237 fi | 250 fi |
238 | 251 |
239 # | 252 # |
240 # Test rebaseline.py ... | 253 # Test rebaseline.py ... |
241 # | 254 # |
242 | 255 |
243 REBASELINE_INPUT=tools/tests/rebaseline/input | 256 REBASELINE_INPUT=tools/tests/rebaseline/input |
244 REBASELINE_OUTPUT=tools/tests/rebaseline/output | 257 REBASELINE_OUTPUT=tools/tests/rebaseline/output |
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" | 258 rebaseline_test "$REBASELINE_INPUT/json1" "--actuals-base-url $REBASELINE_INPUT/
json1 --builders Test-Android-GalaxyNexus-SGX540-Arm7-Debug Test-Win7-ShuttleA-H
D2000-x86-Release" "$REBASELINE_OUTPUT/using-json1-expectations" |
246 | 259 |
247 # | 260 # |
248 # Test jsondiff.py ... | 261 # Test jsondiff.py ... |
249 # | 262 # |
250 | 263 |
251 JSONDIFF_INPUT=tools/tests/jsondiff/input | 264 JSONDIFF_INPUT=tools/tests/jsondiff/input |
252 JSONDIFF_OUTPUT=tools/tests/jsondiff/output | 265 JSONDIFF_OUTPUT=tools/tests/jsondiff/output |
253 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" | 266 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" |
254 | 267 |
255 | 268 |
256 echo "All tests passed." | 269 echo "All tests passed." |
OLD | NEW |