Major cleanup/refactoring
[guilt.git] / regression / scaffold
blobf8c813fcf411491f5d5ce876a1646a99e8efaa57
1 #!/bin/bash
3 set -e
5 export REPODIR=/tmp/$RANDOM
7 function empty_repo
9 rm -rf $REPODIR || exit 1
10 mkdir $REPODIR || exit 1
11 cd $REPODIR
12 git-init-db 2> /dev/null > /dev/null
15 function verify_repo
17 ( find $1 -type d -printf 'd %p\n' ; find $1 -type f -printf 'f %p\n' ; find $1 -type b -printf 'b %p\n' ; find $1 -type c -printf %'c %p\n' ; find $1 -type l -printf 'l %p\n') | sort > /tmp/check-$$
18 grep -v '^$' | sort | diff -u - /tmp/check-$$
19 ERR=$?
20 rm -f /tmp/check-$$
21 return $ERR
24 function shouldfail
26 if $* 2>/tmp/saveout-$$ ; then
27 echo "UNWANTED SUCCESS: " $*
28 cat /tmp/saveout-$$
29 return 1
31 rm -f /tmp/saveout-$$
32 return 0
35 function complete_test
37 echo "OK"
38 rm -rf $REPODIR
41 echo -n "`basename $0`: "