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 | |
| 16 | function replace_expected_with_actual { |
| 17 | # Delete all the expected output files |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 18 | EXPECTED_FILES=$(find $WHICHTOOL/*/output-expected -type f | grep -v /\.svn/) |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 19 | for EXPECTED_FILE in $EXPECTED_FILES; do |
| 20 | rm $EXPECTED_FILE |
| 21 | done |
| 22 | |
| 23 | # Copy all the actual output files into the "expected" directories, |
| 24 | # creating new subdirs as we go. |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 25 | ACTUAL_FILES=$(find $WHICHTOOL/*/output-actual -type f | grep -v /\.svn/) |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 26 | for ACTUAL_FILE in $ACTUAL_FILES; do |
| 27 | EXPECTED_FILE=${ACTUAL_FILE//actual/expected} |
| 28 | mkdir -p $(dirname $EXPECTED_FILE) |
| 29 | cp $ACTUAL_FILE $EXPECTED_FILE |
| 30 | done |
| 31 | } |
| 32 | |
| 33 | function svn_add_new_files { |
| 34 | # Delete all the "actual" directories, so we can svn-add any new "expected" |
| 35 | # directories without adding the "actual" ones. |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 36 | rm -rf $WHICHTOOL/*/output-actual $WHICHTOOL/*/raw-bench-data |
| 37 | FILES=$(svn stat $WHICHTOOL/* | grep ^\? | awk '{print $2}') |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 38 | for FILE in $FILES; do |
| 39 | svn add $FILE |
| 40 | done |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 41 | FILES=$(svn stat $WHICHTOOL/*/output-expected | grep ^\? | awk '{print $2}') |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 42 | for FILE in $FILES; do |
| 43 | svn add $FILE |
| 44 | done |
| 45 | } |
| 46 | |
| 47 | function svn_delete_old_files { |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 48 | FILES=$(svn stat $WHICHTOOL/*/output-expected | grep ^\! | awk '{print $2}') |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 49 | for FILE in $FILES; do |
| 50 | svn rm $FILE |
| 51 | done |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 52 | FILES=$(svn stat $WHICHTOOL/* | grep ^\! | awk '{print $2}') |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 53 | for FILE in $FILES; do |
| 54 | svn rm $FILE |
| 55 | done |
| 56 | } |
| 57 | |
| 58 | |
| 59 | # cd into the gm self-test dir |
| 60 | cd $(dirname $0) |
| 61 | |
| 62 | ./run.sh |
| 63 | SELFTEST_RESULT=$? |
| 64 | echo |
| 65 | if [ "$SELFTEST_RESULT" != "0" ]; then |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 66 | WHICHTOOL=skdiff |
| 67 | replace_expected_with_actual |
| 68 | WHICHTOOL=benchgraphs |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 69 | replace_expected_with_actual |
| 70 | echo "Self-tests still failing, you should probably run this again..." |
| 71 | else |
epoger@google.com | f4eeeab | 2013-02-14 15:10:24 +0000 | [diff] [blame] | 72 | WHICHTOOL=skdiff |
| 73 | svn_add_new_files |
| 74 | svn_delete_old_files |
| 75 | WHICHTOOL=benchgraphs |
rmistry@google.com | ee5a5ee | 2013-01-03 19:23:22 +0000 | [diff] [blame] | 76 | svn_add_new_files |
| 77 | svn_delete_old_files |
| 78 | echo "Self-tests succeeded this time, you should be done!" |
| 79 | fi |
| 80 | exit $SELFTEST_RESULT |
| 81 | |