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