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

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

Issue 156023002: gm self-test: stop checking stdout and stderr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « gm/tests/outputs/pipe-playback-failure/output-expected/stdout ('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 # 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 echo "assert_fails $COMMAND ..." 63 echo "assert_fails $COMMAND ..."
64 $COMMAND 64 $COMMAND
65 if [ $? == 0 ]; then 65 if [ $? == 0 ]; then
66 echo "This command was supposed to fail, but passed: [$COMMAND]" 66 echo "This command was supposed to fail, but passed: [$COMMAND]"
67 ENCOUNTERED_ANY_ERRORS=1 67 ENCOUNTERED_ANY_ERRORS=1
68 fi 68 fi
69 } 69 }
70 70
71 # Run gm... 71 # Run gm...
72 # - with the arguments in $1 72 # - with the arguments in $1
73 # - writing stdout into $2/$OUTPUT_ACTUAL_SUBDIR/stdout
74 # - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt 73 # - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt
75 # - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value 74 # - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value
76 # Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR . 75 # Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR .
77 function gm_test { 76 function gm_test {
78 if [ $# != 2 ]; then 77 if [ $# != 2 ]; then
79 echo "gm_test requires exactly 2 parameters, got $#" 78 echo "gm_test requires exactly 2 parameters, got $#"
80 exit 1 79 exit 1
81 fi 80 fi
82 GM_ARGS="$1" 81 GM_ARGS="$1"
83 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR" 82 ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR"
84 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR" 83 EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR"
85 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt" 84 JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt"
86 85
87 rm -rf $ACTUAL_OUTPUT_DIR 86 rm -rf $ACTUAL_OUTPUT_DIR
88 mkdir -p $ACTUAL_OUTPUT_DIR 87 mkdir -p $ACTUAL_OUTPUT_DIR
89 88
90 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 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"
91 90
92 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line 91 $COMMAND
epoger 2014/02/05 18:01:15 This is the only file of interest in the CL. The
93 $COMMAND >$ACTUAL_OUTPUT_DIR/stdout 2>$ACTUAL_OUTPUT_DIR/stderr
94 echo $? >$ACTUAL_OUTPUT_DIR/return_value 92 echo $? >$ACTUAL_OUTPUT_DIR/return_value
95 93
96 # Only compare selected lines in the stdout, to ignore any spurious lines
97 # as noted in http://code.google.com/p/skia/issues/detail?id=1068 .
98 #
99 # TODO(epoger): This is still hacky... we need to rewrite this script in
100 # Python soon, and make stuff like this more maintainable.
101 grep ^GM: $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp
102 mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout
103 grep ^GM: $ACTUAL_OUTPUT_DIR/stderr >$ACTUAL_OUTPUT_DIR/stderr-tmp
104 mv $ACTUAL_OUTPUT_DIR/stderr-tmp $ACTUAL_OUTPUT_DIR/stderr
105
106 # Replace image file contents with just the filename, for two reasons: 94 # Replace image file contents with just the filename, for two reasons:
107 # 1. Image file encoding may vary by platform 95 # 1. Image file encoding may vary by platform
108 # 2. https://code.google.com/p/chromium/issues/detail?id=169600 96 # 2. https://code.google.com/p/chromium/issues/detail?id=169600
109 # ('gcl/upload.py fail to upload binary files to rietveld') 97 # ('gcl/upload.py fail to upload binary files to rietveld')
110 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name \*.png); do 98 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name \*.png); do
111 echo "[contents of $IMAGEFILE]" >$IMAGEFILE 99 echo "[contents of $IMAGEFILE]" >$IMAGEFILE
112 done 100 done
113 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name \*.pdf); do 101 for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name \*.pdf); do
114 echo "[contents of $IMAGEFILE]" >$IMAGEFILE 102 echo "[contents of $IMAGEFILE]" >$IMAGEFILE
115 done 103 done
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 for CASE in $PASSING_CASES; do 260 for CASE in $PASSING_CASES; do
273 assert_passes "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXP ECTED_SUBDIR/json-summary.txt" 261 assert_passes "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXP ECTED_SUBDIR/json-summary.txt"
274 done 262 done
275 for CASE in $FAILING_CASES; do 263 for CASE in $FAILING_CASES; do
276 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt" 264 assert_fails "python gm/display_json_results.py $GM_OUTPUTS/$CASE/$OUTPUT_EXPE CTED_SUBDIR/json-summary.txt"
277 done 265 done
278 266
279 # Exercise all rebaseline_server unittests. 267 # Exercise all rebaseline_server unittests.
280 assert_passes "python gm/rebaseline_server/test_all.py" 268 assert_passes "python gm/rebaseline_server/test_all.py"
281 269
270 echo
282 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then 271 if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then
283 echo "All tests passed." 272 echo "All tests passed."
284 exit 0 273 exit 0
285 else 274 else
275 echo "Some tests failed."
286 exit 1 276 exit 1
287 fi 277 fi
OLDNEW
« no previous file with comments | « gm/tests/outputs/pipe-playback-failure/output-expected/stdout ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698