Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: tools/tests/run.sh

Issue 18103005: Create jsondiff tool to capture diffs between two JSON expectations files. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: fix_self_test Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« tools/jsondiff.py ('K') | « tools/tests/rebaseline.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 rm -rf $ACTUAL_OUTPUT_DIR 143 rm -rf $ACTUAL_OUTPUT_DIR
144 mkdir -p $ACTUAL_OUTPUT_DIR 144 mkdir -p $ACTUAL_OUTPUT_DIR
145 COMMAND="python tools/rebaseline.py --dry-run $ARGS" 145 COMMAND="python tools/rebaseline.py --dry-run $ARGS"
146 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line 146 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
147 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout 147 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout
148 echo $? >$ACTUAL_OUTPUT_DIR/return_value 148 echo $? >$ACTUAL_OUTPUT_DIR/return_value
149 149
150 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR 150 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
151 } 151 }
152 152
153 # Run jsondiff.py with arguments in $1, recording its output.
154 # Then compare that output to the content of $2/output-expected.
155 function jsondiff_test {
156 if [ $# != 2 ]; then
157 echo "jsondiff_test requires exactly 2 parameters, got $#"
158 exit 1
159 fi
160 ARGS="$1"
161 ACTUAL_OUTPUT_DIR="$2/output-actual"
162 EXPECTED_OUTPUT_DIR="$2/output-expected"
163
164 rm -rf $ACTUAL_OUTPUT_DIR
165 mkdir -p $ACTUAL_OUTPUT_DIR
166 COMMAND="python tools/jsondiff.py $ARGS"
167 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
168 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout
169 echo $? >$ACTUAL_OUTPUT_DIR/return_value
170
171 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
172 }
173
153 174
154 175
155 # 176 #
156 # Run skdiff tests... 177 # Run skdiff tests...
157 # 178 #
158 179
159 SKDIFF_TESTDIR=tools/tests/skdiff 180 SKDIFF_TESTDIR=tools/tests/skdiff
160 181
161 # Run skdiff over a variety of file pair types: identical bits, identical pixels , missing from 182 # Run skdiff over a variety of file pair types: identical bits, identical pixels , missing from
162 # baseDir, etc. 183 # baseDir, etc.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 # 229 #
209 230
210 REBASELINE_INPUT=tools/tests/rebaseline/input 231 REBASELINE_INPUT=tools/tests/rebaseline/input
211 REBASELINE_OUTPUT=tools/tests/rebaseline/output 232 REBASELINE_OUTPUT=tools/tests/rebaseline/output
212 rebaseline_test "--expectations-root fake/expectations/path --json-base-url file :$REBASELINE_INPUT/json1 --tests test1 test2 --configs 565 8888 --subdirs base-a ndroid-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/subset" 233 rebaseline_test "--expectations-root fake/expectations/path --json-base-url file :$REBASELINE_INPUT/json1 --tests test1 test2 --configs 565 8888 --subdirs base-a ndroid-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/subset"
213 rebaseline_test "--json-base-url file:nonexistent-path --tests test1 test2" "$RE BASELINE_OUTPUT/all" 234 rebaseline_test "--json-base-url file:nonexistent-path --tests test1 test2" "$RE BASELINE_OUTPUT/all"
214 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/using-json1 " 235 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/using-json1 "
215 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float --add-new" "$REBASELINE_OUTPUT/u sing-json1-add-new" 236 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float --add-new" "$REBASELINE_OUTPUT/u sing-json1-add-new"
216 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float --expectations-root $REBASELINE_ INPUT/json1" "$REBASELINE_OUTPUT/using-json1-expectations" 237 rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-and roid-galaxy-nexus base-shuttle-win7-intel-float --expectations-root $REBASELINE_ INPUT/json1" "$REBASELINE_OUTPUT/using-json1-expectations"
217 238
239 #
240 # Test jsondiff.py ...
241 #
242
243 JSONDIFF_INPUT=tools/tests/jsondiff/input
244 JSONDIFF_OUTPUT=tools/tests/jsondiff/output
245 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT PUT/old-vs-new"
246
247
218 echo "All tests passed." 248 echo "All tests passed."
OLDNEW
« tools/jsondiff.py ('K') | « tools/tests/rebaseline.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698