blob: 71af20f440f9c40877c9c1f2ea39f3e471acb693 [file] [log] [blame]
epoger@google.com8a6f13a2012-12-05 20:21:35 +00001#!/bin/bash
2
3# Rebaseline the outputs/*/output-expected/ subdirectories used by the
4# gm self-tests.
5# Use with caution: are you sure the new results are actually correct?
6#
7# YOU MUST RE-RUN THIS UNTIL THE SELF-TESTS SUCCEED!
epoger@google.com9c56a8d2012-12-20 18:34:29 +00008# (It takes one run for each failing call to gm_test in run.sh)
epoger@google.com3aa33582013-01-02 15:53:25 +00009#
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')
epoger@google.com9c56a8d2012-12-20 18:34:29 +000015
16function replace_expected_with_actual {
17 # Delete all the expected output files
18 EXPECTED_FILES=$(find outputs/*/output-expected -type f | grep -v /\.svn/)
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.
25 ACTUAL_FILES=$(find outputs/*/output-actual -type f | grep -v /\.svn/)
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
33function 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.
36 rm -rf outputs/*/output-actual
37 FILES=$(svn stat outputs/* | grep ^\? | awk '{print $2}')
38 for FILE in $FILES; do
39 svn add $FILE
40 done
41 FILES=$(svn stat outputs/*/output-expected | grep ^\? | awk '{print $2}')
42 for FILE in $FILES; do
43 svn add $FILE
44 done
45}
46
47function svn_delete_old_files {
48 FILES=$(svn stat outputs/*/output-expected | grep ^\! | awk '{print $2}')
49 for FILE in $FILES; do
50 svn rm $FILE
51 done
52 FILES=$(svn stat outputs/* | grep ^\! | awk '{print $2}')
53 for FILE in $FILES; do
54 svn rm $FILE
55 done
56}
57
epoger@google.com8a6f13a2012-12-05 20:21:35 +000058
59# cd into the gm self-test dir
60cd $(dirname $0)
61
62./run.sh
epoger@google.com9c56a8d2012-12-20 18:34:29 +000063SELFTEST_RESULT=$?
64echo
65if [ "$SELFTEST_RESULT" != "0" ]; then
66 replace_expected_with_actual
67 echo "Self-tests still failing, you should probably run this again..."
68else
69 svn_add_new_files
70 svn_delete_old_files
71 echo "Self-tests succeeded this time, you should be done!"
72fi
73exit $SELFTEST_RESULT
epoger@google.com8a6f13a2012-12-05 20:21:35 +000074