(test suite) changes to test-driver for "all in one user" testing

This commit is contained in:
Sitaram Chamarty 2011-10-11 08:42:41 +05:30
parent 7729433c05
commit f48a0b9d73

View file

@ -12,29 +12,30 @@ export TESTDIR=$PWD
export TEST_BASE=$(gl-query-rc REPO_BASE) export TEST_BASE=$(gl-query-rc REPO_BASE)
[ -z "$TEST_BASE" ] && { echo TEST_BASE not set >&2; exit 1; } [ -z "$TEST_BASE" ] && { echo TEST_BASE not set >&2; exit 1; }
TEST_BASE_FULL=$TEST_BASE TEST_BASE_FULL=$TEST_BASE
[ "$TEST_BASE" = "repositories" ] && TEST_BASE_FULL=/home/gitolite-test/repositories [ "$TEST_BASE" = "repositories" ] && TEST_BASE_FULL=/home/$USER/repositories
testnum=0 testnum=0
# remote local command # remote local command
runlocal() { "$@" > ~/1 2> ~/2; } runlocal() { "$@" > ~/1 2> ~/2; }
# remote run command # remote run command
runremote() { ssh gitolite-test@localhost "$@" > ~/1 2> ~/2; } runremote() ( cd $HOME; "$@" > ~/1 2> ~/2; )
# remote list repositories # remote list repositories
listrepos() { ssh gitolite-test@localhost "cd $TEST_BASE; find . -type d -name '*.git'" | sort > ~/1 2> ~/2; } listrepos() ( cd $HOME; cd $TEST_BASE; find . -type d -name '*.git' | sort > ~/1 2> ~/2; )
# remote cat compiled pm # remote cat compiled pm
catconf() { ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm > ~/1 2> ~/2; } catconf() ( cat ~/.gitolite/conf/gitolite.conf-compiled.pm > ~/1 2> ~/2; )
catconfs() { catconfs() {
( (
ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm cd $HOME
ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort" cat .gitolite/conf/gitolite.conf-compiled.pm
ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort | xargs cat" cd $TEST_BASE; find . -name gl-conf | sort
cd $TEST_BASE; find . -name gl-conf | sort | xargs cat
) > ~/1 2> ~/2 ) > ~/1 2> ~/2
} }
# remote cat ~/.gitolite.rc # remote cat ~/.gitolite.rc
catrc() { ssh gitolite-test@localhost cat .gitolite.rc > ~/1 2> ~/2; } catrc() ( cat ~/.gitolite.rc > ~/1 2> ~/2; )
# tail gitolite logfile # tail gitolite logfile
taillog() { ssh gitolite-test@localhost tail $1 .gitolite/logs/gitolite-????-??.log > ~/1 2> ~/2; } taillog() ( cd $HOME; tail $1 .gitolite/logs/gitolite-????-??.log > ~/1 2> ~/2; )
hl() { # highlight function hl() { # highlight function
normal=`tput sgr0` normal=`tput sgr0`
red=`tput sgr0; tput setaf 1; tput bold` red=`tput sgr0; tput setaf 1; tput bold`
@ -52,16 +53,12 @@ hl() { # highlight function
capture() { cf=$1; shift; "$@" >& $TESTDIR/$cf; } capture() { cf=$1; shift; "$@" >& $TESTDIR/$cf; }
editrc() { editrc() {
scp gitolite-test@localhost:.gitolite.rc ~/junk >/dev/null perl -pi -e "print STDERR if not /^#/ and /$1\b/ and s/=.*/= $2;/" ~/.gitolite.rc 2> >(sed -e 's/^/# /')
perl -pi -e "print STDERR if not /^#/ and /$1\b/ and s/=.*/= $2;/" ~/junk 2> >(sed -e 's/^/# /')
scp ~/junk gitolite-test@localhost:.gitolite.rc >/dev/null
} }
addrc() { addrc() {
ssh gitolite-test@localhost cat .gitolite.rc < /dev/null > ~/junk tee -a ~/.gitolite.rc
tee -a ~/junk echo '1;' >> ~/.gitolite.rc
echo '1;' >> ~/junk
scp ~/junk gitolite-test@localhost:.gitolite.rc >/dev/null
} }
ugc () ugc ()