[PATCH 13/13] Add a validation script
From: Ramkumar Ramachandra <artagnon_at_gmail.com>
Date: Wed, 7 Jul 2010 02:14:53 +0200
Add a validation script along with a .gitignore. Using an existing
Signed-off-by: Ramkumar Ramachandra <artagnon_at_gmail.com>
--- .gitignore | 4 ++++ validate.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 0 deletions(-) create mode 100644 .gitignore create mode 100755 validate.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e9b906 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*~ +t/ +svndumpr +svndumpr_bench diff --git a/validate.sh b/validate.sh new file mode 100755 index 0000000..7b25db6 --- /dev/null +++ b/validate.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# asf.dump must exist in t/ +# Compile the program with end_revision = $2 when using the second branch + +case $1 in + generate) + [ -z $2 ] && { echo "Usage: $0 $1 <revision>"; exit 1; } || echo "Starting generation ..."; + if test -e "t/asf.dump" + then :; + else + echo "Need t/asf.dump (dumpfile v3) first. Generate it yourself or steal it from someone."; + exit 1; + fi + rm -rf t/repo; + mkdir t/repo; + svnadmin create t/repo; + gawk "/Revision-number: $(($2 + 1))/ { exit 1 }; { print \$0 };" t/asf.dump > "t/asf-$2.dump"; + [ $? = 1 ] && echo "Cut $2 succeeded!" || { echo "Cut $2 failed. Check t/asf.dump and validate.sh."; exit 1; } + svnadmin load t/repo < "t/asf-$2.dump" 1>"t/asf-$2-import.log" 2>"t/asf-$2-import.error"; + [ $? = 0 ] && echo "Load $2 succeeded!" || { echo "Load $2 failed. See t/asf-$2-import.debug for details."; exit 1; } + echo "Successfully generated asf-$2.dump and asf-$2-import.log. You can now run validate.sh validate $2" + exit 0;; + validate) + [ -z $2 ] && { echo "Usage: $0 $1 <revision>"; exit 1; } || echo "Starting validation ..."; + if test -e "t/asf-$2.dump" && test -e "t/asf-$2-import.log" + then :; + else + echo "Run validate.sh genereate $2 first."; + exit 1; + fi + rm -rf /tmp/svn-fe; + mkdir /tmp/svn-fe; + rm -rf t/repo; + mkdir t/repo; + svnadmin create t/repo; + make svndumpr > /dev/null; + [ $? = 0 ] && echo "Make succeeded!" || { echo "Make failed. Check the program."; exit 1; } + ./svndumpr 1>t/asf-mine.dump; + [ $? = 0 ] && echo "Run succeeded!" || { echo "Run failed. See t/asf.debug for details."; exit 1; } + diff -au "t/asf-$2.dump" t/asf-mine.dump > t/dump-diff.error; + gawk '$0 !~ "Prop-delta: true|Text-delta-base-|sha1|Text-copy-source-|^-$" && $0 ~ "^+|^-" { print; }' t/dump-diff.error > t/dump-diff-filtered.error; + svnadmin load t/repo < t/asf-mine.dump 1>t/asf-mine-import.log 2>t/asf-mine-import.error; + [ $? = 0 ] && echo "Load $2 succeeded!" || { echo "Load failed. See t/asf-mine-import.error, t/dump-diff.error, and t/dump-diff-filtered.error for details."; exit 1; } + diff -au "t/asf-$2-import.log" t/asf-mine-import.log > t/import-diff.error; + [ $? = 0 ] && echo "Validation $2 succeeded!" || { echo "Validation failed. See t/import-diff.error for details."; exit 1; } + exit 0;; + *) + echo "Usage: $0 <operation> <revision>"; + exit 1;; +esac -- 1.7.1Received on 2010-07-07 02:14:32 CEST |
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.