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

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

Issue 23725003: gm self-tests: stop comparing stdout/stderr/command_line, just look at JSON summary (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 3 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
OLDNEW
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)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 OUTPUT=$($COMMAND 2>&1) 61 OUTPUT=$($COMMAND 2>&1)
62 if [ $? == 0 ]; then 62 if [ $? == 0 ]; then
63 echo "This command was supposed to fail, but passed: [$COMMAND]" 63 echo "This command was supposed to fail, but passed: [$COMMAND]"
64 echo $OUTPUT 64 echo $OUTPUT
65 ENCOUNTERED_ANY_ERRORS=1 65 ENCOUNTERED_ANY_ERRORS=1
66 fi 66 fi
67 } 67 }
68 68
69 # Run gm... 69 # Run gm...
70 # - with the arguments in $1 70 # - with the arguments in $1
71 # - writing stdout into $2/$OUTPUT_ACTUAL_SUBDIR/stdout
72 # - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt 71 # - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt
73 # - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value 72 # - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value
74 # Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR . 73 # Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR .
75 function gm_test { 74 function gm_test {
76 if [ $# != 2 ]; then 75 if [ $# != 2 ]; then
77 echo "gm_test requires exactly 2 parameters, got $#" 76 echo "gm_test requires exactly 2 parameters, got $#"
78 exit 1 77 exit 1
79 fi 78 fi
80 GM_ARGS="$1" 79 GM_ARGS="$1"
81 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" 80 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR"
82 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" 81 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR"
83 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" 82 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt"
84 83
85 rm -rf $ACTUAL_OUTPUT_DIR 84 rm -rf $ACTUAL_OUTPUT_DIR
86 mkdir -p $ACTUAL_OUTPUT_DIR 85 mkdir -p $ACTUAL_OUTPUT_DIR
87 86
88 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE --write Path $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath --missingExpectationsPath $ACTUAL_OUTPUT_DIR/missingExpectationsPath" 87 COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummaryPath $JSON_SUMMARY_FILE --write Path $ACTUAL_OUTPUT_DIR/writePath --mismatchPath $ACTUAL_OUTPUT_DIR/mismatchPath --missingExpectationsPath $ACTUAL_OUTPUT_DIR/missingExpectationsPath"
89 88
90 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line 89 $COMMAND >/dev/null 2>/dev/null
91 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr
92 echo $? >$ACTUAL_OUTPUT_DIR/return_value 90 echo $? >$ACTUAL_OUTPUT_DIR/return_value
93 91
94 # Only compare selected lines in the stdout, to ignore any spurious lines
95 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 .
96 #
97 # TODO(epoger): This is still hacky... we need to rewrite this script in
98 # Python soon, and make stuff like this more maintainable.
99 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp
epoger 2013/08/28 19:43:04 Now that we aren't filtering stdout for these "GM:
100 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout
101 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp
102 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr
103
104 # Replace image file contents with just the filename, for two reasons: 92 # Replace image file contents with just the filename, for two reasons:
105 # 1. Image file encoding may vary by platform 93 # 1. Image file encoding may vary by platform
106 # 2. https://code.google.com/p/chromium/issues/detail?id=169600 94 # 2. https://code.google.com/p/chromium/issues/detail?id=169600
107 # ('gcl/upload.py fail to upload binary files to rietveld') 95 # ('gcl/upload.py fail to upload binary files to rietveld')
108 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do 96 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do
109 echo "[contents of $IMAGEFILE]" >$IMAGEFILE 97 echo "[contents of $IMAGEFILE]" >$IMAGEFILE
110 done 98 done
111 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.pdf); do 99 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.pdf); do
112 echo "[contents of $IMAGEFILE]" >$IMAGEFILE 100 echo "[contents of $IMAGEFILE]" >$IMAGEFILE
113 done 101 done
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 for CASE in $FAILING_CASES; do 223 for CASE in $FAILING_CASES; do
236 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" 224 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt"
237 done 225 done
238 226
239 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then 227 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then
240 echo "All tests passed." 228 echo "All tests passed."
241 exit 0 229 exit 0
242 else 230 else
243 exit 1 231 exit 1
244 fi 232 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698