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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 # TODO(epoger): Temporarily exclude expectations subdirs with old base-* names
, | 151 BUILDERS=$(ls $COPY_EXPECTATIONS_FROM_DIR) |
152 # during a transition period (we need the svn rm of those subdirs to take | |
153 # effect) | |
154 BUILDERS=$(ls $COPY_EXPECTATIONS_FROM_DIR | grep -v ^base-) | |
155 for BUILDER in $BUILDERS; do | 152 for BUILDER in $BUILDERS; do |
156 mkdir -p $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER | 153 mkdir -p $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER |
157 cp $COPY_EXPECTATIONS_FROM_DIR/$BUILDER/expected-results.json \ | 154 cp $COPY_EXPECTATIONS_FROM_DIR/$BUILDER/expected-results.json \ |
158 $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER | 155 $EXPECTATIONS_TO_MODIFY_DIR/$BUILDER |
159 done | 156 done |
160 COMMAND="python tools/rebaseline.py --expectations-root $EXPECTATIONS_TO_MODIF
Y_DIR $ARGS" | 157 COMMAND="python tools/rebaseline.py --expectations-root $EXPECTATIONS_TO_MODIF
Y_DIR $ARGS" |
161 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | 158 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
162 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | 159 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout |
163 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 160 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
164 | 161 |
165 # TODO(epoger): Temporarily override compare_directories with a comparison | 162 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
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 | |
176 } | 163 } |
177 | 164 |
178 # Run jsondiff.py with arguments in $1, recording its output. | 165 # Run jsondiff.py with arguments in $1, recording its output. |
179 # Then compare that output to the content of $2/output-expected. | 166 # Then compare that output to the content of $2/output-expected. |
180 function jsondiff_test { | 167 function jsondiff_test { |
181 if [ $# != 2 ]; then | 168 if [ $# != 2 ]; then |
182 echo "jsondiff_test requires exactly 2 parameters, got $#" | 169 echo "jsondiff_test requires exactly 2 parameters, got $#" |
183 exit 1 | 170 exit 1 |
184 fi | 171 fi |
185 ARGS="$1" | 172 ARGS="$1" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 # | 247 # |
261 # Test jsondiff.py ... | 248 # Test jsondiff.py ... |
262 # | 249 # |
263 | 250 |
264 JSONDIFF_INPUT=tools/tests/jsondiff/input | 251 JSONDIFF_INPUT=tools/tests/jsondiff/input |
265 JSONDIFF_OUTPUT=tools/tests/jsondiff/output | 252 JSONDIFF_OUTPUT=tools/tests/jsondiff/output |
266 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" |
267 | 254 |
268 | 255 |
269 echo "All tests passed." | 256 echo "All tests passed." |
OLD | NEW |