aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/tests/rebaseline.sh
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-05 20:21:35 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-05 20:21:35 +0000
commit8a6f13a20ddcf5c33157a34602a074d366f9918e (patch)
tree154529e8ebbcfab47f0e2f06ff6f52691479132e /gm/tests/rebaseline.sh
parentdbbca9a4048d1871ca538fc2a2e8e4b624e877de (diff)
Add script to help rebaseline gm self-tests, and run it right now
Diffstat (limited to 'gm/tests/rebaseline.sh')
-rwxr-xr-xgm/tests/rebaseline.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/gm/tests/rebaseline.sh b/gm/tests/rebaseline.sh
new file mode 100755
index 0000000000..77f8711e18
--- /dev/null
+++ b/gm/tests/rebaseline.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Rebaseline the outputs/*/output-expected/ subdirectories used by the
+# gm self-tests.
+# Use with caution: are you sure the new results are actually correct?
+#
+# YOU MUST RE-RUN THIS UNTIL THE SELF-TESTS SUCCEED!
+# (It takes one run for each call to gm_test in run.sh)
+
+# cd into the gm self-test dir
+cd $(dirname $0)
+
+./run.sh
+
+# Delete all the expected output files
+EXPECTED_FILES=$(find outputs/*/output-expected -type f | grep -v /\.svn/)
+for EXPECTED_FILE in $EXPECTED_FILES; do
+ rm $EXPECTED_FILE
+done
+
+# Copy all the actual output files into the "expected" directories,
+# creating new subdirs as we go.
+ACTUAL_FILES=$(find outputs/*/output-actual -type f | grep -v /\.svn/)
+for ACTUAL_FILE in $ACTUAL_FILES; do
+ EXPECTED_FILE=${ACTUAL_FILE//actual/expected}
+ mkdir -p $(dirname $EXPECTED_FILE)
+ cp $ACTUAL_FILE $EXPECTED_FILE
+done
+
+# "svn add" any newly expected files/dirs, and "svn rm" any that are gone now
+FILES=$(svn stat outputs/*/output-expected | grep ^\? | awk '{print $2}')
+for FILE in $FILES; do
+ svn add $FILE
+done
+FILES=$(svn stat outputs/*/output-expected | grep ^\! | awk '{print $2}')
+for FILE in $FILES; do
+ svn rm $FILE
+done