Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Rebaseline the skdiff/*/output-expected/ subdirectories used by the skdiff | 3 # Rebaseline the skdiff/*/output-expected/ subdirectories used by the skdiff |
| 4 # self-tests, and similar for benchgraphs/*/output-expected. | 4 # self-tests, and similar for benchgraphs/*/output-expected. |
| 5 # | 5 # |
| 6 # Use with caution: are you sure the new results are actually correct? | 6 # Use with caution: are you sure the new results are actually correct? |
| 7 # | 7 # |
| 8 # YOU MUST RE-RUN THIS UNTIL THE SELF-TESTS SUCCEED! | 8 # YOU MUST RE-RUN THIS UNTIL THE SELF-TESTS SUCCEED! |
| 9 # | 9 # |
| 10 # TODO: currently, this must be run on Linux to generate baselines that match | 10 # TODO: currently, this must be run on Linux to generate baselines that match |
| 11 # the ones on the housekeeper bot (which runs on Linux... see | 11 # the ones on the housekeeper bot (which runs on Linux... see |
| 12 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1417/st eps/RunGmSelfTests/logs/stdio ) | 12 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1417/st eps/RunGmSelfTests/logs/stdio ) |
| 13 # See https://code.google.com/p/skia/issues/detail?id=677 | 13 # See https://code.google.com/p/skia/issues/detail?id=677 |
| 14 # ('make tools/tests/run.sh work cross-platform') | 14 # ('make tools/tests/run.sh work cross-platform') |
| 15 | 15 |
| 16 # Replace expected output with actual output, within subdir $1. | |
| 16 function replace_expected_with_actual { | 17 function replace_expected_with_actual { |
| 18 if [ $# != 1 ]; then | |
| 19 echo "replace_expected_with_actual requires exactly 1 parameter, got $#" | |
| 20 exit 1 | |
| 21 fi | |
| 22 | |
| 17 # Delete all the expected output files | 23 # Delete all the expected output files |
| 18 EXPECTED_FILES=$(find $WHICHTOOL/*/output-expected -type f | grep -v /\.svn/) | 24 EXPECTED_FILES=$(find $1/*/output-expected -type f | grep -v /\.svn/) |
|
epoger
2013/06/06 14:41:24
Patchset 1 cleans up some functions in rebaseline.
| |
| 19 for EXPECTED_FILE in $EXPECTED_FILES; do | 25 for EXPECTED_FILE in $EXPECTED_FILES; do |
| 20 rm $EXPECTED_FILE | 26 rm $EXPECTED_FILE |
| 21 done | 27 done |
| 22 | 28 |
| 23 # Copy all the actual output files into the "expected" directories, | 29 # Copy all the actual output files into the "expected" directories, |
| 24 # creating new subdirs as we go. | 30 # creating new subdirs as we go. |
| 25 ACTUAL_FILES=$(find $WHICHTOOL/*/output-actual -type f | grep -v /\.svn/) | 31 ACTUAL_FILES=$(find $1/*/output-actual -type f | grep -v /\.svn/) |
| 26 for ACTUAL_FILE in $ACTUAL_FILES; do | 32 for ACTUAL_FILE in $ACTUAL_FILES; do |
| 27 EXPECTED_FILE=${ACTUAL_FILE//actual/expected} | 33 EXPECTED_FILE=${ACTUAL_FILE//actual/expected} |
| 28 mkdir -p $(dirname $EXPECTED_FILE) | 34 mkdir -p $(dirname $EXPECTED_FILE) |
| 29 cp $ACTUAL_FILE $EXPECTED_FILE | 35 cp $ACTUAL_FILE $EXPECTED_FILE |
| 30 done | 36 done |
| 31 } | 37 } |
| 32 | 38 |
| 39 # Add all new files to SVN control, within subdir $1. | |
| 33 function svn_add_new_files { | 40 function svn_add_new_files { |
| 41 if [ $# != 1 ]; then | |
| 42 echo "svn_add_new_files requires exactly 1 parameter, got $#" | |
| 43 exit 1 | |
| 44 fi | |
| 45 | |
| 34 # Delete all the "actual" directories, so we can svn-add any new "expected" | 46 # Delete all the "actual" directories, so we can svn-add any new "expected" |
| 35 # directories without adding the "actual" ones. | 47 # directories without adding the "actual" ones. |
| 36 rm -rf $WHICHTOOL/*/output-actual $WHICHTOOL/*/raw-bench-data | 48 rm -rf $1/*/output-actual $1/*/raw-bench-data |
| 37 FILES=$(svn stat $WHICHTOOL/* | grep ^\? | awk '{print $2}') | 49 FILES=$(svn stat $1/* | grep ^\? | awk '{print $2}') |
| 38 for FILE in $FILES; do | 50 for FILE in $FILES; do |
| 39 svn add $FILE | 51 svn add $FILE |
| 40 done | 52 done |
| 41 FILES=$(svn stat $WHICHTOOL/*/output-expected | grep ^\? | awk '{print $2}') | 53 FILES=$(svn stat $1/*/output-expected | grep ^\? | awk '{print $2}') |
| 42 for FILE in $FILES; do | 54 for FILE in $FILES; do |
| 43 svn add $FILE | 55 svn add $FILE |
| 44 done | 56 done |
| 45 } | 57 } |
| 46 | 58 |
| 59 # For any files that have been removed from subdir $1, remove them from | |
| 60 # SVN control. | |
| 47 function svn_delete_old_files { | 61 function svn_delete_old_files { |
| 48 FILES=$(svn stat $WHICHTOOL/*/output-expected | grep ^\! | awk '{print $2}') | 62 if [ $# != 1 ]; then |
| 63 echo "svn_delete_old_files requires exactly 1 parameter, got $#" | |
| 64 exit 1 | |
| 65 fi | |
| 66 | |
| 67 FILES=$(svn stat $1/*/output-expected | grep ^\! | awk '{print $2}') | |
| 49 for FILE in $FILES; do | 68 for FILE in $FILES; do |
| 50 svn rm $FILE | 69 svn rm $FILE |
| 51 done | 70 done |
| 52 FILES=$(svn stat $WHICHTOOL/* | grep ^\! | awk '{print $2}') | 71 FILES=$(svn stat $1/* | grep ^\! | awk '{print $2}') |
| 53 for FILE in $FILES; do | 72 for FILE in $FILES; do |
| 54 svn rm $FILE | 73 svn rm $FILE |
| 55 done | 74 done |
| 56 } | 75 } |
| 57 | 76 |
| 58 | 77 |
| 59 # cd into the gm self-test dir | 78 # cd into the gm self-test dir |
| 60 cd $(dirname $0) | 79 cd $(dirname $0) |
| 61 | 80 |
| 62 ./run.sh | 81 ./run.sh |
| 63 SELFTEST_RESULT=$? | 82 SELFTEST_RESULT=$? |
| 64 TOOLS="skdiff benchgraphs rebaseline" | 83 SUBDIRS="skdiff benchgraphs rebaseline" |
| 65 echo | 84 echo |
| 66 if [ "$SELFTEST_RESULT" != "0" ]; then | 85 if [ "$SELFTEST_RESULT" != "0" ]; then |
| 67 for WHICHTOOL in $TOOLS; do | 86 for SUBDIR in $SUBDIRS; do |
| 68 replace_expected_with_actual | 87 replace_expected_with_actual $SUBDIR |
| 69 done | 88 done |
| 70 echo "Self-tests still failing, you should probably run this again..." | 89 echo "Self-tests still failing, you should probably run this again..." |
| 71 else | 90 else |
| 72 for WHICHTOOL in $TOOLS; do | 91 for SUBDIR in $SUBDIRS; do |
| 73 svn_add_new_files | 92 svn_add_new_files $SUBDIR |
| 74 svn_delete_old_files | 93 svn_delete_old_files $SUBDIR |
| 75 done | 94 done |
| 76 echo "Self-tests succeeded this time, you should be done!" | 95 echo "Self-tests succeeded this time, you should be done!" |
| 77 fi | 96 fi |
| 78 exit $SELFTEST_RESULT | 97 exit $SELFTEST_RESULT |
| 79 | 98 |
| OLD | NEW |